Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 May 2006 13:17:51 -0500
From:      "Rick C. Petty" <rick-freebsd@kiwi-computer.com>
To:        "Ricardo A. Reis" <ricardo_bsd@yahoo.com.br>
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: kldfind, updated for version 0.56
Message-ID:  <20060524181751.GA92607@megan.kiwi-computer.com>
In-Reply-To: <op.s9wv5rgnp1tyz6@myfreebsd>
References:  <op.s9wv5rgnp1tyz6@myfreebsd>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060524181751.GA92607>