Alexander Best <[email protected]> writes:
>  
> +     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':

You realize you're duplicating 6 lines of non-trivial code for no good
reason?

env_speed = getenv("BURNCD_SPEED");

while ((ch = getopt(...)) != -1) {
    switch (ch) {
    case 's':
        env_speed = optarg;
        break;
    ...
    }
}

if (env_speed != NULL) {
    if (strcasecmp...) {
        ...
    }
}

DES
-- 
Dag-Erling Smørgrav - [email protected]
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[email protected]"

Reply via email to