From 553e877c6d5e5249371573fc91e66f446111c67f Mon Sep 17 00:00:00 2001 From: Nate Straz Date: Tue, 19 Sep 2006 15:19:27 +0000 Subject: When no args were given, argv[0] would return NULL and the program name in the usage output would show "(null)." qarsh isn't called anything else so just hard code qarsh in the usage message. --- qarsh.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'qarsh.c') diff --git a/qarsh.c b/qarsh.c index 1bf4fd7..8ea3d35 100644 --- a/qarsh.c +++ b/qarsh.c @@ -38,9 +38,9 @@ int sigs_to_propogate[] = { SIGINT, SIGTERM, SIGHUP, SIGUSR1, SIGUSR2 }; sigset_t pselect_sigmask; void -usage(const char *pname) +usage() { - fprintf(stderr, "%s [options] [user[.group]@]hostname cmdline ...\n" + fprintf(stderr, "qarsh [options] [user[.group]@]hostname cmdline ...\n" "-l user Run cmdline using this user name.\n" "-g group Run cmdline using this group name.\n" "-p port Use this port to contact qarshd.\n" @@ -49,8 +49,7 @@ usage(const char *pname) " A value of 0 disables heartbeating.\n" " Default is value is 120.\n" " Env var QARSH_TIMEOUT can also be set.\n" - - ,pname); + ); return; } @@ -391,7 +390,7 @@ again: case '?': default: printf("Unknown option %c\n", (char)optopt); - usage(argv[0]); + usage(); exit(1); } } /* Some programs (rsync) put the hostname before some qarsh options @@ -412,7 +411,7 @@ again: } if (!host) { - usage(argv[0]); + usage(); exit(1); } @@ -439,7 +438,7 @@ again: } if ((args = copyargs(argv)) == NULL) { - usage(argv[0]); + usage(); exit(1); } -- cgit