From 00f41c7dfd561a34ac9afee10a273dd8c65d4d56 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 10 Dec 2010 16:22:29 +0100 Subject: [PATCH] wall: fix coding style Signed-off-by: Karel Zak --- login-utils/wall.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/login-utils/wall.c b/login-utils/wall.c index 383873b5..2ecce126 100644 --- a/login-utils/wall.c +++ b/login-utils/wall.c @@ -95,7 +95,7 @@ main(int argc, char **argv) { bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); - while ((ch = getopt(argc, argv, "n")) != -1) + while ((ch = getopt(argc, argv, "n")) != -1) { switch (ch) { case 'n': /* undoc option for shutdown: suppress banner */ @@ -109,6 +109,7 @@ usage: program_invocation_short_name); exit(EXIT_FAILURE); } + } argc -= optind; argv += optind; if (argc > 1) @@ -159,11 +160,11 @@ makemsg(fname) lbuf[MAXHOSTNAMELEN + 320], tmpname[sizeof(_PATH_TMP) + 20]; - (void)sprintf(tmpname, "%s/wall.XXXXXX", _PATH_TMP); + sprintf(tmpname, "%s/wall.XXXXXX", _PATH_TMP); if (!(fd = mkstemp(tmpname)) || !(fp = fdopen(fd, "r+"))) errx(EXIT_FAILURE, _("can't open temporary file")); - (void)unlink(tmpname); + unlink(tmpname); if (!nobanner) { if (!(whom = getlogin()) || !*whom) @@ -173,8 +174,8 @@ makemsg(fname) where = ttyname(2); if (!where || strlen(where) > 100) where = "somewhere"; - (void)gethostname(hostname, sizeof(hostname)); - (void)time(&now); + gethostname(hostname, sizeof(hostname)); + time(&now); lt = localtime(&now); /* @@ -186,15 +187,15 @@ makemsg(fname) */ /* snprintf is not always available, but the sprintf's here will not overflow as long as %d takes at most 100 chars */ - (void)fprintf(fp, "\r%79s\r\n", " "); - (void)sprintf(lbuf, _("Broadcast Message from %s@%s"), + fprintf(fp, "\r%79s\r\n", " "); + sprintf(lbuf, _("Broadcast Message from %s@%s"), whom, hostname); - (void)fprintf(fp, "%-79.79s\007\007\r\n", lbuf); - (void)sprintf(lbuf, " (%s) at %d:%02d ...", + fprintf(fp, "%-79.79s\007\007\r\n", lbuf); + sprintf(lbuf, " (%s) at %d:%02d ...", where, lt->tm_hour, lt->tm_min); - (void)fprintf(fp, "%-79.79s\r\n", lbuf); + fprintf(fp, "%-79.79s\r\n", lbuf); } - (void)fprintf(fp, "%79s\r\n", " "); + fprintf(fp, "%79s\r\n", " "); if (fname) { /* @@ -237,5 +238,5 @@ makemsg(fname) if (fread(mbuf, sizeof(*mbuf), mbufsize, fp) != mbufsize) err(EXIT_FAILURE, _("fread failed")); - (void)close(fd); + close(fd); } -- 2.39.5