wall: fix coding style
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
aa00c136a5
commit
00f41c7dfd
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue