CVS commit: src/usr.bin/who
Module Name:src Committed By: christos Date: Fri Feb 26 02:45:43 UTC 2021 Modified Files: src/usr.bin/who: utmpentry.c Log Message: PR/56013: Kouichi Hashikawa: Move setutent/setutxent right before the loops. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/usr.bin/who/utmpentry.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/who/utmpentry.c diff -u src/usr.bin/who/utmpentry.c:1.21 src/usr.bin/who/utmpentry.c:1.22 --- src/usr.bin/who/utmpentry.c:1.21 Sat Oct 5 19:35:57 2019 +++ src/usr.bin/who/utmpentry.c Thu Feb 25 21:45:43 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: utmpentry.c,v 1.21 2019/10/05 23:35:57 mrg Exp $ */ +/* $NetBSD: utmpentry.c,v 1.22 2021/02/26 02:45:43 christos Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: utmpentry.c,v 1.21 2019/10/05 23:35:57 mrg Exp $"); +__RCSID("$NetBSD: utmpentry.c,v 1.22 2021/02/26 02:45:43 christos Exp $"); #endif #include @@ -95,14 +95,7 @@ setup(const char *fname) struct stat st; const char *sfname; - if (fname == NULL) { -#ifdef SUPPORT_UTMPX - setutxent(); -#endif -#ifdef SUPPORT_UTMP - setutent(); -#endif - } else { + if (fname != NULL) { size_t len = strlen(fname); if (len == 0) errx(1, "Filename cannot be 0 length."); @@ -133,9 +126,9 @@ setup(const char *fname) what &= ~1; } else { if (timespeccmp(_mtimespec, , >)) - utmpxtime = st.st_mtimespec; +utmpxtime = st.st_mtimespec; else - what &= ~1; +what &= ~1; } } #endif @@ -204,10 +197,11 @@ getutentries(const char *fname, struct u #endif #ifdef SUPPORT_UTMPX + setutxent(); while ((what & 1) && (utx = getutxent()) != NULL) { if (fname == NULL && ((1 << utx->ut_type) & etype) == 0) continue; - if ((ep = calloc(1, sizeof(struct utmpentry))) == NULL) { + if ((ep = calloc(1, sizeof(*ep))) == NULL) { warn(NULL); return 0; } @@ -218,6 +212,7 @@ getutentries(const char *fname, struct u #endif #ifdef SUPPORT_UTMP + setutent(); if ((etype & (1 << USER_PROCESS)) != 0) { while ((what & 2) && (ut = getutent()) != NULL) { if (fname == NULL && (*ut->ut_name == '\0' ||
CVS commit: src/usr.bin/who
Module Name:src Committed By: wiz Date: Tue Feb 23 07:15:41 UTC 2021 Modified Files: src/usr.bin/who: who.1 Log Message: Fix Fl argument. >From Kouichi Hashikawa in PR 56009. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/usr.bin/who/who.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/who/who.1 diff -u src/usr.bin/who/who.1:1.25 src/usr.bin/who/who.1:1.26 --- src/usr.bin/who/who.1:1.25 Sun Sep 1 18:46:22 2019 +++ src/usr.bin/who/who.1 Tue Feb 23 07:15:41 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: who.1,v 1.25 2019/09/01 18:46:22 sevan Exp $ +.\" $NetBSD: who.1,v 1.26 2021/02/23 07:15:41 wiz Exp $ .\" .\" Copyright (c) 1986, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -52,7 +52,7 @@ Available options: .Bl -tag -width file .It Fl a Same as -.Fl -bdlprTtuv . +.Fl bdlprTtuv . .It Fl b Time of last system boot. .It Fl d
CVS commit: src/usr.bin/who
Module Name:src Committed By: sevan Date: Fri May 11 16:36:57 UTC 2018 Modified Files: src/usr.bin/who: who.1 Log Message: Match sequence of flags with usage() Following on from mandoc -Tlint, drop Pp macro before Bl and Tn macro. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/usr.bin/who/who.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/who/who.1 diff -u src/usr.bin/who/who.1:1.23 src/usr.bin/who/who.1:1.24 --- src/usr.bin/who/who.1:1.23 Fri Dec 26 01:43:58 2014 +++ src/usr.bin/who/who.1 Fri May 11 16:36:57 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: who.1,v 1.23 2014/12/26 01:43:58 christos Exp $ +.\" $NetBSD: who.1,v 1.24 2018/05/11 16:36:57 sevan Exp $ .\" .\" Copyright (c) 1986, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)who.1 8.2 (Berkeley) 12/30/93 .\" -.Dd December 25, 2014 +.Dd May 11, 2018 .Dt WHO 1 .Os .Sh NAME @@ -37,7 +37,7 @@ .Nd display who is logged in .Sh SYNOPSIS .Nm -.Op Fl abdHlmqrstTuv +.Op Fl abdHlmqrsTtuv .Op Ar file .Nm .Ar am i @@ -49,7 +49,6 @@ each user the login name, tty name, the hostname if not local. .Pp Available options: -.Pp .Bl -tag -width file .It Fl a Same as @@ -64,9 +63,7 @@ Write column headings above the regular Print system login processes. .It Fl m Only print information about the current terminal. -This is the -.Tn POSIX -way of saying +This is the POSIX way of saying .Nm .Ar am i . .It Fl p
CVS commit: src/usr.bin/who
Module Name:src Committed By: christos Date: Sat Nov 21 15:01:43 UTC 2015 Modified Files: src/usr.bin/who: Makefile utmpentry.c utmpentry.h who.c Log Message: WARNS=6 To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/usr.bin/who/Makefile cvs rdiff -u -r1.17 -r1.18 src/usr.bin/who/utmpentry.c cvs rdiff -u -r1.7 -r1.8 src/usr.bin/who/utmpentry.h cvs rdiff -u -r1.24 -r1.25 src/usr.bin/who/who.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/who/Makefile diff -u src/usr.bin/who/Makefile:1.9 src/usr.bin/who/Makefile:1.10 --- src/usr.bin/who/Makefile:1.9 Tue Apr 14 18:15:29 2009 +++ src/usr.bin/who/Makefile Sat Nov 21 10:01:43 2015 @@ -1,6 +1,7 @@ -# $NetBSD: Makefile,v 1.9 2009/04/14 22:15:29 lukem Exp $ +# $NetBSD: Makefile,v 1.10 2015/11/21 15:01:43 christos Exp $ # @(#)Makefile 8.1 (Berkeley) 6/6/93 +WARNS= 6 PROG= who SRCS= who.c utmpentry.c CPPFLAGS+= -DSUPPORT_UTMPX -DSUPPORT_UTMP Index: src/usr.bin/who/utmpentry.c diff -u src/usr.bin/who/utmpentry.c:1.17 src/usr.bin/who/utmpentry.c:1.18 --- src/usr.bin/who/utmpentry.c:1.17 Fri May 1 10:26:10 2009 +++ src/usr.bin/who/utmpentry.c Sat Nov 21 10:01:43 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: utmpentry.c,v 1.17 2009/05/01 14:26:10 christos Exp $ */ +/* $NetBSD: utmpentry.c,v 1.18 2015/11/21 15:01:43 christos Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: utmpentry.c,v 1.17 2009/05/01 14:26:10 christos Exp $"); +__RCSID("$NetBSD: utmpentry.c,v 1.18 2015/11/21 15:01:43 christos Exp $"); #endif #include @@ -69,16 +69,16 @@ static int setup(const char *); static void adjust_size(struct utmpentry *e); #endif -int maxname = 8, maxline = 8, maxhost = 16; +size_t maxname = 8, maxline = 8, maxhost = 16; int etype = 1 << USER_PROCESS; -static int numutmp = 0; +static size_t numutmp = 0; static struct utmpentry *ehead; #if defined(SUPPORT_UTMPX) || defined(SUPPORT_UTMP) static void adjust_size(struct utmpentry *e) { - int max; + size_t max; if ((max = strlen(e->name)) > maxname) maxname = max; @@ -178,7 +178,7 @@ endutentries(void) numutmp = 0; } -int +size_t getutentries(const char *fname, struct utmpentry **epp) { #ifdef SUPPORT_UTMPX Index: src/usr.bin/who/utmpentry.h diff -u src/usr.bin/who/utmpentry.h:1.7 src/usr.bin/who/utmpentry.h:1.8 --- src/usr.bin/who/utmpentry.h:1.7 Sun Jul 13 16:07:49 2008 +++ src/usr.bin/who/utmpentry.h Sat Nov 21 10:01:43 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: utmpentry.h,v 1.7 2008/07/13 20:07:49 dholland Exp $ */ +/* $NetBSD: utmpentry.h,v 1.8 2015/11/21 15:01:43 christos Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ struct utmpentry { struct utmpentry *next; }; -extern int maxname, maxline, maxhost; +extern size_t maxname, maxline, maxhost; extern int etype; /* @@ -72,5 +72,5 @@ extern int etype; * endutentries clears and frees the cached data. */ -int getutentries(const char *, struct utmpentry **); +size_t getutentries(const char *, struct utmpentry **); void endutentries(void); Index: src/usr.bin/who/who.c diff -u src/usr.bin/who/who.c:1.24 src/usr.bin/who/who.c:1.25 --- src/usr.bin/who/who.c:1.24 Sun Jun 8 05:53:43 2014 +++ src/usr.bin/who/who.c Sat Nov 21 10:01:43 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: who.c,v 1.24 2014/06/08 09:53:43 mlelstv Exp $ */ +/* $NetBSD: who.c,v 1.25 2015/11/21 15:01:43 christos Exp $ */ /* * Copyright (c) 1989, 1993 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19 #if 0 static char sccsid[] = "@(#)who.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: who.c,v 1.24 2014/06/08 09:53:43 mlelstv Exp $"); +__RCSID("$NetBSD: who.c,v 1.25 2015/11/21 15:01:43 christos Exp $"); #endif /* not lint */ #include @@ -307,12 +307,12 @@ print(const char *name, const char *line } - (void)printf("%-*.*s ", maxname, maxname, name); + (void)printf("%-*.*s ", (int)maxname, (int)maxname, name); if (show_term) (void)printf("%c ", state); - (void)printf("%-*.*s ", maxline, maxline, line); + (void)printf("%-*.*s ", (int)maxline, (int)maxline, line); tstr = ctime(); (void)printf("%.12s ", tstr ? tstr + 4 : "?"); @@ -339,19 +339,19 @@ print(const char *name, const char *line } if (*host) - (void)printf("\t(%.*s)", maxhost, host); + (void)printf("\t(%.*s)", (int)maxhost, host); (void)putchar('\n'); } static void output_labels(void) { - (void)printf("%-*.*s ", maxname, maxname, "USER"); + (void)printf("%-*.*s ", (int)maxname, (int)maxname, "USER"); if (show_term) (void)printf("S "); - (void)printf("%-*.*s ", maxline, maxline, "LINE"); + (void)printf("%-*.*s ", (int)maxline, (int)maxline, "LINE"); (void)printf("WHEN "); if (show_idle) { @@ -372,7 +372,7 @@ quick(const char *fname) (void)getutentries(fname, ); for (ep = ehead; ep !=
CVS commit: src/usr.bin/who
Module Name:src Committed By: christos Date: Fri Dec 26 01:43:58 UTC 2014 Modified Files: src/usr.bin/who: who.1 Log Message: Correct provenance of who(1) (from Marcin F. Michalski) To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/usr.bin/who/who.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/who/who.1 diff -u src/usr.bin/who/who.1:1.22 src/usr.bin/who/who.1:1.23 --- src/usr.bin/who/who.1:1.22 Wed Jan 17 19:15:05 2007 +++ src/usr.bin/who/who.1 Thu Dec 25 20:43:58 2014 @@ -1,4 +1,4 @@ -.\ $NetBSD: who.1,v 1.22 2007/01/18 00:15:05 wiz Exp $ +.\ $NetBSD: who.1,v 1.23 2014/12/26 01:43:58 christos Exp $ .\ .\ Copyright (c) 1986, 1991, 1993 .\ The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\ .\ @(#)who.1 8.2 (Berkeley) 12/30/93 .\ -.Dd January 17, 2007 +.Dd December 25, 2014 .Dt WHO 1 .Os .Sh NAME @@ -196,4 +196,5 @@ utility is expected to conform to A .Nm utility appeared in -.At v6 . +.At v1 : +.Lk http://cm.bell-labs.com/cm/cs/who/dmr/pdfs/man14.pdf
CVS commit: src/usr.bin/who
Module Name:src Committed By: mlelstv Date: Sun Jun 8 09:53:43 UTC 2014 Modified Files: src/usr.bin/who: who.c Log Message: Handle ctime() failure. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/usr.bin/who/who.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/who/who.c diff -u src/usr.bin/who/who.c:1.23 src/usr.bin/who/who.c:1.24 --- src/usr.bin/who/who.c:1.23 Thu Jul 24 15:35:41 2008 +++ src/usr.bin/who/who.c Sun Jun 8 09:53:43 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: who.c,v 1.23 2008/07/24 15:35:41 christos Exp $ */ +/* $NetBSD: who.c,v 1.24 2014/06/08 09:53:43 mlelstv Exp $ */ /* * Copyright (c) 1989, 1993 @@ -42,7 +42,7 @@ __COPYRIGHT(@(#) Copyright (c) 1989, 19 #if 0 static char sccsid[] = @(#)who.c 8.1 (Berkeley) 6/6/93; #endif -__RCSID($NetBSD: who.c,v 1.23 2008/07/24 15:35:41 christos Exp $); +__RCSID($NetBSD: who.c,v 1.24 2014/06/08 09:53:43 mlelstv Exp $); #endif /* not lint */ #include sys/types.h @@ -285,6 +285,7 @@ print(const char *name, const char *line time_t idle; const char *types = NULL; size_t i; + char *tstr; state = '?'; idle = 0; @@ -312,7 +313,8 @@ print(const char *name, const char *line (void)printf(%c , state); (void)printf(%-*.*s , maxline, maxline, line); - (void)printf(%.12s , ctime(t) + 4); + tstr = ctime(t); + (void)printf(%.12s , tstr ? tstr + 4 : ?); if (show_idle) { if (idle 60)
CVS commit: src/usr.bin/who
Module Name:src Committed By: christos Date: Fri May 1 14:26:10 UTC 2009 Modified Files: src/usr.bin/who: utmpentry.c Log Message: PR/41313: Chris Spiegel: getutentries() in src/usr.bin/who/utmpentry.c thinks there are no entries if only one of utmp/utmpx support is selected mangled - || To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/usr.bin/who/utmpentry.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/who/utmpentry.c diff -u src/usr.bin/who/utmpentry.c:1.16 src/usr.bin/who/utmpentry.c:1.17 --- src/usr.bin/who/utmpentry.c:1.16 Tue Oct 28 10:01:46 2008 +++ src/usr.bin/who/utmpentry.c Fri May 1 10:26:10 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: utmpentry.c,v 1.16 2008/10/28 14:01:46 christos Exp $ */ +/* $NetBSD: utmpentry.c,v 1.17 2009/05/01 14:26:10 christos Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: utmpentry.c,v 1.16 2008/10/28 14:01:46 christos Exp $); +__RCSID($NetBSD: utmpentry.c,v 1.17 2009/05/01 14:26:10 christos Exp $); #endif #include sys/stat.h @@ -242,7 +242,7 @@ } #endif numutmp = 0; -#if defined(SUPPORT_UTMP) defined(SUPPORT_UTMPX) +#if defined(SUPPORT_UTMP) || defined(SUPPORT_UTMPX) if (ehead != NULL) { struct utmpentry *from = ehead, *save;