conga/ricci/ricci main.cpp
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2008-02-19 16:01:39
Modified files:
ricci/ricci : main.cpp
Log message:
Add a help dialog to be printed when the -h flag is given on the command line
ricci/ricci/main.cpp +18 -1
@@ -47,6 +47,19 @@ bool advertise_cluster = false; bool self_fence = false; +void print_help(void) { + printf("Usage: ricci [options]\n\ + -c Announce cluster name and OS to unauthenticated clients.\n\ + -d Enable debugging.\n\ + -f Run in the foreground.\n\ + -F Enable support for commands that allow clients to force\n\ + a reboot (same effect as /sbin/reboot -fn) as an alternative\n\ + to proper fencing.\n\ + -h Print this help dialog.\n\ + -p <port> Listen for connections on the specified port.\n\ + -u <uid> Drop root and run with the specified uid.\n"); +} + int drop_privs(uid_t new_uid) { int ret; cap_value_t saved_caps[] = { CAP_SYS_BOOT, CAP_SETUID };
@@ -116,7 +129,7 @@ int32_t ricci_port = RICCI_SERVER_PORT; int ret; - while ((ret = getopt(argc, argv, "cdfFu:p:")) != EOF) { + while ((ret = getopt(argc, argv, "cdfFhu:p:")) != EOF) { switch (ret) { case 'c': advertise_cluster = true;
@@ -134,6 +147,10 @@ self_fence = true; break; + case 'h': + print_help(); + exit(0); + case 'p': if (optarg != NULL) { uint32_t port;