diff options
author | Mark Murray <markm@FreeBSD.org> | 2001-12-02 20:13:42 +0000 |
---|---|---|
committer | Mark Murray <markm@FreeBSD.org> | 2001-12-02 20:13:42 +0000 |
commit | 4e030ba6cb8cecb5664c3058df6919909c0003d7 (patch) | |
tree | 545bbd835995f189ed29027453456c5feee3222f | |
parent | 458ad6cb172468f889a937f8d15288d39e337239 (diff) | |
download | src-test2-4e030ba6cb8cecb5664c3058df6919909c0003d7.tar.gz src-test2-4e030ba6cb8cecb5664c3058df6919909c0003d7.zip |
Notes
-rw-r--r-- | usr.bin/finger/Makefile | 1 | ||||
-rw-r--r-- | usr.bin/finger/extern.h | 2 | ||||
-rw-r--r-- | usr.bin/finger/finger.c | 36 | ||||
-rw-r--r-- | usr.bin/finger/lprint.c | 32 | ||||
-rw-r--r-- | usr.bin/finger/net.c | 24 | ||||
-rw-r--r-- | usr.bin/finger/sprint.c | 18 | ||||
-rw-r--r-- | usr.bin/finger/util.c | 36 |
7 files changed, 77 insertions, 72 deletions
diff --git a/usr.bin/finger/Makefile b/usr.bin/finger/Makefile index 983392b7a1e0..80b90687c9df 100644 --- a/usr.bin/finger/Makefile +++ b/usr.bin/finger/Makefile @@ -3,6 +3,7 @@ PROG= finger SRCS= finger.c lprint.c net.c sprint.c util.c +WARNS?= 2 MAN= finger.1 finger.conf.5 .include <bsd.prog.mk> diff --git a/usr.bin/finger/extern.h b/usr.bin/finger/extern.h index a0fecd02725e..eb80ac372bc6 100644 --- a/usr.bin/finger/extern.h +++ b/usr.bin/finger/extern.h @@ -50,4 +50,4 @@ void netfinger __P((char *)); PERSON *palloc __P((void)); char *prphone __P((char *)); void sflag_print __P((void)); -int show_text __P((char *, char *, char *)); +int show_text __P((const char *, const char *, const char *)); diff --git a/usr.bin/finger/finger.c b/usr.bin/finger/finger.c index 6a1f9b34cb35..3240dcf5d520 100644 --- a/usr.bin/finger/finger.c +++ b/usr.bin/finger/finger.c @@ -44,6 +44,10 @@ * login time is < 6 days. */ +#include <sys/cdefs.h> + +__FBSDID("$FreeBSD$"); + #ifndef lint static const char copyright[] = "@(#) Copyright (c) 1989, 1993\n\ @@ -51,12 +55,8 @@ static const char copyright[] = #endif /* not lint */ #ifndef lint -#if 0 -static char sccsid[] = "@(#)finger.c 8.5 (Berkeley) 5/4/95"; +static const char sccsid[] = "@(#)finger.c 8.5 (Berkeley) 5/4/95"; #endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ /* * Finger prints out information about users. It is not portable since @@ -93,10 +93,11 @@ int d_first = -1; char tbuf[1024]; static void loginlist __P((void)); +static int option __P((int, char **)); static void usage __P((void)); static void userlist __P((int, char **)); -int +static int option(argc, argv) int argc; char **argv; @@ -151,6 +152,7 @@ main(argc, argv) int envargc, argcnt; char *envargv[3]; struct passwd *pw; + static char myname[] = "finger"; if (getuid() == 0 || geteuid() == 0) { if ((pw = getpwnam(UNPRIV_NAME)) && pw->pw_uid > 0) { @@ -172,7 +174,7 @@ main(argc, argv) */ if ((envargv[1] = getenv("FINGER"))) { envargc = 2; - envargv[0] = "finger"; + envargv[0] = myname; envargv[2] = NULL; (void) option(envargc, envargv); } @@ -216,11 +218,11 @@ main(argc, argv) static void loginlist() { - register PERSON *pn; + PERSON *pn; DBT data, key; struct passwd *pw; struct utmp user; - int r, sflag; + int r, sflag1; char name[UT_NAMESIZE + 1]; if (!freopen(_PATH_UTMP, "r", stdin)) @@ -240,10 +242,10 @@ loginlist() enter_where(&user, pn); } if (db && lflag) - for (sflag = R_FIRST;; sflag = R_NEXT) { + for (sflag1 = R_FIRST;; sflag1 = R_NEXT) { PERSON *tmp; - r = (*db->seq)(db, &key, &data, sflag); + r = (*db->seq)(db, &key, &data, sflag1); if (r == -1) err(1, "db seq"); if (r == 1) @@ -255,14 +257,14 @@ loginlist() static void userlist(argc, argv) - register int argc; - register char **argv; + int argc; + char **argv; { - register PERSON *pn; + PERSON *pn; DBT data, key; struct utmp user; struct passwd *pw; - int r, sflag, *used, *ip; + int r, sflag1, *used, *ip; char **ap, **nargv, **np, **p; FILE *conf_fp; char conf_alias[LINE_MAX]; @@ -375,10 +377,10 @@ net: for (p = nargv; *p;) { enter_where(&user, pn); } if (db) - for (sflag = R_FIRST;; sflag = R_NEXT) { + for (sflag1 = R_FIRST;; sflag1 = R_NEXT) { PERSON *tmp; - r = (*db->seq)(db, &key, &data, sflag); + r = (*db->seq)(db, &key, &data, sflag1); if (r == -1) err(1, "db seq"); if (r == 1) diff --git a/usr.bin/finger/lprint.c b/usr.bin/finger/lprint.c index 02099fdbeb5e..26f55c361646 100644 --- a/usr.bin/finger/lprint.c +++ b/usr.bin/finger/lprint.c @@ -34,13 +34,13 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> + +__FBSDID("$FreeBSD$"); + #ifndef lint -#if 0 -static char sccsid[] = "@(#)lprint.c 8.3 (Berkeley) 4/28/95"; +static const char sccsid[] = "@(#)lprint.c 8.3 (Berkeley) 4/28/95"; #endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ #include <sys/stat.h> #include <ctype.h> @@ -69,8 +69,8 @@ void lflag_print() { extern int pplan; - register PERSON *pn; - register int sflag, r; + PERSON *pn; + int sflag, r; PERSON *tmp; DBT data, key; @@ -99,12 +99,12 @@ lflag_print() static void lprint(pn) - register PERSON *pn; + PERSON *pn; { extern time_t now; - register struct tm *delta; - register WHERE *w; - register int cpr, len, maxlen; + struct tm *delta; + WHERE *w; + int cpr, len, maxlen; struct tm *tp; int oddfield; char t[80]; @@ -293,12 +293,12 @@ demi_print(str, oddfield) int show_text(directory, file_name, header) - char *directory, *file_name, *header; + const char *directory, *file_name, *header; { struct stat sb; - register FILE *fp; - register int ch, cnt; - register char *p, lastc; + FILE *fp; + int ch, cnt; + char *p, lastc; int fd, nr; lastc = '\0'; @@ -347,7 +347,7 @@ show_text(directory, file_name, header) static void vputc(ch) - register unsigned char ch; + unsigned char ch; { int meta; diff --git a/usr.bin/finger/net.c b/usr.bin/finger/net.c index 61fc22174505..4bcb31ba163a 100644 --- a/usr.bin/finger/net.c +++ b/usr.bin/finger/net.c @@ -34,13 +34,13 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> + +__FBSDID("$FreeBSD$"); + #ifndef lint -#if 0 -static char sccsid[] = "@(#)net.c 8.4 (Berkeley) 4/28/95"; +static const char sccsid[] = "@(#)net.c 8.4 (Berkeley) 4/28/95"; #endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ #include <sys/param.h> #include <sys/socket.h> @@ -114,10 +114,12 @@ static int do_protocol(const char *name, const struct addrinfo *ai) { int cnt, line_len, s; - register FILE *fp; - register int c, lastc; + FILE *fp; + int c, lastc; struct iovec iov[3]; struct msghdr msg; + static char slash_w[] = "/W "; + static char neteol[] = "\n\r"; s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if (s < 0) { @@ -136,13 +138,13 @@ do_protocol(const char *name, const struct addrinfo *ai) /* -l flag for remote fingerd */ if (lflag) { - iov[msg.msg_iovlen].iov_base = "/W "; + iov[msg.msg_iovlen].iov_base = slash_w; iov[msg.msg_iovlen++].iov_len = 3; } /* send the name followed by <CR><LF> */ - iov[msg.msg_iovlen].iov_base = (char *)name; + iov[msg.msg_iovlen].iov_base = strdup(name); iov[msg.msg_iovlen++].iov_len = strlen(name); - iov[msg.msg_iovlen].iov_base = "\r\n"; + iov[msg.msg_iovlen].iov_base = neteol; iov[msg.msg_iovlen++].iov_len = 2; /* @@ -238,7 +240,7 @@ trying(const struct addrinfo *ai) } void -cleanup(int sig) +cleanup(int sig __unused) { #define ERRSTR "Timed out.\n" write(STDERR_FILENO, ERRSTR, sizeof ERRSTR); diff --git a/usr.bin/finger/sprint.c b/usr.bin/finger/sprint.c index 12117e4cb4a3..aaa74da4ae37 100644 --- a/usr.bin/finger/sprint.c +++ b/usr.bin/finger/sprint.c @@ -34,13 +34,13 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> + +__FBSDID("$FreeBSD$"); + #ifndef lint -#if 0 -static char sccsid[] = "@(#)sprint.c 8.3 (Berkeley) 4/28/95"; +static const char sccsid[] = "@(#)sprint.c 8.3 (Berkeley) 4/28/95"; #endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ #include <db.h> #include <err.h> @@ -59,9 +59,9 @@ sflag_print() { extern time_t now; extern int oflag; - register PERSON *pn; - register WHERE *w; - register int sflag, r, namelen; + PERSON *pn; + WHERE *w; + int sflag, r, namelen; char p[80]; PERSON *tmp; DBT data, key; @@ -161,7 +161,7 @@ static void stimeprint(w) WHERE *w; { - register struct tm *delta; + struct tm *delta; delta = gmtime(&w->idletime); if (!delta->tm_yday) diff --git a/usr.bin/finger/util.c b/usr.bin/finger/util.c index 5095abca07c2..8f81f50913ff 100644 --- a/usr.bin/finger/util.c +++ b/usr.bin/finger/util.c @@ -34,13 +34,13 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> + +__FBSDID("$FreeBSD$"); + #ifndef lint -#if 0 -static char sccsid[] = "@(#)util.c 8.3 (Berkeley) 4/28/95"; +static const char sccsid[] = "@(#)util.c 8.3 (Berkeley) 4/28/95"; #endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ #include <sys/param.h> #include <sys/stat.h> @@ -68,7 +68,7 @@ match(pw, user) struct passwd *pw; char *user; { - register char *p, *t; + char *p, *t; char name[1024]; if (!strcasecmp(pw->pw_name, user)) @@ -107,9 +107,9 @@ match(pw, user) void enter_lastlog(pn) - register PERSON *pn; + PERSON *pn; { - register WHERE *w; + WHERE *w; static int opened, fd; struct lastlog ll; char doit = 0; @@ -160,7 +160,7 @@ enter_where(ut, pn) struct utmp *ut; PERSON *pn; { - register WHERE *w; + WHERE *w; w = walloc(pn); w->info = LOGGEDIN; @@ -174,7 +174,7 @@ enter_where(ut, pn) PERSON * enter_person(pw) - register struct passwd *pw; + struct passwd *pw; { DBT data, key; PERSON *pn; @@ -214,7 +214,7 @@ find_person(name) { struct passwd *pw; - register int cnt; + int cnt; DBT data, key; PERSON *p; char buf[UT_NAMESIZE + 1]; @@ -250,9 +250,9 @@ palloc() static WHERE * walloc(pn) - register PERSON *pn; + PERSON *pn; { - register WHERE *w; + WHERE *w; if ((w = malloc((u_int) sizeof(WHERE))) == NULL) err(1, NULL); @@ -270,7 +270,7 @@ char * prphone(num) char *num; { - register char *p; + char *p; int len; static char pbuf[20]; @@ -318,7 +318,7 @@ prphone(num) static void find_idle_and_ttywrite(w) - register WHERE *w; + WHERE *w; { extern time_t now; struct stat sb; @@ -342,10 +342,10 @@ find_idle_and_ttywrite(w) static void userinfo(pn, pw) - register PERSON *pn; - register struct passwd *pw; + PERSON *pn; + struct passwd *pw; { - register char *p, *t; + char *p, *t; char *bp, name[1024]; struct stat sb; |