From aa00c136a5aaf413c66561b9b6dc1690a7bcebc6 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 10 Dec 2010 16:20:00 +0100 Subject: [PATCH] wall: remove progname Signed-off-by: Karel Zak --- login-utils/wall.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/login-utils/wall.c b/login-utils/wall.c index 47f0546a..383873b5 100644 --- a/login-utils/wall.c +++ b/login-utils/wall.c @@ -48,6 +48,7 @@ #include #include +#include #include #include #include @@ -81,8 +82,6 @@ int nobanner; int mbufsize; char *mbuf; -char *progname = "wall"; - int main(int argc, char **argv) { extern int optind; @@ -96,11 +95,6 @@ main(int argc, char **argv) { bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); - progname = argv[0]; - p = strrchr(progname, '/'); - if (p) - progname = p+1; - while ((ch = getopt(argc, argv, "n")) != -1) switch (ch) { case 'n': @@ -111,7 +105,8 @@ main(int argc, char **argv) { case '?': default: usage: - (void)fprintf(stderr, _("usage: %s [file]\n"), progname); + fprintf(stderr, _("usage: %s [file]\n"), + program_invocation_short_name); exit(EXIT_FAILURE); } argc -= optind; @@ -143,7 +138,7 @@ usage: xstrncpy(line, utmpptr->ut_line, sizeof(utmpptr->ut_line)); if ((p = ttymsg(&iov, 1, line, 60*5)) != NULL) - (void)fprintf(stderr, "%s: %s\n", progname, p); + warnx("%s", p); } endutent(); exit(EXIT_SUCCESS); -- 2.39.5