Put rate limiting options behind #ifdef
Fixes compile issue when ENABLE_IPMI_SNOOP is set (rateLimit var set but
not used).
Also add usage help text for --rate-limit option.
Tested: Compiles with IPMI snoop feature enabled and disabled.
Change-Id: I13a7f6c4633577d24124667a428f047b657c0da1
Signed-off-by: Jonathan Doman <jonathan.doman@intel.com>
diff --git a/main.cpp b/main.cpp
index 5188502..62a08da 100644
--- a/main.cpp
+++ b/main.cpp
@@ -107,6 +107,8 @@
" -b, --bytes <SIZE> set POST code length to <SIZE> bytes. "
"Default is %zu\n"
" -d, --device <DEVICE> use <DEVICE> file.\n"
+ " -r, --rate-limit=<N> Only process N POST codes from the "
+ "device per second.\n"
" -h, --host <host instances> . Default is '%s'\n"
" -v, --verbose Prints verbose information while running\n\n",
name, codeSize, defaultHostInstances);
@@ -294,8 +296,8 @@
#ifndef ENABLE_IPMI_SNOOP
int postFd = -1;
-#endif
unsigned int rateLimit = 0;
+#endif
int opt;
@@ -318,8 +320,8 @@
{"bytes", required_argument, NULL, 'b'},
#ifndef ENABLE_IPMI_SNOOP
{"device", optional_argument, NULL, 'd'},
- #endif
{"rate-limit", optional_argument, NULL, 'r'},
+ #endif
{"verbose", no_argument, NULL, 'v'},
{0, 0, 0, 0}
};
@@ -369,7 +371,6 @@
return -1;
}
break;
-#endif
case 'r': {
int argVal = -1;
try
@@ -392,6 +393,7 @@
argVal);
break;
}
+#endif
case 'v':
verbose = true;
break;