Date: Mon, 09 Nov 2009 21:58:21 +0100 From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no> To: Alexander Best <alexbestms@wwu.de> Cc: freebsd-hackers@FreeBSD.org, Giorgos Keramidas <keramida@freebsd.org> Subject: Re: [patch] burncd: honour for envar SPEED Message-ID: <86aayvfmaa.fsf@ds4.des.no> In-Reply-To: <permail-200911091924561e86ffa8000070ba-a_best01@message-id.uni-muenster.de> (Alexander Best's message of "Mon, 09 Nov 2009 20:24:56 %2B0100 (CET)") References: <permail-200911091924561e86ffa8000070ba-a_best01@message-id.uni-muenster.de>
next in thread | previous in thread | raw e-mail | index | archive | help
Alexander Best <alexbestms@wwu.de> writes: >=20=20 > + if ((env_speed =3D getenv("BURNCD_SPEED")) !=3D NULL) { > + if (strcasecmp("max", env_speed) =3D=3D 0) > + speed =3D CDR_MAX_SPEED; > + else > + speed =3D atoi(env_speed) * 177; > + if (speed <=3D 0) > + errx(EX_USAGE, "Invalid speed: %s", env_speed); > + } > + > while ((ch =3D getopt(argc, argv, "def:Flmnpqs:tv")) !=3D -1) { > switch (ch) { > case 'd': You realize you're duplicating 6 lines of non-trivial code for no good reason? env_speed =3D getenv("BURNCD_SPEED"); while ((ch =3D getopt(...)) !=3D -1) { switch (ch) { case 's': env_speed =3D optarg; break; ... } } if (env_speed !=3D NULL) { if (strcasecmp...) { ... } } DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86aayvfmaa.fsf>