Blob Blame History Raw
From 46201f029e4a5ac3ba0aaf05cb6df80341729566 Mon Sep 17 00:00:00 2001
From: Ken Gaillot <kgaillot@redhat.com>
Date: Mon, 30 Jul 2018 14:17:49 -0500
Subject: [PATCH] Doc: tools: add --help/--version options to ipmiservicelogd

allows ppc64le build when relevant dependencies are installed
---
 tools/ipmiservicelogd.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/tools/ipmiservicelogd.c b/tools/ipmiservicelogd.c
index 4f52865..865eae0 100644
--- a/tools/ipmiservicelogd.c
+++ b/tools/ipmiservicelogd.c
@@ -253,7 +253,7 @@ getProductName(void)
 static void
 con_usage(const char *name, const char *help, void *cb_data)
 {
-    printf("\n%s%s", name, help);
+    printf("%s\n", help);
 }
 
 static void
@@ -261,7 +261,7 @@ usage(const char *progname)
 {
     printf("Usage:\n");
     printf(" %s <con_parms>\n", progname);
-    printf(" Where <con_parms> is one of:");
+    printf(" Where <con_parms> is one of:\n");
     ipmi_parse_args_iter_help(con_usage, NULL);
 }
 
@@ -550,6 +550,18 @@ main(int argc, char *argv[])
     /* Initialize the OpenIPMI library. */
     ipmi_init(os_hnd);
 
+    // Check for pacemaker-standard help and version options
+    if (argc > 1) {
+        for (char **arg = &argv[1]; *arg != NULL; ++arg) {
+            if (!strcmp(*arg, "--help") || !strcmp(*arg, "-?")) {
+                usage(argv[0]);
+                return 0;
+            } else if (!strcmp(*arg, "--version") || !strcmp(*arg, "-$")) {
+                crm_help('$', 0);
+            }
+        }
+    }
+
 #ifdef COMPLEX
     rv = ipmi_parse_args2(&curr_arg, argc, argv, &args);
     if (rv) {
-- 
1.8.3.1