]> xenbits.xensource.com Git - libvirt.git/commit
virsh: distinguish errors between missing argument and wrong option
authorGuannan Ren <gren@redhat.com>
Tue, 19 Feb 2013 08:50:59 +0000 (16:50 +0800)
committerGuannan Ren <gren@redhat.com>
Wed, 20 Feb 2013 02:14:25 +0000 (10:14 +0800)
commitdd71fa110a05ae480a445a75e7c454914f42789c
tree17806c211abfd3924ecbaa6fd8767abf804a12cf
parentf190a636e5f4c7c457d0621b74398aa60e74847e
virsh: distinguish errors between missing argument and wrong option

Specifying ':' to suppress the error messages printed by getopt().
Then, distinguish the two types of errors.

Before:
 # virsh -c
   virsh: option requires an argument -- 'c'
   error: unsupported option '-?'. See --help.

After:
 # virsh -c
   error: option '-c' requires an argument

 # virsh -x
   error: unsupported option '-x'. See --help.
tools/virsh.c