1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-26 16:18:31 +00:00

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

View File

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

View File

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

View File

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