Date: Mon, 25 Jun 2001 00:52:11 -0400 (EDT) From: Mike Barcroft <mike@q9media.com> To: audit@FreeBSD.org Subject: src/usr.bin/lastcomm patch Message-ID: <200106250452.f5P4qB091629@coffee.q9media.com>
next in thread | raw e-mail | index | archive | help
I would appreciate it if someone would review and commit the patch at the end of this message. Also available at: http://testbed.q9media.net/freebsd/lastcomm.20010623.patch Best regards, Mike Barcroft ----------------------------------------------------------------------- lastcomm.20010623.patch o s/time/flags/g; to avoid shadowing a global declaration. o Make some variables const to silence compiler warnings. o Set WARNS?=2 Index: lastcomm/Makefile =================================================================== RCS file: /home/ncvs/src/usr.bin/lastcomm/Makefile,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 Makefile --- lastcomm/Makefile 1994/05/27 12:31:57 1.1.1.1 +++ lastcomm/Makefile 2001/06/24 03:17:42 @@ -1,5 +1,6 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 PROG= lastcomm +WARNS?= 2 .include <bsd.prog.mk> Index: lastcomm/lastcomm.c =================================================================== RCS file: /home/ncvs/src/usr.bin/lastcomm/lastcomm.c,v retrieving revision 1.12 diff -u -r1.12 lastcomm.c --- lastcomm/lastcomm.c 2001/06/16 07:08:37 1.12 +++ lastcomm/lastcomm.c 2001/06/24 03:17:42 @@ -32,7 +32,7 @@ */ #ifndef lint -static char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1980, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ @@ -61,10 +61,9 @@ time_t expand __P((u_int)); char *flagbits __P((int)); -char *getdev __P((dev_t)); +const char *getdev __P((dev_t)); int requested __P((char *[], struct acct *)); static void usage __P((void)); -char *user_from_uid(); #define AC_UTIME 1 /* user */ #define AC_STIME 2 /* system */ @@ -88,8 +87,8 @@ off_t size; time_t t; int ch; - char *acctfile; - int time = 0; + const char *acctfile; + int flags = 0; acctfile = _PATH_ACCT; while ((ch = getopt(argc, argv, "f:usecSE")) != -1) @@ -99,24 +98,24 @@ break; case 'u': - time |= AC_UTIME; /* user time */ + flags |= AC_UTIME; /* user time */ break; case 's': - time |= AC_STIME; /* system time */ + flags |= AC_STIME; /* system time */ break; case 'e': - time |= AC_ETIME; /* elapsed time */ + flags |= AC_ETIME; /* elapsed time */ break; case 'c': - time |= AC_CTIME; /* user + system time */ + flags |= AC_CTIME; /* user + system time */ break; case 'S': - time |= AC_BTIME; /* starting time */ + flags |= AC_BTIME; /* starting time */ break; case 'E': /* exit time (starting time + elapsed time )*/ - time |= AC_FTIME; + flags |= AC_FTIME; break; case '?': @@ -125,8 +124,8 @@ } /* default user + system time and starting time */ - if (!time) { - time = AC_CTIME | AC_BTIME; + if (!flags) { + flags = AC_CTIME | AC_BTIME; } argc -= optind; @@ -184,34 +183,34 @@ /* user + system time */ - if (time & AC_CTIME) { + if (flags & AC_CTIME) { (void)printf(" %6.2f secs", (expand(ab.ac_utime) + expand(ab.ac_stime))/AC_HZ); } /* usr time */ - if (time & AC_UTIME) { + if (flags & AC_UTIME) { (void)printf(" %6.2f us", expand(ab.ac_utime)/AC_HZ); } /* system time */ - if (time & AC_STIME) { + if (flags & AC_STIME) { (void)printf(" %6.2f sy", expand(ab.ac_stime)/AC_HZ); } /* elapsed time */ - if (time & AC_ETIME) { + if (flags & AC_ETIME) { (void)printf(" %8.2f es", expand(ab.ac_etime)/AC_HZ); } /* starting time */ - if (time & AC_BTIME) { + if (flags & AC_BTIME) { (void)printf(" %.16s", ctime(&ab.ac_btime)); } /* exit time (starting time + elapsed time )*/ - if (time & AC_FTIME) { + if (flags & AC_FTIME) { t = ab.ac_btime; t += (time_t)(expand(ab.ac_etime)/AC_HZ); (void)printf(" %.16s", ctime(&t)); @@ -260,7 +259,7 @@ register char *argv[]; register struct acct *acp; { - register char *p; + register const char *p; do { p = user_from_uid(acp->ac_uid, 0); @@ -274,12 +273,12 @@ return (0); } -char * +const char * getdev(dev) dev_t dev; { static dev_t lastdev = (dev_t)-1; - static char *lastname; + static const char *lastname; if (dev == NODEV) /* Special case. */ return ("__"); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200106250452.f5P4qB091629>