summaryrefslogtreecommitdiffstats
path: root/usr.bin/finger
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2002-09-04 23:29:10 +0000
committerdwmalone <dwmalone@FreeBSD.org>2002-09-04 23:29:10 +0000
commitb4339b74aded4c38ebcfe3a2a9b37b900abb8874 (patch)
treefb230419005f211ecea1e667385bde9886dbf0d8 /usr.bin/finger
parent228b93ce829543fee06561687a63c17a7e821dfd (diff)
downloadFreeBSD-src-b4339b74aded4c38ebcfe3a2a9b37b900abb8874.zip
FreeBSD-src-b4339b74aded4c38ebcfe3a2a9b37b900abb8874.tar.gz
ANSIify function definitions.
Add some constness to avoid some warnings. Remove use register keyword. Deal with missing/unneeded extern/prototypes. Some minor type changes/casts to avoid warnings. Reviewed by: md5
Diffstat (limited to 'usr.bin/finger')
-rw-r--r--usr.bin/finger/extern.h12
-rw-r--r--usr.bin/finger/finger.c16
-rw-r--r--usr.bin/finger/lprint.c18
-rw-r--r--usr.bin/finger/net.c7
-rw-r--r--usr.bin/finger/sprint.c9
-rw-r--r--usr.bin/finger/util.c37
6 files changed, 37 insertions, 62 deletions
diff --git a/usr.bin/finger/extern.h b/usr.bin/finger/extern.h
index 8054ff4..c8ff7f0 100644
--- a/usr.bin/finger/extern.h
+++ b/usr.bin/finger/extern.h
@@ -38,15 +38,21 @@ extern char tbuf[1024]; /* Temp buffer for anybody. */
extern int entries; /* Number of people. */
extern DB *db; /* Database. */
extern int d_first;
+extern sa_family_t family;
extern int gflag;
+extern int lflag;
+extern time_t now;
+extern int oflag;
+extern int pplan; /* don't show .plan/.project */
+extern int Tflag;
void enter_lastlog(PERSON *);
PERSON *enter_person(struct passwd *);
void enter_where(struct utmp *, PERSON *);
-PERSON *find_person(char *);
-int hide(struct passwd *);
+PERSON *find_person(const char *);
+int hide(struct passwd *);
void lflag_print(void);
-int match(struct passwd *, char *);
+int match(struct passwd *, const char *);
void netfinger(char *);
PERSON *palloc(void);
char *prphone(char *);
diff --git a/usr.bin/finger/finger.c b/usr.bin/finger/finger.c
index a695672..8aafdd5 100644
--- a/usr.bin/finger/finger.c
+++ b/usr.bin/finger/finger.c
@@ -102,9 +102,7 @@ static void usage(void);
static void userlist(int, char **);
static int
-option(argc, argv)
- int argc;
- char **argv;
+option(int argc, char **argv)
{
int ch;
@@ -151,16 +149,14 @@ option(argc, argv)
}
static void
-usage()
+usage(void)
{
(void)fprintf(stderr, "usage: finger [-46lmpshoT] [login ...]\n");
exit(1);
}
int
-main(argc, argv)
- int argc;
- char **argv;
+main(int argc, char **argv)
{
int envargc, argcnt;
char *envargv[3];
@@ -229,7 +225,7 @@ main(argc, argv)
}
static void
-loginlist()
+loginlist(void)
{
PERSON *pn;
DBT data, key;
@@ -269,9 +265,7 @@ loginlist()
}
static void
-userlist(argc, argv)
- int argc;
- char **argv;
+userlist(int argc, char **argv)
{
PERSON *pn;
DBT data, key;
diff --git a/usr.bin/finger/lprint.c b/usr.bin/finger/lprint.c
index 20b0306..16a10a5 100644
--- a/usr.bin/finger/lprint.c
+++ b/usr.bin/finger/lprint.c
@@ -44,6 +44,7 @@ static char sccsid[] = "@(#)lprint.c 8.3 (Berkeley) 4/28/95";
__FBSDID("$FreeBSD$");
#include <sys/types.h>
+#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <ctype.h>
@@ -69,9 +70,8 @@ static void lprint(PERSON *);
static void vputc(unsigned char);
void
-lflag_print()
+lflag_print(void)
{
- extern int pplan;
PERSON *pn;
int sflag, r;
PERSON *tmp;
@@ -101,10 +101,8 @@ lflag_print()
}
static void
-lprint(pn)
- PERSON *pn;
+lprint(PERSON *pn)
{
- extern time_t now;
struct tm *delta;
WHERE *w;
int cpr, len, maxlen;
@@ -258,9 +256,7 @@ no_gecos:
}
static int
-demi_print(str, oddfield)
- char *str;
- int oddfield;
+demi_print(char *str, int oddfield)
{
static int lenlast;
int lenthis, maxlen;
@@ -298,8 +294,7 @@ demi_print(str, oddfield)
}
int
-show_text(directory, file_name, header)
- const char *directory, *file_name, *header;
+show_text(const char *directory, const char *file_name, const char *header)
{
struct stat sb;
FILE *fp;
@@ -352,8 +347,7 @@ show_text(directory, file_name, header)
}
static void
-vputc(ch)
- unsigned char ch;
+vputc(unsigned char ch)
{
int meta;
diff --git a/usr.bin/finger/net.c b/usr.bin/finger/net.c
index b4df124..240cbca 100644
--- a/usr.bin/finger/net.c
+++ b/usr.bin/finger/net.c
@@ -58,17 +58,12 @@ __FBSDID("$FreeBSD$");
#include <utmp.h>
#include "finger.h"
-extern int lflag; /* XXX finger.h? */
-extern int Tflag; /* XXX finger.h? */
-extern sa_family_t family;
-
static void cleanup(int sig);;
static int do_protocol(const char *name, const struct addrinfo *ai);
static void trying(const struct addrinfo *ai);
void
-netfinger(name)
- char *name;
+netfinger(char *name)
{
int error, multi;
char *host;
diff --git a/usr.bin/finger/sprint.c b/usr.bin/finger/sprint.c
index b209b56..396c86e 100644
--- a/usr.bin/finger/sprint.c
+++ b/usr.bin/finger/sprint.c
@@ -43,6 +43,8 @@ static char sccsid[] = "@(#)sprint.c 8.3 (Berkeley) 4/28/95";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <sys/types.h>
+#include <sys/socket.h>
#include <db.h>
#include <err.h>
#include <langinfo.h>
@@ -56,10 +58,8 @@ __FBSDID("$FreeBSD$");
static void stimeprint(WHERE *);
void
-sflag_print()
+sflag_print(void)
{
- extern time_t now;
- extern int oflag;
PERSON *pn;
WHERE *w;
int sflag, r, namelen;
@@ -163,8 +163,7 @@ no_gecos:
}
static void
-stimeprint(w)
- WHERE *w;
+stimeprint(WHERE *w)
{
struct tm *delta;
diff --git a/usr.bin/finger/util.c b/usr.bin/finger/util.c
index ec8df2e..229d58a 100644
--- a/usr.bin/finger/util.c
+++ b/usr.bin/finger/util.c
@@ -44,6 +44,7 @@ static char sccsid[] = "@(#)util.c 8.3 (Berkeley) 4/28/95";
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/socket.h>
#include <sys/stat.h>
#include <ctype.h>
#include <db.h>
@@ -65,9 +66,7 @@ static void userinfo(PERSON *, struct passwd *);
static WHERE *walloc(PERSON *);
int
-match(pw, user)
- struct passwd *pw;
- char *user;
+match(struct passwd *pw, const char *user)
{
char *p, *t;
char name[1024];
@@ -107,8 +106,7 @@ match(pw, user)
}
void
-enter_lastlog(pn)
- PERSON *pn;
+enter_lastlog(PERSON *pn)
{
WHERE *w;
static int opened, fd;
@@ -157,9 +155,7 @@ enter_lastlog(pn)
}
void
-enter_where(ut, pn)
- struct utmp *ut;
- PERSON *pn;
+enter_where(struct utmp *ut, PERSON *pn)
{
WHERE *w;
@@ -174,8 +170,7 @@ enter_where(ut, pn)
}
PERSON *
-enter_person(pw)
- struct passwd *pw;
+enter_person(struct passwd *pw)
{
DBT data, key;
PERSON *pn;
@@ -210,8 +205,7 @@ enter_person(pw)
}
PERSON *
-find_person(name)
- char *name;
+find_person(const char *name)
{
struct passwd *pw;
@@ -240,7 +234,7 @@ find_person(name)
}
PERSON *
-palloc()
+palloc(void)
{
PERSON *p;
@@ -250,8 +244,7 @@ palloc()
}
static WHERE *
-walloc(pn)
- PERSON *pn;
+walloc(PERSON *pn)
{
WHERE *w;
@@ -268,8 +261,7 @@ walloc(pn)
}
char *
-prphone(num)
- char *num;
+prphone(char *num)
{
char *p;
int len;
@@ -318,10 +310,8 @@ prphone(num)
}
static void
-find_idle_and_ttywrite(w)
- WHERE *w;
+find_idle_and_ttywrite(WHERE *w)
{
- extern time_t now;
struct stat sb;
time_t touched;
@@ -342,9 +332,7 @@ find_idle_and_ttywrite(w)
}
static void
-userinfo(pn, pw)
- PERSON *pn;
- struct passwd *pw;
+userinfo(PERSON *pn, struct passwd *pw)
{
char *p, *t;
char *bp, name[1024];
@@ -410,8 +398,7 @@ userinfo(pn, pw)
*/
int
-hide(pw)
- struct passwd *pw;
+hide(struct passwd *pw)
{
struct stat st;
char buf[MAXPATHLEN];
OpenPOWER on IntegriCloud