diff options
| author | Steve Dickson <steved@redhat.com> | 2016-01-20 14:56:54 -0500 |
|---|---|---|
| committer | Steve Dickson <steved@redhat.com> | 2016-01-20 14:56:54 -0500 |
| commit | 3a2747736666dab2c266efa07dd5a453bf9b7482 (patch) | |
| tree | 47019e80ac11c7b2f32715c28b479508694ff31a | |
| parent | e57642c50c9b2e409d1fc2775bdf88f64b344dd3 (diff) | |
| download | nfs-utils-3a2747736666dab2c266efa07dd5a453bf9b7482.tar.gz nfs-utils-3a2747736666dab2c266efa07dd5a453bf9b7482.tar.xz nfs-utils-3a2747736666dab2c266efa07dd5a453bf9b7482.zip | |
blkmapd: Added a usage routine
Show the correct arguments when invalid
arguments are used.
Signed-off-by: Steve Dickson <steved@redhat.com>
| -rw-r--r-- | utils/blkmapd/device-discovery.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c index b52afe2..b010628 100644 --- a/utils/blkmapd/device-discovery.c +++ b/utils/blkmapd/device-discovery.c @@ -427,7 +427,10 @@ void sig_die(int signal) BL_LOG_ERR("exit on signal(%d)\n", signal); exit(1); } - +static void usage(void) +{ + fprintf(stderr, "Usage: blkmapd [-hdf]\n" ); +} /* Daemon */ int main(int argc, char **argv) { @@ -435,7 +438,7 @@ int main(int argc, char **argv) struct stat statbuf; char pidbuf[64]; - while ((opt = getopt(argc, argv, "df")) != -1) { + while ((opt = getopt(argc, argv, "hdf")) != -1) { switch (opt) { case 'd': dflag = 1; @@ -443,6 +446,13 @@ int main(int argc, char **argv) case 'f': fg = 1; break; + case 'h': + usage(); + exit(0); + default: + usage(); + exit(1); + } } |
