From: Simon Ruderich Date: Tue, 20 May 2014 14:34:58 +0000 (+0200) Subject: fix compilation with --disable-x11 X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=aedd26b3895f80a440abdd0951eae627808ae8ed;p=wall-notify%2Fwall-notify.git fix compilation with --disable-x11 --- diff --git a/src/wall-notify.c b/src/wall-notify.c index 57ec37f..b06740b 100644 --- a/src/wall-notify.c +++ b/src/wall-notify.c @@ -391,6 +391,7 @@ static void usage(const char *argv0) { int main(int argc, char **argv) { int option, enable_x11, mesg_yes; + const char *argv0; int ptm, pts; char *name; @@ -400,6 +401,8 @@ int main(int argc, char **argv) { enable_x11 = 0; mesg_yes = 0; + argv0 = argv[0]; + /* * Glibc violates POSIX by default and skips over non-option arguments and * parses later arguments which look like options as well. But we want to @@ -416,7 +419,7 @@ int main(int argc, char **argv) { mesg_yes = 1; break; case 'h': - usage(argv[0]); + usage(argv0); break; case 'v': printf("%s%s\n", @@ -426,15 +429,15 @@ int main(int argc, char **argv) { break; default: fprintf(stderr, "%s: unknown option '%s'!\n\n", - argv[0], argv[optind - 1]); - usage(argv[0]); + argv0, argv[optind - 1]); + usage(argv0); break; } } /* No arguments remaining, abort. */ if (!argv[optind]) { - usage(argv[0]); + usage(argv0); } /* Arguments for notification program. */ argv += optind;