summaryrefslogtreecommitdiffstats
path: root/usr.bin/finger/lprint.c
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2000-10-23 12:18:34 +0000
committerru <ru@FreeBSD.org>2000-10-23 12:18:34 +0000
commit7885ad000050949f99433ec9baa0babf83709052 (patch)
tree92873b0fb1e6a6053e23c2b62d1613084b6e8d00 /usr.bin/finger/lprint.c
parent7b50f6cc73be199a04244c314383955c70c6ae82 (diff)
downloadFreeBSD-src-7885ad000050949f99433ec9baa0babf83709052.zip
FreeBSD-src-7885ad000050949f99433ec9baa0babf83709052.tar.gz
-Wall cleanup.
PR: 22187
Diffstat (limited to 'usr.bin/finger/lprint.c')
-rw-r--r--usr.bin/finger/lprint.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/usr.bin/finger/lprint.c b/usr.bin/finger/lprint.c
index 688f16e..11da686 100644
--- a/usr.bin/finger/lprint.c
+++ b/usr.bin/finger/lprint.c
@@ -174,8 +174,7 @@ lprint(pn)
maxlen = len;
/* find rest of entries for user */
for (w = pn->whead; w != NULL; w = w->next) {
- switch (w->info) {
- case LOGGEDIN:
+ if (w->info == LOGGEDIN) {
tp = localtime(&w->loginat);
strftime(t, sizeof(t), "%c", tp);
tzn = tp->tm_zone;
@@ -204,12 +203,9 @@ lprint(pn)
}
if (!w->writable)
cpr += printf(" (messages off)");
- break;
- case LASTLOG:
- if (w->loginat == 0) {
- (void)printf("Never logged in.");
- break;
- }
+ } else if (w->loginat == 0) {
+ cpr = printf("Never logged in.");
+ } else {
tp = localtime(&w->loginat);
strftime(t, sizeof(t), "%c", tp);
tzn = tp->tm_zone;
@@ -220,7 +216,6 @@ lprint(pn)
else
cpr = printf("Last login %.16s (%s) on %s",
t, tzn, w->tty);
- break;
}
if (*w->host) {
if (LINE_LEN < (cpr + 6 + strlen(w->host)))
@@ -298,6 +293,8 @@ show_text(directory, file_name, header)
register char *p, lastc;
int fd, nr;
+ lastc = '\0';
+
(void)snprintf(tbuf, sizeof(tbuf), "%s/%s", directory, file_name);
if ((fd = open(tbuf, O_RDONLY)) < 0 || fstat(fd, &sb) ||
sb.st_size == 0)
@@ -353,7 +350,7 @@ vputc(ch)
meta = 1;
} else
meta = 0;
- if (isprint(ch) || !meta && (ch == ' ' || ch == '\t' || ch == '\n'))
+ if (isprint(ch) || (!meta && (ch == ' ' || ch == '\t' || ch == '\n')))
(void)putchar(ch);
else {
(void)putchar('^');
OpenPOWER on IntegriCloud