kldfind, updated for version 0.56

Rick C. Petty rick-freebsd at kiwi-computer.com
Wed May 24 11:17:55 PDT 2006


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,
> 
>    [ricardo at myfreebsd:~/kldfind] # kldload
> usage: kldload [-v] file ...
> zsh: 48524 exit 1     kldload
> 
> [ricardo at myfreebsd:~/kldfind] # kldunload
> usage: kldunload [-fv] -i id ...
>        kldunload [-fv] [-n] name ...
> zsh: 48539 exit 64    kldunload
> 
> [ricardo at myfreebsd:~/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


More information about the freebsd-hackers mailing list