bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Cooker] strange problem with "hotplug" package


From: Jim Meyering
Subject: Re: [Cooker] strange problem with "hotplug" package
Date: Thu, 08 May 2003 18:17:48 +0200

Thanks!

Stepan Kasal <address@hidden> wrote:
> @@ -1579,7 +1578,7 @@ main (int argc, char **argv)
>                    !strcasecmp(optarg, "if-tty"))
>              color_option = 2;
>            else
> -            show_help = 1;
> +         error (2, 0, _("unrecognized colour option"));

A minor nit: it is customary to include the offending string
in such a diagnostic.  It's also nice to allow the user to specify
a prefix of the option argument: grep --color=al

To that end, you might want to use XARGMATCH as in e.g., coreutils' ls.c.
It does this for --time={atime, access, use, ctime, status}

        case TIME_OPTION:
          time_type = XARGMATCH ("--time", optarg, time_args, time_types);
          break;

With that and the corresponding declarations,
ls gives diagnostics like this:

    $ ls --time=z
    ls: invalid argument `z' for `--time'
    Valid arguments are:
      - `atime', `access', `use'
      - `ctime', `status'
    Try `ls --help' for more information.

You'd need lib/argmatch.[ch].




reply via email to

[Prev in Thread] Current Thread [Next in Thread]