summaryrefslogtreecommitdiffstats
path: root/login-utils/wall.c
diff options
context:
space:
mode:
authorKarel Zak2010-12-10 16:20:00 +0100
committerKarel Zak2010-12-10 16:20:00 +0100
commitaa00c136a5aaf413c66561b9b6dc1690a7bcebc6 (patch)
treed002ec3349dee4c548aa77b3e54f22b5e94ccce0 /login-utils/wall.c
parentwall: Use EXIT_* and err() (diff)
downloadkernel-qcow2-util-linux-aa00c136a5aaf413c66561b9b6dc1690a7bcebc6.tar.gz
kernel-qcow2-util-linux-aa00c136a5aaf413c66561b9b6dc1690a7bcebc6.tar.xz
kernel-qcow2-util-linux-aa00c136a5aaf413c66561b9b6dc1690a7bcebc6.zip
wall: remove progname
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils/wall.c')
-rw-r--r--login-utils/wall.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/login-utils/wall.c b/login-utils/wall.c
index 47f0546a1..383873b58 100644
--- a/login-utils/wall.c
+++ b/login-utils/wall.c
@@ -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);