diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2014-06-03 23:28:38 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2014-06-03 23:28:38 -0700 |
commit | 0caed2fbce401e48d55ebfeda968e9ea8012f01d (patch) | |
tree | 769384cd0e6cc31e0d0f01ffb85f3835225fa720 | |
parent | cf3acd85392869ff35dc4869d66455363890e05d (diff) |
Print which option was in error along with usage message
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | xsm.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -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"); |