summaryrefslogtreecommitdiff
path: root/usr.bin/w
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2015-03-15 00:41:29 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2015-03-15 00:41:29 +0000
commit22eb77a8bd9284ff55e7f91c659398a9a554766a (patch)
treea28c1053918bf9acff5523fc5d5d0b958b776fbb /usr.bin/w
parentb89e57b4b2848230b0a05f0d361e996015aecf61 (diff)
tzfile.h is an internal header that should never have been installed.
What's worse, the tzfile.h that gets installed is over 20 years old and doesn't match the real tzfile.h in libc/time. This makes the tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE define has been moved to time.h temporarily until its usage is replaced by 1900 in the tree. Actual removal of tzfile.h is pending a ports build. Based on a diff from deraadt@
Diffstat (limited to 'usr.bin/w')
-rw-r--r--usr.bin/w/extern.h5
-rw-r--r--usr.bin/w/pr_time.c9
-rw-r--r--usr.bin/w/w.c5
3 files changed, 10 insertions, 9 deletions
diff --git a/usr.bin/w/extern.h b/usr.bin/w/extern.h
index 4c1e6507fbf..4c114bce870 100644
--- a/usr.bin/w/extern.h
+++ b/usr.bin/w/extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: extern.h,v 1.8 2011/04/10 03:20:59 guenther Exp $ */
+/* $OpenBSD: extern.h,v 1.9 2015/03/15 00:41:28 millert Exp $ */
/*-
* Copyright (c) 1993
@@ -37,3 +37,6 @@ void fmt_putc(int, int *);
void pr_attime(time_t *, time_t *);
void pr_idle(time_t);
int proc_compare(const struct kinfo_proc *, const struct kinfo_proc *);
+
+#define SECSPERHOUR (60 * 60)
+#define SECSPERDAY (24 * 60 * 60)
diff --git a/usr.bin/w/pr_time.c b/usr.bin/w/pr_time.c
index 462d9aa8432..d4fbfc2994d 100644
--- a/usr.bin/w/pr_time.c
+++ b/usr.bin/w/pr_time.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pr_time.c,v 1.15 2013/11/11 23:06:51 deraadt Exp $ */
+/* $OpenBSD: pr_time.c,v 1.16 2015/03/15 00:41:28 millert Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -34,7 +34,6 @@
#include <stdio.h>
#include <string.h>
-#include <tzfile.h>
#include "extern.h"
@@ -56,7 +55,7 @@ pr_attime(time_t *started, time_t *now)
diff = *now - *started;
/* If more than a week, use day-month-year. */
- if (diff > SECSPERDAY * DAYSPERWEEK)
+ if (diff > SECSPERDAY * 7)
fmt = "%d%b%y";
/* If not today, use day-hour-am/pm. */
@@ -97,9 +96,9 @@ pr_idle(time_t idle)
else if (idle >= SECSPERHOUR)
(void)printf(" %2lld:%02lld ",
(long long)idle / SECSPERHOUR,
- ((long long)idle % SECSPERHOUR) / SECSPERMIN);
+ ((long long)idle % SECSPERHOUR) / 60);
/* Else print the minutes idle. */
else
- (void)printf(" %2lld ", (long long)idle / SECSPERMIN);
+ (void)printf(" %2lld ", (long long)idle / 60);
}
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c
index 08f6b951528..c15d5457abc 100644
--- a/usr.bin/w/w.c
+++ b/usr.bin/w/w.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: w.c,v 1.57 2015/01/16 06:40:14 deraadt Exp $ */
+/* $OpenBSD: w.c,v 1.58 2015/03/15 00:41:28 millert Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@@ -59,7 +59,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <tzfile.h>
#include <unistd.h>
#include <limits.h>
#include <utmp.h>
@@ -398,7 +397,7 @@ pr_header(time_t *nowp, int nusers)
uptime %= SECSPERDAY;
hrs = uptime / SECSPERHOUR;
uptime %= SECSPERHOUR;
- mins = uptime / SECSPERMIN;
+ mins = uptime / 60;
(void)printf(" up");
if (days > 0)
(void)printf(" %d day%s,", days,