[libvirt] [PATCH] Properly handle -h / -V for --help/--version aliases in virtlockd/libvirtd

Eric Blake eblake at redhat.com
Tue Aug 13 12:35:47 UTC 2013


On 08/13/2013 05:17 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> The virtlockd/libvirtd daemons had listed '?' as the short option
> for --help. getopt_long uses '?' for any unknown option. We want
> to be able to distinguish unknown options (which use EXIT_FAILURE)
> from correct usage of help (which should use EXIT_SUCCESS). Thus
> we should use 'h' as a short option for --help. Also add this to
> the man page docs
> 
> The virtlockd/libvirtd daemons did not list any short option
> for the --version arg. Add -V as a valid short option, since
> -v is already used for --verbose.
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  daemon/libvirtd.c            | 31 ++++++++++++++-----------------
>  daemon/libvirtd.pod.in       |  4 ++++
>  src/locking/lock_daemon.c    | 29 +++++++++++++----------------
>  src/locking/virtlockd.pod.in |  6 +++++-
>  4 files changed, 36 insertions(+), 34 deletions(-)

ACK.

>  
> -enum {
> -    OPT_VERSION = 129
> -};

Good riddance - on single-byte locales, it is actually possible to type
byte 129 (when using a long-only option, you should generally list it
starting from 257, so that it can't be typed as an accidental short
option of some weird character).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130813/761f66a2/attachment-0001.sig>


More information about the libvir-list mailing list