Typo in usage(). Err -> errx when testing allocations.

This commit is contained in:
Philippe Charnier 1997-08-25 06:42:19 +00:00
parent 495aecea76
commit 90389da95b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=28694
4 changed files with 24 additions and 15 deletions

View File

@ -32,7 +32,11 @@
*/
#ifndef lint
#if 0
static char sccsid[] = "@(#)pr_time.c 8.2 (Berkeley) 4/4/94";
#endif
static const char rcsid[] =
"$Id$";
#endif /* not lint */
#include <sys/types.h>
@ -100,14 +104,14 @@ pr_idle(idle)
/* If idle more than an hour, print as HH:MM. */
else if (idle >= 3600)
(void)printf(" %2d:%02d ",
idle / 3600, (idle % 3600) / 60);
(int)idle / 3600, (int)(idle % 3600) / 60);
else if (idle / 60 == 0)
(void)printf(" - ");
/* Else print the minutes idle. */
else
(void)printf(" %2d ", idle / 60);
(void)printf(" %2d ", (int)idle / 60);
return(0); /* not idle longer than 9 days */
}

View File

@ -38,10 +38,10 @@
.Nm uptime
.Nd show how long system has been running
.Sh SYNOPSIS
.Nm uptime
.Nm
.Sh DESCRIPTION
The
.Nm uptime
.Nm
utility displays the current time,
the length of time the system has been up,
the number of users, and the load average of the system over the last

View File

@ -30,14 +30,14 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)w.1 8.1 (Berkeley) 6/6/93
.\" $Id$
.\" $Id: w.1,v 1.6 1997/02/22 19:57:41 peter Exp $
.\"
.Dd June 6, 1993
.Dt W 1
.Os BSD 4
.Sh NAME
.Nm w
.Nd "who present users are and what they are doing"
.Nd who present users are and what they are doing
.Sh SYNOPSIS
.Nm w
.Op Fl hin
@ -46,7 +46,7 @@
.Op Ar user
.Sh DESCRIPTION
The
.Nm w
.Nm
utility prints a summary of the current activity on the system,
including what each user is doing.
The first line displays the current time of day, how long the system has
@ -76,7 +76,7 @@ default
.Dq /kernel .
.It Fl n
Show network addresses as numbers (normally
.Nm w
.Nm
interprets addresses and attempts to display them symbolically).
.El
.Pp
@ -104,7 +104,7 @@ This fails, for example, in critical sections of programs like the shell
and editor, or when faulty programs running in the background fork and fail
to ignore interrupts.
(In cases where no process can be found,
.Nm w
.Nm
prints
.Dq \- . )
.Pp
@ -123,7 +123,7 @@ null or garbaged arguments.
In these cases, the name of the command is printed in parentheses.
.Pp
The
.Nm w
.Nm
utility does not know about the new conventions for detection of background
jobs.
It will sometimes find a background job instead of the right one.

View File

@ -32,13 +32,17 @@
*/
#ifndef lint
static char copyright[] =
static const char copyright[] =
"@(#) Copyright (c) 1980, 1991, 1993, 1994\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)w.c 8.4 (Berkeley) 4/16/94";
#endif
static const char rcsid[] =
"$Id$";
#endif /* not lint */
/*
@ -204,7 +208,7 @@ main(argc, argv)
strncmp(utmp.ut_name, sel_user, UT_NAMESIZE) != 0))
continue;
if ((ep = calloc(1, sizeof(struct entry))) == NULL)
err(1, NULL);
errx(1, "calloc");
*nextp = ep;
nextp = &(ep->next);
memmove(&(ep->utmp), &utmp, sizeof(struct utmp));
@ -306,7 +310,7 @@ main(argc, argv)
}
if ((vis_args = malloc(argwidth * 4 + 1)) == NULL)
err(1, NULL);
errx(1, "malloc");
for (ep = ehead; ep != NULL; ep = ep->next) {
p = *ep->utmp.ut_host ? ep->utmp.ut_host : "-";
if ((x = strchr(p, ':')) != NULL)
@ -451,8 +455,9 @@ usage(wcmd)
{
if (wcmd)
(void)fprintf(stderr,
"usage: w: [-hin] [-M core] [-N system] [user]\n");
"usage: w [-hin] [-M core] [-N system] [user]\n");
else
(void)fprintf(stderr, "uptime\n");
(void)fprintf(stderr,
"usage: uptime\n");
exit (1);
}