Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Jan 2010 00:46:55 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r202663 - stable/7/usr.sbin/burncd
Message-ID:  <201001200046.o0K0ktng056200@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Wed Jan 20 00:46:55 2010
New Revision: 202663
URL: http://svn.freebsd.org/changeset/base/202663

Log:
  MFC r200795:
  
  Add support of using environment variable BURNCD_SPEED to specify
  recodring speed.
  
  PR:		bin/140530
  Submitted by:	Alexander Best <alexbestms wwu.de>

Modified:
  stable/7/usr.sbin/burncd/burncd.8
  stable/7/usr.sbin/burncd/burncd.c
Directory Properties:
  stable/7/usr.sbin/burncd/   (props changed)

Modified: stable/7/usr.sbin/burncd/burncd.8
==============================================================================
--- stable/7/usr.sbin/burncd/burncd.8	Wed Jan 20 00:43:15 2010	(r202662)
+++ stable/7/usr.sbin/burncd/burncd.8	Wed Jan 20 00:46:55 2010	(r202663)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 2, 2005
+.Dd December 21, 2009
 .Os
 .Dt BURNCD 8
 .Sh NAME
@@ -158,7 +158,11 @@ refers to stdin, and can only be used on
 .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

Modified: stable/7/usr.sbin/burncd/burncd.c
==============================================================================
--- stable/7/usr.sbin/burncd/burncd.c	Wed Jan 20 00:43:15 2010	(r202662)
+++ stable/7/usr.sbin/burncd/burncd.c	Wed Jan 20 00:46:55 2010	(r202663)
@@ -80,11 +80,13 @@ main(int argc, char **argv)
 	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";
 
+	env_speed = getenv("BURNCD_SPEED");
+
 	while ((ch = getopt(argc, argv, "def:Flmnpqs:tv")) != -1) {
 		switch (ch) {
 		case 'd':
@@ -124,12 +126,7 @@ main(int argc, char **argv)
 			break;
 
 		case 's':
-			if (strcasecmp("max", optarg) == 0)
-				speed = CDR_MAX_SPEED;
-			else
-				speed = atoi(optarg) * 177;
-			if (speed <= 0)
-				errx(EX_USAGE, "Invalid speed: %s", optarg);
+			env_speed = optarg;
 			break;
 
 		case 't':
@@ -147,6 +144,15 @@ main(int argc, char **argv)
 	argc -= optind;
 	argv += optind;
 
+	if (env_speed == NULL)
+		;
+	else 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", optarg);
+
 	if (argc == 0)
 		usage();
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001200046.o0K0ktng056200>