summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-06-03 23:28:38 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2014-06-03 23:28:38 -0700
commit0caed2fbce401e48d55ebfeda968e9ea8012f01d (patch)
tree769384cd0e6cc31e0d0f01ffb85f3835225fa720
parentcf3acd85392869ff35dc4869d66455363890e05d (diff)
Print which option was in error along with usage message
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--xsm.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/xsm.c b/xsm.c
index 2a30717..c02cfbe 100644
--- a/xsm.c
+++ b/xsm.c
@@ -175,12 +175,20 @@ main(int argc, char *argv[])
switch (argv[i][1])
{
case 'd': /* -display */
- if (++i >= argc) goto usage;
+ if (++i >= argc) {
+ fprintf (stderr, "%s: -display requires an argument\n",
+ argv[0]);
+ goto usage;
+ }
cmd_line_display = (char *) XtNewString (argv[i]);
continue;
case 's': /* -session */
- if (++i >= argc) goto usage;
+ if (++i >= argc) {
+ fprintf (stderr, "%s: -session requires an argument\n",
+ argv[0]);
+ goto usage;
+ }
session_name = XtNewString (argv[i]);
continue;
@@ -190,6 +198,8 @@ main(int argc, char *argv[])
}
}
+ fprintf (stderr, "%s: unrecognized argument '%s'\n", argv[0], argv[i]);
+
usage:
fprintf (stderr,
"Usage: xsm [-display display] [-session sessionName] [-verbose]\n");