summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2003-11-26 00:31:27 +0000
committermillert <millert@openbsd.org>2003-11-26 00:31:27 +0000
commit742dab51a71aea36bc3340eaa580689289b3e22c (patch)
tree287da82b256590ebd32ceff2bc729b12f582b397
parentmulti-line literals are not ANSI C. And gcc3 complains about them. (diff)
downloadwireguard-openbsd-742dab51a71aea36bc3340eaa580689289b3e22c.tar.xz
wireguard-openbsd-742dab51a71aea36bc3340eaa580689289b3e22c.zip
Minor cleanup. Remove gratuitous use of __CONCAT that was needed
to avoid SCCS braindamage. Also use ANSI function headers while we are here. Based on a diff from espie@
-rw-r--r--usr.bin/w/pr_time.c23
-rw-r--r--usr.bin/w/proc_compare.c7
-rw-r--r--usr.bin/w/w.c10
3 files changed, 15 insertions, 25 deletions
diff --git a/usr.bin/w/pr_time.c b/usr.bin/w/pr_time.c
index 0f8cbf8d1e7..7480638d1e2 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.11 2003/06/03 02:56:22 millert Exp $ */
+/* $OpenBSD: pr_time.c,v 1.12 2003/11/26 00:31:27 millert Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -33,7 +33,7 @@
#if 0
static char sccsid[] = "@(#)pr_time.c 8.2 (Berkeley) 4/4/94";
#else
-static char *rcsid = "$OpenBSD: pr_time.c,v 1.11 2003/06/03 02:56:22 millert Exp $";
+static char *rcsid = "$OpenBSD: pr_time.c,v 1.12 2003/11/26 00:31:27 millert Exp $";
#endif
#endif /* not lint */
@@ -49,18 +49,14 @@ static char *rcsid = "$OpenBSD: pr_time.c,v 1.11 2003/06/03 02:56:22 millert Exp
/*
* pr_attime --
* Print the time since the user logged in.
- *
- * Note: SCCS forces the bizarre string manipulation, things like
- * 8.2 get replaced in the source code.
*/
void
-pr_attime(started, now)
- time_t *started, *now;
+pr_attime(time_t *started, time_t *now)
{
static char buf[256];
struct tm *tp;
time_t diff;
- char fmt[20];
+ const char *fmt;
int today;
today = localtime(now)->tm_yday;
@@ -69,19 +65,19 @@ pr_attime(started, now)
/* If more than a week, use day-month-year. */
if (diff > SECSPERDAY * DAYSPERWEEK)
- (void)strlcpy(fmt, "%d%b%y", sizeof fmt);
+ fmt = "%d%b%y";
/* If not today, use day-hour-am/pm. */
else if (tp->tm_yday != today ) {
- (void)strlcpy(fmt, __CONCAT("%a%", "I%p"), sizeof fmt);
+ fmt = "%a%I%p";
}
/* Default is hh:mm{am,pm}. */
else {
- (void)strlcpy(fmt, __CONCAT("%l:%", "M%p"), sizeof fmt);
+ fmt = "%l:%M%p";
}
- (void)strftime(buf, sizeof(buf) -1, fmt, tp);
+ (void)strftime(buf, sizeof buf -1, fmt, tp);
buf[sizeof buf - 1] = '\0';
(void)printf("%s", buf);
}
@@ -91,8 +87,7 @@ pr_attime(started, now)
* Display the idle time.
*/
void
-pr_idle(idle)
- time_t idle;
+pr_idle(time_t idle)
{
int days = idle / SECSPERDAY;
diff --git a/usr.bin/w/proc_compare.c b/usr.bin/w/proc_compare.c
index 06c4d9ed813..caf7b0f2dbf 100644
--- a/usr.bin/w/proc_compare.c
+++ b/usr.bin/w/proc_compare.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc_compare.c,v 1.6 2003/06/03 02:56:22 millert Exp $ */
+/* $OpenBSD: proc_compare.c,v 1.7 2003/11/26 00:31:27 millert Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -33,7 +33,7 @@
#if 0
static char sccsid[] = "@(#)proc_compare.c 8.2 (Berkeley) 9/23/93";
#else
-static char *rcsid = "$OpenBSD: proc_compare.c,v 1.6 2003/06/03 02:56:22 millert Exp $";
+static char *rcsid = "$OpenBSD: proc_compare.c,v 1.7 2003/11/26 00:31:27 millert Exp $";
#endif
#endif /* not lint */
@@ -69,8 +69,7 @@ static char *rcsid = "$OpenBSD: proc_compare.c,v 1.6 2003/06/03 02:56:22 millert
#define BOTH 3
int
-proc_compare(p1, p2)
- struct proc *p1, *p2;
+proc_compare(struct proc *p1, struct proc *p2)
{
if (p1 == NULL)
return (1);
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c
index 1e2d7f748b3..26159d09d47 100644
--- a/usr.bin/w/w.c
+++ b/usr.bin/w/w.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: w.c,v 1.39 2003/06/03 02:56:22 millert Exp $ */
+/* $OpenBSD: w.c,v 1.40 2003/11/26 00:31:27 millert Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@@ -39,7 +39,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)w.c 8.4 (Berkeley) 4/16/94";
#else
-static char *rcsid = "$OpenBSD: w.c,v 1.39 2003/06/03 02:56:22 millert Exp $";
+static char *rcsid = "$OpenBSD: w.c,v 1.40 2003/11/26 00:31:27 millert Exp $";
#endif
#endif /* not lint */
@@ -392,12 +392,8 @@ pr_header(time_t *nowp, int nusers)
/*
* Print time of day.
- *
- * SCCS forces the string manipulation below, as it replaces
- * %, M, and % in a character string with the file name.
*/
- (void)strftime(buf, sizeof(buf) - 1,
- __CONCAT("%l:%","M%p"), localtime(nowp));
+ (void)strftime(buf, sizeof(buf) - 1, "%l:%M%p", localtime(nowp));
buf[sizeof(buf) - 1] = '\0';
(void)printf("%s ", buf);