summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-05-23 23:09:51 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2014-05-23 23:09:51 -0700
commit5d579a475beb6083c5321ea2293b7ec5c4328a62 (patch)
treeed164b9a03a4578fed389b3de6cd9cc24e053950
parent4c717e41a5d894ef833815396b0de057b53213aa (diff)
Print which option was in error along with usage message
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--xfsinfo.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/xfsinfo.c b/xfsinfo.c
index d847f85..0f447a0 100644
--- a/xfsinfo.c
+++ b/xfsinfo.c
@@ -86,10 +86,15 @@ main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
if (strncmp(argv[i], "-s", 2) == 0) {
- if (++i > argc)
+ if (++i >= argc) {
+ fprintf (stderr, "%s: %s requires an argument\n",
+ progname, argv[i-1]);
usage();
+ }
servername = argv[i];
} else {
+ fprintf (stderr, "%s: unrecognized argument %s\n",
+ progname, argv[i]);
usage();
}
}