From owner-svn-src-all@FreeBSD.ORG Wed Jan 20 00:43:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1D06106568B; Wed, 20 Jan 2010 00:43:15 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A71DF8FC18; Wed, 20 Jan 2010 00:43:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0K0hFZL055348; Wed, 20 Jan 2010 00:43:15 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0K0hFvk055345; Wed, 20 Jan 2010 00:43:15 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201001200043.o0K0hFvk055345@svn.freebsd.org> From: Xin LI Date: Wed, 20 Jan 2010 00:43:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r202662 - stable/8/usr.sbin/burncd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2010 00:43:15 -0000 Author: delphij Date: Wed Jan 20 00:43:15 2010 New Revision: 202662 URL: http://svn.freebsd.org/changeset/base/202662 Log: MFC r200795: Add support of using environment variable BURNCD_SPEED to specify recodring speed. PR: bin/140530 Submitted by: Alexander Best Modified: stable/8/usr.sbin/burncd/burncd.8 stable/8/usr.sbin/burncd/burncd.c Directory Properties: stable/8/usr.sbin/burncd/ (props changed) Modified: stable/8/usr.sbin/burncd/burncd.8 ============================================================================== --- stable/8/usr.sbin/burncd/burncd.8 Tue Jan 19 23:07:12 2010 (r202661) +++ stable/8/usr.sbin/burncd/burncd.8 Wed Jan 20 00:43:15 2010 (r202662) @@ -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/8/usr.sbin/burncd/burncd.c ============================================================================== --- stable/8/usr.sbin/burncd/burncd.c Tue Jan 19 23:07:12 2010 (r202661) +++ stable/8/usr.sbin/burncd/burncd.c Wed Jan 20 00:43:15 2010 (r202662) @@ -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();