Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 09 Nov 2009 20:24:56 +0100 (CET)
From:      Alexander Best <alexbestms@wwu.de>
To:        <freebsd-hackers@FreeBSD.org>
Cc:        Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= <des@des.no>, Giorgos Keramidas <keramida@freebsd.org>
Subject:   Re: [patch] burncd: honour for envar SPEED
Message-ID:  <permail-200911091924561e86ffa8000070ba-a_best01@message-id.uni-muenster.de>
In-Reply-To: <87k4xzbmhq.fsf@kobe.laptop>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
here's the final patch. would be great if somebody could commit this one. the
only thing i'm not 100% sure about are the burncd(8) changes. i'm not that
familiar with the man syntax.

thanks go out to keramida@ and des@ for their help.

alex

...just realised the topic makes no sense. ;) what i meant to write was
probably "[patch] burncd: honour envar SPEED". ;)

[-- Attachment #2 --]
Index: usr.sbin/burncd/burncd.8
===================================================================
--- usr.sbin/burncd/burncd.8	(revision 199064)
+++ usr.sbin/burncd/burncd.8	(working copy)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 2, 2005
+.Dd Nov 9, 2009
 .Os
 .Dt BURNCD 8
 .Sh NAME
@@ -158,7 +158,11 @@
 .Sh ENVIRONMENT
 The following environment variables affect the execution of
 .Nm :
-.Bl -tag -width ".Ev CDROM"
+.Bl -tag -width ".Ev BURNCD_SPEED"
+.It Ev BURNCD_SPEED
+The write speed to use if one is not specified with the
+.Fl s
+flag.
 .It Ev CDROM
 The CD device to use if one is not specified with the
 .Fl f
Index: usr.sbin/burncd/burncd.c
===================================================================
--- usr.sbin/burncd/burncd.c	(revision 199064)
+++ usr.sbin/burncd/burncd.c	(working copy)
@@ -80,11 +80,20 @@
 	int dao = 0, eject = 0, fixate = 0, list = 0, multi = 0, preemp = 0;
 	int nogap = 0, speed = 4 * 177, test_write = 0, force = 0;
 	int block_size = 0, block_type = 0, cdopen = 0, dvdrw = 0;
-	const char *dev;
+	const char *dev, *env_speed;
 
 	if ((dev = getenv("CDROM")) == NULL)
 		dev = "/dev/acd0";
 
+	if ((env_speed = getenv("BURNCD_SPEED")) != NULL) {
+		if (strcasecmp("max", env_speed) == 0)
+			speed = CDR_MAX_SPEED;
+		else
+			speed = atoi(env_speed) * 177;
+		if (speed <= 0)
+			errx(EX_USAGE, "Invalid speed: %s", env_speed);
+	}
+
 	while ((ch = getopt(argc, argv, "def:Flmnpqs:tv")) != -1) {
 		switch (ch) {
 		case 'd':

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?permail-200911091924561e86ffa8000070ba-a_best01>