diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index 402b494bce888a13cab3ce31f1f79ae4496d1f48..c9cd1a16d1ed4717e97b398265cc5a3eeb7130f3 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -1038,12 +1038,13 @@ daemonUsage(const char *argv0, bool privileged) " %s [options]\n" "\n" "Options:\n" + " -h | --help Display program help:\n" " -v | --verbose Verbose messages.\n" " -d | --daemon Run as a daemon & write PID file.\n" " -l | --listen Listen for TCP/IP connections.\n" " -t | --timeout Exit after timeout period.\n" " -f | --config Configuration file.\n" - " | --version Display version information.\n" + " -V | --version Display version information.\n" " -p | --pid-file Change name of PID file.\n" "\n" "libvirt management daemon:\n"), @@ -1098,10 +1099,6 @@ daemonUsage(const char *argv0, bool privileged) } } -enum { - OPT_VERSION = 129 -}; - #define MAX_LISTEN 5 int main(int argc, char **argv) { virNetServerPtr srv = NULL; @@ -1123,14 +1120,14 @@ int main(int argc, char **argv) { mode_t old_umask; struct option opts[] = { - { "verbose", no_argument, &verbose, 1}, - { "daemon", no_argument, &godaemon, 1}, - { "listen", no_argument, &ipsock, 1}, + { "verbose", no_argument, &verbose, 'v'}, + { "daemon", no_argument, &godaemon, 'd'}, + { "listen", no_argument, &ipsock, 'l'}, { "config", required_argument, NULL, 'f'}, { "timeout", required_argument, NULL, 't'}, { "pid-file", required_argument, NULL, 'p'}, - { "version", no_argument, NULL, OPT_VERSION }, - { "help", no_argument, NULL, '?' }, + { "version", no_argument, NULL, 'V' }, + { "help", no_argument, NULL, 'h' }, {0, 0, 0, 0} }; @@ -1173,7 +1170,7 @@ int main(int argc, char **argv) { int c; char *tmp; - c = getopt_long(argc, argv, "ldf:p:t:v", opts, &optidx); + c = getopt_long(argc, argv, "ldf:p:t:vVh", opts, &optidx); if (c == -1) { break; @@ -1219,17 +1216,17 @@ int main(int argc, char **argv) { } break; - case OPT_VERSION: + case 'V': daemonVersion(argv[0]); - return 0; + exit(EXIT_SUCCESS); - case '?': + case 'h': daemonUsage(argv[0], privileged); - return 2; + exit(EXIT_SUCCESS); + case '?': default: - VIR_ERROR(_("%s: internal error: unknown flag: %c"), - argv[0], c); + daemonUsage(argv[0], privileged); exit(EXIT_FAILURE); } } diff --git a/daemon/libvirtd.pod.in b/daemon/libvirtd.pod.in index 930b75236e7eabcb93782c0de26d1de1935f49fd..9901ecfe5126d6b5dfe7712514ee1e25a22744f4 100644 --- a/daemon/libvirtd.pod.in +++ b/daemon/libvirtd.pod.in @@ -36,6 +36,10 @@ from the configuration. =over +=item B<-h, --help> + +Display command line help usage then exit. + =item B<-d, --daemon> Run as a daemon & write PID file. diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c index c45f45ce5fb7a674d263ef2b69ac613499a6376e..77d6e0d85ed344ced7a022eceb1ffb8541dcf50d 100644 --- a/src/locking/lock_daemon.c +++ b/src/locking/lock_daemon.c @@ -1096,10 +1096,11 @@ virLockDaemonUsage(const char *argv0, bool privileged) " %s [options]\n" "\n" "Options:\n" + " -h | --help Display program help:\n" " -v | --verbose Verbose messages.\n" " -d | --daemon Run as a daemon & write PID file.\n" " -f | --config Configuration file.\n" - " | --version Display version information.\n" + " -V | --version Display version information.\n" " -p | --pid-file Change name of PID file.\n" "\n" "libvirt lock management daemon:\n"), argv0); @@ -1138,10 +1139,6 @@ virLockDaemonUsage(const char *argv0, bool privileged) } } -enum { - OPT_VERSION = 129 -}; - #define MAX_LISTEN 5 int main(int argc, char **argv) { virNetServerProgramPtr lockProgram = NULL; @@ -1161,12 +1158,12 @@ int main(int argc, char **argv) { int rv; struct option opts[] = { - { "verbose", no_argument, &verbose, 1}, - { "daemon", no_argument, &godaemon, 1}, + { "verbose", no_argument, &verbose, 'v'}, + { "daemon", no_argument, &godaemon, 'd'}, { "config", required_argument, NULL, 'f'}, { "pid-file", required_argument, NULL, 'p'}, - { "version", no_argument, NULL, OPT_VERSION }, - { "help", no_argument, NULL, '?' }, + { "version", no_argument, NULL, 'V' }, + { "help", no_argument, NULL, 'h' }, {0, 0, 0, 0} }; @@ -1185,7 +1182,7 @@ int main(int argc, char **argv) { int optidx = 0; int c; - c = getopt_long(argc, argv, "ldf:p:t:v", opts, &optidx); + c = getopt_long(argc, argv, "ldf:p:t:vVh", opts, &optidx); if (c == -1) { break; @@ -1218,17 +1215,17 @@ int main(int argc, char **argv) { } break; - case OPT_VERSION: + case 'V': virLockDaemonVersion(argv[0]); - return 0; + exit(EXIT_SUCCESS); - case '?': + case 'h': virLockDaemonUsage(argv[0], privileged); - return 2; + exit(EXIT_SUCCESS); + case '?': default: - fprintf(stderr, _("%s: internal error: unknown flag: %c\n"), - argv[0], c); + virLockDaemonUsage(argv[0], privileged); exit(EXIT_FAILURE); } } diff --git a/src/locking/virtlockd.pod.in b/src/locking/virtlockd.pod.in index f5748ca1536c90e530f9b17d568ad5c2773f37c4..99612aa537b0380be168f85e19fa353aa7601306 100644 --- a/src/locking/virtlockd.pod.in +++ b/src/locking/virtlockd.pod.in @@ -26,6 +26,10 @@ The virtlockd daemon listens for requests on a local Unix domain socket. =over +=item B<-h, --help> + +Display command line help usage then exit. + =item B<-d, --daemon> Run as a daemon and write PID file. @@ -42,7 +46,7 @@ Use this name for the PID file, overriding the default value. Enable output of verbose messages. -=item B< --version> +=item B<-V, --version> Display version information then exit.