OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: simple s/and/or/ diff for getopt.1

From: Jason McIntyre (jmckerhand.co.uk)
Date: Sat Sep 02 2006 - 23:45:45 CDT


On Sat, Sep 02, 2006 at 10:10:22PM -0400, jared r r spiegel wrote:
> regarding:
> ---
> EXAMPLES
> The following code fragment shows how one might process the arguments for
> a command that can take the options -a and -b, and the option -o, which
> requires an argument.
> ---
>
> code snippet has '-a|-b) flag=$1; shift;;' in there for the example
> -a and -b options.
>
> the way it's written, ${flag} will be either '-a' or '-b' depending on
> which one of them appeared last in the args, so given that we don't
> know anything about the command the code snippet is meant to be an
> example for, is it safe to assume that the code snippet is "Right"
> and thus the eventual target command it's getopt(1)ing for takes
> "-a or -b" as opposed to "-a and -b" ?
>

i think it just depends how you read it. saying it both ways is correct
i think.

jmc

> jared
>
> Index: usr.bin/getopt/getopt.1
> ===================================================================
> RCS file: /cvs/src/usr.bin/getopt/getopt.1,v
> retrieving revision 1.11
> diff -u -r1.11 getopt.1
> --- usr.bin/getopt/getopt.1 14 Jan 2006 09:37:24 -0000 1.11
> +++ usr.bin/getopt/getopt.1 3 Sep 2006 02:04:00 -0000
> -49,7 +49,7
> The following code fragment shows how one might process the arguments
> for a command that can take the options
> .Fl a
> -and
> +or
> .Fl b ,
> and the option
> .Fl o ,