On Sun, May 21, 2006 at 02:28:29PM -0300, Ricardo A. Reis wrote:
> 
>       First about exit codes, when program is executed without options,  
> how this must return ?
>       kldunload and kldload not return the same exit codes,
> 
>    [EMAIL PROTECTED]:~/kldfind] # kldload
> usage: kldload [-v] file ...
> zsh: 48524 exit 1     kldload
> 
> [EMAIL PROTECTED]:~/kldfind] # kldunload
> usage: kldunload [-fv] -i id ...
>        kldunload [-fv] [-n] name ...
> zsh: 48539 exit 64    kldunload
> 
> [EMAIL PROTECTED]:~/kldfind] # ./kldfind-v056
> usage: kldfind-v056 [-chqsv] ...
> 
>       In kldfind i return 0

See the manpage for sysexits(3).  Both should return EX_USAGE (64) in this
case.  You should only return EX_OK (0) if the command was successful.  If
you're spitting out usage text, return EX_USAGE.  Also by glancing at your
usage string, it's not apparent that specifying no options is an invalid
usage.  Without reading through your script, I'm not sure which options are
optional or which are required.  I read "[-chqsv]" meaning use any of those
options in any combination, or no options whatsoever.

Consider something like either:
        kldfind -c | -s | -h [-qv] modulename ...

or a multi-line usage (e.g. something like bsdlabel(1)):
        kldfind [-qv] -c category ...
        kldfind [-qv] -s string ...
        kldfind [-qv] -h

Personally, I'd prefer clarity over brevity.  Just my 3 cents,

-- Rick C. Petty
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to