- Knf auto variables in modified line by me.
- Print "??" as tty name instead of print nothing. Suggested by jhawk.
This commit is contained in:
parent
c2972543ed
commit
20117cd175
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rwall.c,v 1.12 2000/09/04 15:21:24 taca Exp $ */
|
||||
/* $NetBSD: rwall.c,v 1.13 2000/10/02 03:28:42 taca Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993 Christopher G. Demetriou
|
||||
|
@ -44,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988 Regents of the University of California.\n\
|
|||
#if 0
|
||||
static char sccsid[] = "from: @(#)wall.c 5.14 (Berkeley) 3/2/91";
|
||||
#else
|
||||
__RCSID("$NetBSD: rwall.c,v 1.12 2000/09/04 15:21:24 taca Exp $");
|
||||
__RCSID("$NetBSD: rwall.c,v 1.13 2000/10/02 03:28:42 taca Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -129,7 +129,7 @@ makemsg(fname)
|
|||
FILE *fp;
|
||||
int fd;
|
||||
const char *whom;
|
||||
char *tty, hostname[MAXHOSTNAMELEN + 1], lbuf[100], tmpname[32];
|
||||
char *tty, tmpname[32], lbuf[100], hostname[MAXHOSTNAMELEN + 1];
|
||||
|
||||
(void)strcpy(tmpname, _PATH_TMP);
|
||||
(void)strcat(tmpname, "/wall.XXXXXX");
|
||||
|
@ -155,11 +155,9 @@ makemsg(fname)
|
|||
whom, hostname);
|
||||
tty = ttyname(STDERR_FILENO);
|
||||
if (tty == NULL)
|
||||
(void)fprintf(fp, " at %d:%02d ...\n",
|
||||
lt->tm_hour, lt->tm_min);
|
||||
else
|
||||
(void)fprintf(fp, " (%s) at %d:%02d ...\n", tty,
|
||||
lt->tm_hour, lt->tm_min);
|
||||
tty = "??";
|
||||
(void)fprintf(fp, " (%s) at %d:%02d ...\n", tty, lt->tm_hour,
|
||||
lt->tm_min);
|
||||
|
||||
putc('\n', fp);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wall.c,v 1.15 2000/09/06 10:17:01 mjl Exp $ */
|
||||
/* $NetBSD: wall.c,v 1.16 2000/10/02 03:29:06 taca Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1990, 1993
|
||||
|
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1990, 1993\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)wall.c 8.2 (Berkeley) 11/16/93";
|
||||
#endif
|
||||
__RCSID("$NetBSD: wall.c,v 1.15 2000/09/06 10:17:01 mjl Exp $");
|
||||
__RCSID("$NetBSD: wall.c,v 1.16 2000/10/02 03:29:06 taca Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
|
@ -138,7 +138,7 @@ makemsg(fname)
|
|||
FILE *fp;
|
||||
int fd;
|
||||
const char *whom;
|
||||
char *p, *tty, hostname[MAXHOSTNAMELEN+1], lbuf[100], tmpname[32];
|
||||
char *p, *tty, tmpname[32], lbuf[100], hostname[MAXHOSTNAMELEN+1];
|
||||
|
||||
(void)snprintf(tmpname, sizeof tmpname, "%s/wall.XXXXXX", _PATH_TMP);
|
||||
if ((fd = mkstemp(tmpname)) == -1 || !(fp = fdopen(fd, "r+")))
|
||||
|
@ -166,13 +166,10 @@ makemsg(fname)
|
|||
(void)fprintf(fp, "%-79.79s\007\007\r\n", lbuf);
|
||||
tty = ttyname(STDERR_FILENO);
|
||||
if (tty == NULL)
|
||||
(void)snprintf(lbuf, sizeof lbuf,
|
||||
" at %d:%02d ...",
|
||||
lt->tm_hour, lt->tm_min);
|
||||
else
|
||||
(void)snprintf(lbuf, sizeof lbuf,
|
||||
" (%s) at %d:%02d ...",
|
||||
tty, lt->tm_hour, lt->tm_min);
|
||||
tty = "??";
|
||||
(void)snprintf(lbuf, sizeof lbuf,
|
||||
" (%s) at %d:%02d ...", tty, lt->tm_hour,
|
||||
lt->tm_min);
|
||||
(void)fprintf(fp, "%-79.79s\r\n", lbuf);
|
||||
}
|
||||
(void)fprintf(fp, "%79s\r\n", " ");
|
||||
|
|
Loading…
Reference in New Issue