From owner-freebsd-bugs@FreeBSD.ORG Fri Nov 13 14:50:02 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46EBF1065676 for ; Fri, 13 Nov 2009 14:50:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 0A31B8FC1C for ; Fri, 13 Nov 2009 14:50:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nADEo124063754 for ; Fri, 13 Nov 2009 14:50:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id nADEo1Oq063753; Fri, 13 Nov 2009 14:50:01 GMT (envelope-from gnats) Resent-Date: Fri, 13 Nov 2009 14:50:01 GMT Resent-Message-Id: <200911131450.nADEo1Oq063753@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Alexander Best Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB95F106566C for ; Fri, 13 Nov 2009 14:40:15 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 9011F8FC32 for ; Fri, 13 Nov 2009 14:40:15 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id nADEeEOE004595 for ; Fri, 13 Nov 2009 14:40:14 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id nADEeEDv004586; Fri, 13 Nov 2009 14:40:14 GMT (envelope-from nobody) Message-Id: <200911131440.nADEeEDv004586@www.freebsd.org> Date: Fri, 13 Nov 2009 14:40:14 GMT From: Alexander Best To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/140530: [patch] make burncd(8) honour envar BURNCD_SPEED X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2009 14:50:02 -0000 >Number: 140530 >Category: bin >Synopsis: [patch] make burncd(8) honour envar BURNCD_SPEED >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Nov 13 14:50:01 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Alexander Best >Release: 9.0-CURRENT >Organization: >Environment: FreeBSD otaku 9.0-CURRENT FreeBSD 9.0-CURRENT #4 r199236M: Thu Nov 12 23:30:19 CET 2009 root@otaku:/usr/obj/usr/src/sys/ARUNDEL i386 >Description: this patch makes burncd honour the envar BURNCD_SPEED. discussed with keramida@ and des@ in this thread: http://lists.freebsd.org/pipermail/freebsd-hackers/2009-November/029969.html the final patch can be found (apart from this pr) here: http://lists.freebsd.org/pipermail/freebsd-hackers/2009-November/029994.html cheers. alex >How-To-Repeat: >Fix: Patch attached with submission follows: Index: usr.sbin/burncd/burncd.8 =================================================================== --- usr.sbin/burncd/burncd.8 (revision 199236) +++ 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 199236) +++ usr.sbin/burncd/burncd.c (working copy) @@ -80,11 +80,13 @@ 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 @@ 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 @@ 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(); >Release-Note: >Audit-Trail: >Unformatted: