From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 19 Feb 2008 16:01:39 -0000 Subject: [Cluster-devel] conga/ricci/ricci main.cpp Message-ID: <20080219160139.3372.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/main.cpp.diff?cvsroot=cluster&r1=1.10&r2=1.11 --- conga/ricci/ricci/main.cpp 2008/02/19 15:51:52 1.10 +++ conga/ricci/ricci/main.cpp 2008/02/19 16:01:39 1.11 @@ -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 Listen for connections on the specified port.\n\ + -u 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;