]> err.no Git - util-linux/commitdiff
wall: remove progname
authorKarel Zak <kzak@redhat.com>
Fri, 10 Dec 2010 15:20:00 +0000 (16:20 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 10 Dec 2010 15:20:00 +0000 (16:20 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/wall.c

index 47f0546a10d1e0dc92df949dee655ef67804113a..383873b58bf4280da1f42f0561fd01ffe2d577b1 100644 (file)
@@ -48,6 +48,7 @@
 #include <sys/uio.h>
 
 #include <err.h>
+#include <errno.h>
 #include <paths.h>
 #include <ctype.h>
 #include <pwd.h>
@@ -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);