From e3e153e6ce00310a5f509d4c941957ac27d23af8 Mon Sep 17 00:00:00 2001 From: dwmalone Date: Wed, 4 Sep 2002 23:29:10 +0000 Subject: [PATCH] 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 --- bin/chflags/chflags.c | 6 ++-- usr.bin/basename/basename.c | 6 ++-- usr.bin/chflags/chflags.c | 6 ++-- usr.bin/col/col.c | 22 ++++++--------- usr.bin/colcrt/colcrt.c | 21 ++++++-------- usr.bin/cut/cut.c | 21 ++++---------- usr.bin/enigma/enigma.c | 12 +++----- usr.bin/env/env.c | 6 ++-- usr.bin/expand/expand.c | 15 ++++------ usr.bin/finger/extern.h | 12 ++++++-- usr.bin/finger/finger.c | 16 ++++------- usr.bin/finger/lprint.c | 18 ++++-------- usr.bin/finger/net.c | 7 +---- usr.bin/finger/sprint.c | 9 +++--- usr.bin/finger/util.c | 37 ++++++++---------------- usr.bin/fold/fold.c | 14 ++++----- usr.bin/from/from.c | 10 ++++--- usr.bin/gcore/aoutcore.c | 4 ++- usr.bin/gcore/elfcore.c | 19 +++++++------ usr.bin/gcore/gcore.c | 4 ++- usr.bin/gcore/md-nop.c | 6 ++-- usr.bin/getconf/confstr.gperf | 2 +- usr.bin/getconf/sysconf.gperf | 2 +- usr.bin/getopt/getopt.c | 4 +-- usr.bin/hesinfo/hesinfo.c | 4 +-- usr.bin/hexdump/conv.c | 8 ++---- usr.bin/hexdump/display.c | 36 +++++++++--------------- usr.bin/hexdump/hexdump.c | 6 ++-- usr.bin/hexdump/hexdump.h | 2 ++ usr.bin/hexdump/hexsyntax.c | 6 ++-- usr.bin/hexdump/odsyntax.c | 8 ++---- usr.bin/hexdump/parse.c | 40 +++++++++++--------------- usr.bin/id/id.c | 24 ++++++---------- usr.bin/ipcrm/ipcrm.c | 25 ++++------------- usr.bin/join/join.c | 49 +++++++++++--------------------- usr.bin/last/last.c | 32 +++++++-------------- usr.bin/lastcomm/lastcomm.c | 19 ++++--------- usr.bin/leave/leave.c | 17 +++++------ usr.bin/lock/lock.c | 6 ++-- usr.bin/logger/logger.c | 17 ++++------- usr.bin/logname/logname.c | 6 ++-- usr.bin/look/look.c | 29 ++++++++----------- usr.bin/makewhatis/makewhatis.c | 10 +++---- usr.bin/mesg/mesg.c | 6 ++-- usr.bin/mkfifo/mkfifo.c | 6 ++-- usr.bin/msgs/msgs.c | 33 ++++++++-------------- usr.bin/ncplogin/ncplogin.c | 4 ++- usr.bin/nice/nice.c | 6 ++-- usr.bin/pr/extern.h | 4 +-- usr.bin/pr/pr.c | 14 ++++----- usr.bin/printenv/printenv.c | 10 +++---- usr.bin/printf/printf.c | 39 +++++++++---------------- usr.bin/rev/rev.c | 6 ++-- usr.bin/rwall/rwall.c | 2 +- usr.bin/script/script.c | 16 ++++------- usr.bin/soelim/soelim.c | 11 +++----- usr.bin/tee/tee.c | 16 ++++------- usr.bin/time/time.c | 15 ++++------ usr.bin/touch/touch.c | 24 ++++------------ usr.bin/tput/tput.c | 13 +++------ usr.bin/tr/tr.c | 13 ++------- usr.bin/tset/tset.c | 14 +++------ usr.bin/tsort/tsort.c | 45 ++++++++++++----------------- usr.bin/ul/ul.c | 40 +++++++++++--------------- usr.bin/uname/uname.c | 6 ++-- usr.bin/unexpand/unexpand.c | 11 +++----- usr.bin/uniq/uniq.c | 26 ++++++----------- usr.bin/unvis/unvis.c | 12 +++----- usr.bin/users/users.c | 9 ++---- usr.bin/vis/vis.c | 13 ++++----- usr.bin/what/what.c | 10 +++---- usr.bin/write/write.c | 30 ++++++-------------- usr.bin/xinstall/xinstall.c | 43 +++++++++------------------- usr.bin/xstr/xstr.c | 50 +++++++++++---------------------- usr.bin/yes/yes.c | 4 +-- 75 files changed, 423 insertions(+), 751 deletions(-) diff --git a/bin/chflags/chflags.c b/bin/chflags/chflags.c index b2e6c2368264..92046338ac7c 100644 --- a/bin/chflags/chflags.c +++ b/bin/chflags/chflags.c @@ -60,9 +60,7 @@ __FBSDID("$FreeBSD$"); void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { FTS *ftsp; FTSENT *p; @@ -177,7 +175,7 @@ main(argc, argv) } void -usage() +usage(void) { (void)fprintf(stderr, "usage: chflags [-R [-H | -L | -P]] flags file ...\n"); diff --git a/usr.bin/basename/basename.c b/usr.bin/basename/basename.c index 20c056270627..9e1a992cf641 100644 --- a/usr.bin/basename/basename.c +++ b/usr.bin/basename/basename.c @@ -56,9 +56,7 @@ __FBSDID("$FreeBSD$"); void usage(void); int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { char *p, *q, *suffix; size_t suffixlen; @@ -111,7 +109,7 @@ main(argc, argv) } void -usage() +usage(void) { (void)fprintf(stderr, diff --git a/usr.bin/chflags/chflags.c b/usr.bin/chflags/chflags.c index b2e6c2368264..92046338ac7c 100644 --- a/usr.bin/chflags/chflags.c +++ b/usr.bin/chflags/chflags.c @@ -60,9 +60,7 @@ __FBSDID("$FreeBSD$"); void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { FTS *ftsp; FTSENT *p; @@ -177,7 +175,7 @@ main(argc, argv) } void -usage() +usage(void) { (void)fprintf(stderr, "usage: chflags [-R [-H | -L | -P]] flags file ...\n"); diff --git a/usr.bin/col/col.c b/usr.bin/col/col.c index 73d4e0fdce1c..b45dd67d2fad 100644 --- a/usr.bin/col/col.c +++ b/usr.bin/col/col.c @@ -118,9 +118,7 @@ int pass_unknown_seqs; /* pass unknown control sequences */ } while (0) int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { int ch; CHAR *c; @@ -330,8 +328,7 @@ main(argc, argv) } void -flush_lines(nflush) - int nflush; +flush_lines(int nflush) { LINE *l; @@ -357,7 +354,7 @@ flush_lines(nflush) * feeds. */ void -flush_blanks() +flush_blanks(void) { int half, i, nb; @@ -386,8 +383,7 @@ flush_blanks() * and character set shifts. */ void -flush_line(l) - LINE *l; +flush_line(LINE *l) { CHAR *c, *endc; int nchars, last_col, this_col; @@ -494,7 +490,7 @@ flush_line(l) static LINE *line_freelist; LINE * -alloc_line() +alloc_line(void) { LINE *l; int i; @@ -515,8 +511,7 @@ alloc_line() } void -free_line(l) - LINE *l; +free_line(LINE *l) { l->l_next = line_freelist; @@ -524,7 +519,7 @@ free_line(l) } void -usage() +usage(void) { (void)fprintf(stderr, "usage: col [-bfhpx] [-l nline]\n"); @@ -532,8 +527,7 @@ usage() } void -dowarn(line) - int line; +dowarn(int line) { warnx("warning: can't back up %s", diff --git a/usr.bin/colcrt/colcrt.c b/usr.bin/colcrt/colcrt.c index 6cd9be6ef3f5..5d7fd15afc91 100644 --- a/usr.bin/colcrt/colcrt.c +++ b/usr.bin/colcrt/colcrt.c @@ -81,9 +81,7 @@ static int plus(char, char); static void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int c; char *cp, *dp; @@ -191,15 +189,14 @@ main(argc, argv) } static void -usage() +usage(void) { fprintf(stderr, "usage: colcrt [-] [-2] [file ...]\n"); exit(1); } static int -plus(c, d) - char c, d; +plus(char c, char d) { return ((c == '|' && d == '-') || d == '_'); @@ -208,11 +205,10 @@ plus(c, d) int first; static void -pflush(ol) - int ol; +pflush(int ol) { - register int i; - register char *cp; + int i; + char *cp; char lastomit; int l; @@ -243,10 +239,9 @@ pflush(ol) } static void -move(l, m) - int l, m; +move(int l, int m) { - register char *cp, *dp; + char *cp, *dp; for (cp = page[l], dp = page[m]; *cp; cp++, dp++) { switch (*cp) { diff --git a/usr.bin/cut/cut.c b/usr.bin/cut/cut.c index 6824a565d667..b8bf0b3b35dd 100644 --- a/usr.bin/cut/cut.c +++ b/usr.bin/cut/cut.c @@ -68,9 +68,7 @@ void needpos(size_t); static void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { FILE *fp; void (*fcn)(FILE *, const char *); @@ -155,8 +153,7 @@ size_t autostart, autostop, maxval; char *positions; void -get_list(list) - char *list; +get_list(char *list) { size_t setautostart, start, stop; char *pos; @@ -237,9 +234,7 @@ needpos(size_t n) * c_cut() ought to be much faster. */ void -b_n_cut(fp, fname) - FILE *fp; - const char *fname; +b_n_cut(FILE *fp, const char *fname) { size_t col, i, lbuflen; char *lbuf; @@ -297,9 +292,7 @@ b_n_cut(fp, fname) } void -c_cut(fp, fname) - FILE *fp; - const char *fname __unused; +c_cut(FILE *fp, const char *fname __unused) { int ch, col; char *pos; @@ -327,9 +320,7 @@ c_cut(fp, fname) } void -f_cut(fp, fname) - FILE *fp; - const char *fname __unused; +f_cut(FILE *fp, const char *fname __unused) { int ch, field, isdelim; char *pos, *p, sep; @@ -394,7 +385,7 @@ f_cut(fp, fname) } static void -usage() +usage(void) { (void)fprintf(stderr, "%s\n%s\n%s\n", "usage: cut -b list [-n] [file ...]", diff --git a/usr.bin/enigma/enigma.c b/usr.bin/enigma/enigma.c index 655536cc50b7..1b0f077a9b01 100644 --- a/usr.bin/enigma/enigma.c +++ b/usr.bin/enigma/enigma.c @@ -36,8 +36,7 @@ void shuffle(char *); void setup(char *); void -setup(pw) - char *pw; +setup(char *pw) { int ic, i, k, temp, pf[2], pid; unsigned rnd; @@ -109,11 +108,9 @@ setup(pw) } int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { - register int i, n1, n2, nr1, nr2; + int i, n1, n2, nr1, nr2; int secureflg = 0, kflag = 0; char *cp; @@ -169,8 +166,7 @@ main(argc, argv) } void -shuffle(deckary) - char deckary[]; +shuffle(char deckary[]) { int i, ic, k, temp; unsigned rnd; diff --git a/usr.bin/env/env.c b/usr.bin/env/env.c index a9554577cb3f..26651f4d7487 100644 --- a/usr.bin/env/env.c +++ b/usr.bin/env/env.c @@ -58,9 +58,7 @@ extern char **environ; static void usage(void); int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { char **ep, *p; char *cleanenv[1]; @@ -89,7 +87,7 @@ main(argc, argv) } static void -usage() +usage(void) { (void)fprintf(stderr, "usage: env [-i] [name=value ...] [utility [argument ...]]\n"); diff --git a/usr.bin/expand/expand.c b/usr.bin/expand/expand.c index 70e1247bb444..927c3ab36c4c 100644 --- a/usr.bin/expand/expand.c +++ b/usr.bin/expand/expand.c @@ -62,12 +62,10 @@ static void getstops(char *); static void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { - register int c, column; - register int n; + int c, column; + int n; int rval; setlocale(LC_CTYPE, ""); @@ -159,10 +157,9 @@ main(argc, argv) } static void -getstops(cp) - register char *cp; +getstops(char *cp) { - register int i; + int i; nstops = 0; for (;;) { @@ -185,7 +182,7 @@ getstops(cp) } static void -usage() +usage(void) { (void)fprintf (stderr, "usage: expand [-t tablist] [file ...]\n"); exit(1); diff --git a/usr.bin/finger/extern.h b/usr.bin/finger/extern.h index 8054ff404b96..c8ff7f07b296 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 a695672bd1ac..8aafdd50c3b8 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 20b03060f3e2..16a10a57b9b3 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 +#include #include #include #include @@ -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 @@ lprint(pn) } 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 b4df12434220..240cbcadd4fa 100644 --- a/usr.bin/finger/net.c +++ b/usr.bin/finger/net.c @@ -58,17 +58,12 @@ __FBSDID("$FreeBSD$"); #include #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 b209b5622b31..396c86e39dd5 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 __FBSDID("$FreeBSD$"); +#include +#include #include #include #include @@ -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 @@ sflag_print() } 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 ec8df2e90f27..229d58a9abce 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 +#include #include #include #include @@ -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]; diff --git a/usr.bin/fold/fold.c b/usr.bin/fold/fold.c index 49dbb0e81213..fc5cb16d20c5 100644 --- a/usr.bin/fold/fold.c +++ b/usr.bin/fold/fold.c @@ -68,11 +68,9 @@ int bflag; /* Count bytes, not columns */ int sflag; /* Split on word boundaries */ int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { - register int ch; + int ch; int rval, width; char *p; @@ -123,7 +121,7 @@ main(argc, argv) } static void -usage() +usage(void) { (void)fprintf(stderr, "usage: fold [-bs] [-w width] [file ...]\n"); exit(1); @@ -141,8 +139,7 @@ usage() * returns embedded in the input stream. */ void -fold(width) - register int width; +fold(int width) { static char *buf; static int buf_max; @@ -196,8 +193,7 @@ fold(width) * Update the current column position for a character. */ static int -newpos(col, ch) - int col, ch; +newpos(int col, int ch) { if (bflag) diff --git a/usr.bin/from/from.c b/usr.bin/from/from.c index d42e0bd787fa..84d0c52b23a3 100644 --- a/usr.bin/from/from.c +++ b/usr.bin/from/from.c @@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include -int match(char *, char *); +int match(const char *, const char *); static void usage(void); int @@ -64,7 +64,8 @@ main(int argc, char **argv) FILE *mbox; struct passwd *pwd; int ch, count, newline; - char *file, *sender, *p; + const char *file; + char *sender, *p; #if MAXPATHLEN > BUFSIZ char buf[MAXPATHLEN]; #else @@ -146,9 +147,10 @@ usage(void) } int -match(char *line, char *sender) +match(const char *line, const char *sender) { - char ch, pch, first, *p, *t; + char ch, pch, first; + const char *p, *t; for (first = *sender++;;) { if (isspace(ch = *line)) diff --git a/usr.bin/gcore/aoutcore.c b/usr.bin/gcore/aoutcore.c index e9c2e63c1b85..7c8ede6d9343 100644 --- a/usr.bin/gcore/aoutcore.c +++ b/usr.bin/gcore/aoutcore.c @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -99,7 +100,8 @@ main(argc, argv) { struct kinfo_proc *ki = NULL; struct exec exec; - int ch, cnt, efd, fd, sflag, uid; + int ch, cnt, efd, fd, sflag; + uid_t uid; char *binfile, *corefile; char errbuf[_POSIX2_LINE_MAX], fname[MAXPATHLEN]; int is_aout; diff --git a/usr.bin/gcore/elfcore.c b/usr.bin/gcore/elfcore.c index ef98a693223d..e473d7ce5bd8 100644 --- a/usr.bin/gcore/elfcore.c +++ b/usr.bin/gcore/elfcore.c @@ -125,28 +125,29 @@ elf_coredump(int fd, pid_t pid) php = (Elf_Phdr *)((char *)hdr + sizeof(Elf_Ehdr)) + 1; for (i = 0; i < seginfo.count; i++) { - int nleft = php->p_filesz; + uintmax_t nleft = php->p_filesz; lseek(memfd, (off_t)php->p_vaddr, SEEK_SET); while (nleft > 0) { char buf[8*1024]; - int nwant; - int ngot; + size_t nwant; + ssize_t ngot; - nwant = nleft; - if (nwant > sizeof buf) + if (nleft > sizeof(buf)) nwant = sizeof buf; + else + nwant = nleft; ngot = read(memfd, buf, nwant); if (ngot == -1) err(1, "read from %s", memname); - if (ngot < nwant) + if ((size_t)ngot < nwant) errx(1, "short read from %s:" " wanted %d, got %d", memname, nwant, ngot); ngot = write(fd, buf, nwant); if (ngot == -1) err(1, "write of segment %d failed", i); - if (ngot != nwant) + if ((size_t)ngot != nwant) errx(1, "short write"); nleft -= nwant; } @@ -395,7 +396,7 @@ readhdrinfo(pid_t pid, prstatus_t *status, prfpregset_t *fpregset, err(1, "cannot open %s", name); if ((n = read(fd, &status->pr_reg, sizeof status->pr_reg)) == -1) err(1, "read error from %s", name); - if (n < sizeof status->pr_reg) + if ((size_t)n < sizeof(status->pr_reg)) errx(1, "short read from %s: wanted %u, got %d", name, sizeof status->pr_reg, n); close(fd); @@ -406,7 +407,7 @@ readhdrinfo(pid_t pid, prstatus_t *status, prfpregset_t *fpregset, err(1, "cannot open %s", name); if ((n = read(fd, fpregset, sizeof *fpregset)) == -1) err(1, "read error from %s", name); - if (n < sizeof *fpregset) + if ((size_t)n < sizeof(*fpregset)) errx(1, "short read from %s: wanted %u, got %d", name, sizeof *fpregset, n); close(fd); diff --git a/usr.bin/gcore/gcore.c b/usr.bin/gcore/gcore.c index e9c2e63c1b85..7c8ede6d9343 100644 --- a/usr.bin/gcore/gcore.c +++ b/usr.bin/gcore/gcore.c @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -99,7 +100,8 @@ main(argc, argv) { struct kinfo_proc *ki = NULL; struct exec exec; - int ch, cnt, efd, fd, sflag, uid; + int ch, cnt, efd, fd, sflag; + uid_t uid; char *binfile, *corefile; char errbuf[_POSIX2_LINE_MAX], fname[MAXPATHLEN]; int is_aout; diff --git a/usr.bin/gcore/md-nop.c b/usr.bin/gcore/md-nop.c index ee6a04111cd0..af7072c88a57 100644 --- a/usr.bin/gcore/md-nop.c +++ b/usr.bin/gcore/md-nop.c @@ -48,9 +48,9 @@ __FBSDID("$FreeBSD$"); void md_core(kd, fd, ki) - kvm_t *kd; - int fd; - struct kinfo_proc *ki; + kvm_t *kd __unused; + int fd __unused; + struct kinfo_proc *ki __unused; { /* Don't need to fix anything for this architecture. */ return; diff --git a/usr.bin/getconf/confstr.gperf b/usr.bin/getconf/confstr.gperf index 2abb55fae2bb..ad2f509a04f3 100644 --- a/usr.bin/getconf/confstr.gperf +++ b/usr.bin/getconf/confstr.gperf @@ -18,7 +18,7 @@ static const struct map *in_word_set(const char *str, unsigned int len); %} -struct map { char *name; int key; }; +struct map { const char *name; int key; }; %% PATH, _CS_PATH POSIX_V6_ILP32_OFF32_CFLAGS, _CS_POSIX_V6_ILP32_OFF32_CFLAGS diff --git a/usr.bin/getconf/sysconf.gperf b/usr.bin/getconf/sysconf.gperf index 10e020473472..b917000d7818 100644 --- a/usr.bin/getconf/sysconf.gperf +++ b/usr.bin/getconf/sysconf.gperf @@ -120,7 +120,7 @@ static const struct map *in_word_set(const char *str, unsigned int len); %} -struct map { char *name; int key; }; +struct map { const char *name; int key; }; %% AIO_LISTIO_MAX, _SC_AIO_LISTIO_MAX AIO_MAX, _SC_AIO_MAX diff --git a/usr.bin/getopt/getopt.c b/usr.bin/getopt/getopt.c index 269a5786cf77..33637604f26f 100644 --- a/usr.bin/getopt/getopt.c +++ b/usr.bin/getopt/getopt.c @@ -6,9 +6,7 @@ __FBSDID("$FreeBSD$"); #include int -main(argc, argv) -int argc; -char *argv[]; +main(int argc, char *argv[]) { int c; int status = 0; diff --git a/usr.bin/hesinfo/hesinfo.c b/usr.bin/hesinfo/hesinfo.c index 7bbaead2f8ed..fa81864a5d00 100644 --- a/usr.bin/hesinfo/hesinfo.c +++ b/usr.bin/hesinfo/hesinfo.c @@ -30,9 +30,7 @@ __FBSDID("$FreeBSD$"); #include int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { char **list, **p, *bindname, *name, *type; int lflag = 0, errflg = 0, bflag = 0, c; diff --git a/usr.bin/hexdump/conv.c b/usr.bin/hexdump/conv.c index eea03be7b309..581b66631626 100644 --- a/usr.bin/hexdump/conv.c +++ b/usr.bin/hexdump/conv.c @@ -44,9 +44,7 @@ __FBSDID("$FreeBSD$"); #include "hexdump.h" void -conv_c(pr, p) - PR *pr; - u_char *p; +conv_c(PR *pr, u_char *p) { char buf[10]; char const *str; @@ -92,9 +90,7 @@ strpr: *pr->cchar = 's'; } void -conv_u(pr, p) - PR *pr; - u_char *p; +conv_u(PR *pr, u_char *p) { static char const * list[] = { "nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel", diff --git a/usr.bin/hexdump/display.c b/usr.bin/hexdump/display.c index f2eb93b11f90..2ab34a49e7ba 100644 --- a/usr.bin/hexdump/display.c +++ b/usr.bin/hexdump/display.c @@ -58,14 +58,13 @@ static off_t eaddress; /* end address */ static __inline void print(PR *, u_char *); void -display() +display(void) { - extern FU *endfu; - register FS *fs; - register FU *fu; - register PR *pr; - register int cnt; - register u_char *bp; + FS *fs; + FU *fu; + PR *pr; + int cnt; + u_char *bp; off_t saveaddress; u_char savech, *savebp; @@ -113,9 +112,7 @@ display() } static __inline void -print(pr, bp) - PR *pr; - u_char *bp; +print(PR *pr, u_char *bp) { long double ldbl; double f8; @@ -212,11 +209,10 @@ print(pr, bp) } void -bpad(pr) - PR *pr; +bpad(PR *pr) { static char const *spec = " -0+#"; - register char *p1, *p2; + char *p1, *p2; /* * Remove all conversion flags; '-' is the only one valid @@ -233,11 +229,11 @@ bpad(pr) static char **_argv; u_char * -get() +get(void) { static int ateof = 1; static u_char *curp, *savp; - register int n; + int n; int need, nread; int valid_save = 0; u_char *tmpp; @@ -308,10 +304,8 @@ get() } int -next(argv) - char **argv; +next(char **argv) { - extern int exitval; static int done; int statok; @@ -344,11 +338,9 @@ next(argv) } void -doskip(fname, statok) - const char *fname; - int statok; +doskip(const char *fname, int statok) { - register int cnt; + int cnt; struct stat sb; if (statok) { diff --git a/usr.bin/hexdump/hexdump.c b/usr.bin/hexdump/hexdump.c index 660a2d9e2584..2ed7c4b9df49 100644 --- a/usr.bin/hexdump/hexdump.c +++ b/usr.bin/hexdump/hexdump.c @@ -58,11 +58,9 @@ int exitval; /* final exit value */ int length = -1; /* max bytes to read */ int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { - register FS *tfs; + FS *tfs; char *p; (void)setlocale(LC_ALL, ""); diff --git a/usr.bin/hexdump/hexdump.h b/usr.bin/hexdump/hexdump.h index 360fe5da35ba..cf3b79c11d14 100644 --- a/usr.bin/hexdump/hexdump.h +++ b/usr.bin/hexdump/hexdump.h @@ -72,7 +72,9 @@ typedef struct _fs { /* format strings */ } FS; extern FS *fshead; /* head of format strings list */ +extern FU *endfu; /* format at end-of-data */ extern int blocksize; /* data block size */ +extern int exitval; /* final exit value */ extern int odmode; /* are we acting as od(1)? */ extern int length; /* amount of data to read */ extern off_t skip; /* amount of data to skip at start */ diff --git a/usr.bin/hexdump/hexsyntax.c b/usr.bin/hexdump/hexsyntax.c index fad2fa8edd76..4d21611f6a3f 100644 --- a/usr.bin/hexdump/hexsyntax.c +++ b/usr.bin/hexdump/hexsyntax.c @@ -52,9 +52,7 @@ __FBSDID("$FreeBSD$"); off_t skip; /* bytes to skip */ void -newsyntax(argc, argvp) - int argc; - char ***argvp; +newsyntax(int argc, char ***argvp) { int ch; char *p, **argv; @@ -135,7 +133,7 @@ newsyntax(argc, argvp) } void -usage() +usage(void) { (void)fprintf(stderr, "%s\n%s\n%s\n%s\n", "usage: hexdump [-bcCdovx] [-e fmt] [-f fmt_file] [-n length]", diff --git a/usr.bin/hexdump/odsyntax.c b/usr.bin/hexdump/odsyntax.c index 0a37d01ef336..19684bffb635 100644 --- a/usr.bin/hexdump/odsyntax.c +++ b/usr.bin/hexdump/odsyntax.c @@ -64,9 +64,7 @@ static void odoffset(int, char ***); static void odusage(void); void -oldsyntax(argc, argvp) - int argc; - char ***argvp; +oldsyntax(int argc, char ***argvp) { static char empty[] = "", padding[] = PADDING; int ch; @@ -193,9 +191,7 @@ odusage(void) } static void -odoffset(argc, argvp) - int argc; - char ***argvp; +odoffset(int argc, char ***argvp) { unsigned char *p, *num, *end; int base; diff --git a/usr.bin/hexdump/parse.c b/usr.bin/hexdump/parse.c index 25ef0329ded6..7b7f8e777aff 100644 --- a/usr.bin/hexdump/parse.c +++ b/usr.bin/hexdump/parse.c @@ -52,10 +52,9 @@ __FBSDID("$FreeBSD$"); FU *endfu; /* format at end-of-data */ void -addfile(name) - char *name; +addfile(char *name) { - register unsigned char *p; + unsigned char *p; FILE *fp; int ch; char buf[2048 + 1]; @@ -78,8 +77,7 @@ addfile(name) } void -add(fmt) - const char *fmt; +add(const char *fmt) { unsigned const char *p, *savep; static FS **nextfs; @@ -154,12 +152,11 @@ add(fmt) static const char *spec = ".#-+ 0123456789"; int -size(fs) - FS *fs; +size(FS *fs) { - register FU *fu; - register int bcnt, cursize; - register unsigned char *fmt; + FU *fu; + int bcnt, cursize; + unsigned char *fmt; int prec; /* figure out the data block size needed for each format unit */ @@ -208,12 +205,11 @@ size(fs) } void -rewrite(fs) - FS *fs; +rewrite(FS *fs) { enum { NOTOKAY, USEBCNT, USEPREC } sokay; - register PR *pr, **nextpr; - register FU *fu; + PR *pr, **nextpr; + FU *fu; unsigned char *p1, *p2, *fmtp; char savech, cs[3]; int nconv, prec; @@ -449,10 +445,9 @@ isint2: switch(fu->bcnt) { } void -escape(p1) - register char *p1; +escape(char *p1) { - register char *p2; + char *p2; /* alphabetic escape sequences have to be done in place */ for (p2 = p1;; ++p1, ++p2) { @@ -492,28 +487,25 @@ escape(p1) } void -badcnt(s) - char *s; +badcnt(char *s) { errx(1, "%s: bad byte count", s); } void -badsfmt() +badsfmt(void) { errx(1, "%%s: requires a precision or a byte count"); } void -badfmt(fmt) - const char *fmt; +badfmt(const char *fmt) { errx(1, "\"%s\": bad format", fmt); } void -badconv(ch) - char *ch; +badconv(char *ch) { errx(1, "%%%s: bad conversion character", ch); } diff --git a/usr.bin/id/id.c b/usr.bin/id/id.c index 5d43e9fcda2c..2d4eee7e6573 100644 --- a/usr.bin/id/id.c +++ b/usr.bin/id/id.c @@ -67,9 +67,7 @@ struct passwd * int isgroups, iswhoami; int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { struct group *gr; struct passwd *pw; @@ -177,8 +175,7 @@ main(argc, argv) } void -pretty(pw) - struct passwd *pw; +pretty(struct passwd *pw) { struct group *gr; u_int eid, rid; @@ -218,7 +215,7 @@ pretty(pw) } void -current() +current(void) { struct group *gr; struct passwd *pw; @@ -259,8 +256,7 @@ current() } void -user(pw) - struct passwd *pw; +user(struct passwd *pw) { struct group *gr; const char *fmt; @@ -287,9 +283,7 @@ user(pw) } void -group(pw, nflag) - struct passwd *pw; - int nflag; +group(struct passwd *pw, int nflag) { struct group *gr; int cnt, id, lastid, ngroups; @@ -324,8 +318,7 @@ group(pw, nflag) } struct passwd * -who(u) - char *u; +who(char *u) { struct passwd *pw; long id; @@ -345,8 +338,7 @@ who(u) } void -pline(pw) - struct passwd *pw; +pline(struct passwd *pw) { u_int rid; @@ -363,7 +355,7 @@ pline(pw) void -usage() +usage(void) { if (isgroups) diff --git a/usr.bin/ipcrm/ipcrm.c b/usr.bin/ipcrm/ipcrm.c index 7f0f89b8a1fa..8c039aefd01e 100644 --- a/usr.bin/ipcrm/ipcrm.c +++ b/usr.bin/ipcrm/ipcrm.c @@ -48,12 +48,6 @@ __FBSDID("$FreeBSD$"); #define IPC_TO_STRING(x) (x == 'Q' ? "message queue" : \ (x == 'M' ? "shared memory segment" : "semaphore")) -void usage(void); -int msgrm(key_t, int); -int shmrm(key_t, int); -int semrm(key_t, int); -void not_configured(int); - int signaled; void usage(void); @@ -62,7 +56,7 @@ int shmrm(key_t, int); int semrm(key_t, int); void not_configured(int); -void usage() +void usage(void) { fprintf(stderr, "%s\n%s\n", "usage: ipcrm [-q msqid] [-m shmid] [-s semid]", @@ -70,9 +64,7 @@ void usage() exit(1); } -int msgrm(key, id) - key_t key; - int id; +int msgrm(key_t key, int id) { if (key) { id = msgget(key, 0); @@ -82,9 +74,7 @@ int msgrm(key, id) return msgctl(id, IPC_RMID, NULL); } -int shmrm(key, id) - key_t key; - int id; +int shmrm(key_t key, int id) { if (key) { id = shmget(key, 0, 0); @@ -94,9 +84,7 @@ int shmrm(key, id) return shmctl(id, IPC_RMID, NULL); } -int semrm(key, id) - key_t key; - int id; +int semrm(key_t key, int id) { union semun arg; @@ -113,10 +101,7 @@ void not_configured(int signo __unused) signaled++; } -int main(argc, argv) - int argc; - char *argv[]; - +int main(int argc, char *argv[]) { int c, result, errflg, target_id; key_t target_key; diff --git a/usr.bin/join/join.c b/usr.bin/join/join.c index 8d936c70bca4..e360f86808bb 100644 --- a/usr.bin/join/join.c +++ b/usr.bin/join/join.c @@ -77,7 +77,7 @@ typedef struct { FILE *fp; /* file descriptor */ u_long joinf; /* join field (-1, -2, -j) */ int unpair; /* output unpairable lines (-a) */ - int number; /* 1 for file 1, 2 for file 2 */ + u_long number; /* 1 for file 1, 2 for file 2 */ LINE *set; /* set of lines with same field */ int pushbool; /* if pushback is set */ @@ -114,9 +114,7 @@ void slurp(INPUT *); void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { INPUT *F1, *F2; int aflag, ch, cval, vflag; @@ -270,8 +268,7 @@ main(argc, argv) } void -slurp(F) - INPUT *F; +slurp(INPUT *F) { LINE *lp, *lastlp, tmp; size_t len; @@ -360,9 +357,7 @@ slurp(F) } int -cmp(lp1, fieldno1, lp2, fieldno2) - LINE *lp1, *lp2; - u_long fieldno1, fieldno2; +cmp(LINE *lp1, u_long fieldno1, LINE *lp2, u_long fieldno2) { if (lp1->fieldcnt <= fieldno1) return (lp2->fieldcnt <= fieldno2 ? 0 : 1); @@ -372,10 +367,9 @@ cmp(lp1, fieldno1, lp2, fieldno2) } void -joinlines(F1, F2) - INPUT *F1, *F2; +joinlines(INPUT *F1, INPUT *F2) { - unsigned int cnt1, cnt2; + u_long cnt1, cnt2; /* * Output the results of a join comparison. The output may be from @@ -393,11 +387,9 @@ joinlines(F1, F2) } void -outoneline(F, lp) - INPUT *F; - LINE *lp; +outoneline(INPUT *F, LINE *lp) { - unsigned int cnt; + u_long cnt; /* * Output a single line from one of the files, according to the @@ -423,11 +415,9 @@ outoneline(F, lp) } void -outtwoline(F1, lp1, F2, lp2) - INPUT *F1, *F2; - LINE *lp1, *lp2; +outtwoline(INPUT *F1, LINE *lp1, INPUT *F2, LINE *lp2) { - unsigned int cnt; + u_long cnt; /* Output a pair of lines according to the join list (if any). */ if (olist) @@ -461,10 +451,7 @@ outtwoline(F1, lp1, F2, lp2) } void -outfield(lp, fieldno, out_empty) - LINE *lp; - u_long fieldno; - int out_empty; +outfield(LINE *lp, u_long fieldno, int out_empty) { if (needsep++) (void)printf("%c", *tabchar); @@ -487,8 +474,7 @@ outfield(lp, fieldno, out_empty) * fields. */ void -fieldarg(option) - char *option; +fieldarg(char *option) { u_long fieldno, filenum; char *end, *token; @@ -522,10 +508,9 @@ fieldarg(option) } void -obsolete(argv) - char **argv; +obsolete(char **argv) { - unsigned int len; + size_t len; char **p, *ap, *t; while ((ap = *++argv) != NULL) { @@ -588,8 +573,8 @@ jbad: errx(1, "illegal option -- %s", ap); if (ap[2] != '\0') break; for (p = argv + 2; *p; ++p) { - if (p[0][0] == '0' || (p[0][0] != '1' && - p[0][0] != '2' || p[0][1] != '.')) + if (p[0][0] == '0' || ((p[0][0] != '1' && + p[0][0] != '2') || p[0][1] != '.')) break; len = strlen(*p); if (len - 2 != strspn(*p + 2, "0123456789")) @@ -608,7 +593,7 @@ jbad: errx(1, "illegal option -- %s", ap); } void -usage() +usage(void) { (void)fprintf(stderr, "%s %s\n%s\n", "usage: join [-a fileno | -v fileno ] [-e string] [-1 field]", diff --git a/usr.bin/last/last.c b/usr.bin/last/last.c index b3325ccf4128..221f6db63095 100644 --- a/usr.bin/last/last.c +++ b/usr.bin/last/last.c @@ -119,9 +119,7 @@ usage(void) } int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int ch; char *p; @@ -198,7 +196,7 @@ main(argc, argv) * read through the wtmp file */ void -wtmp() +wtmp(void) { struct utmp *bp; /* current structure */ struct stat stb; /* stat of file for size */ @@ -237,8 +235,7 @@ wtmp() * process a single wtmp entry */ void -doentry(bp) - struct utmp *bp; +doentry(struct utmp *bp) { struct ttytab *tt, *ttx; /* ttylist entry */ @@ -325,9 +322,7 @@ doentry(bp) * logout type (crash/shutdown) as appropriate. */ void -printentry(bp, tt) - struct utmp *bp; - struct ttytab *tt; +printentry(struct utmp *bp, struct ttytab *tt) { char ct[80]; struct tm *tm; @@ -378,8 +373,7 @@ printentry(bp, tt) * see if want this entry */ int -want(bp) - struct utmp *bp; +want(struct utmp *bp) { ARG *step; @@ -412,9 +406,7 @@ want(bp) * add an entry to a linked list of arguments */ void -addarg(type, arg) - int type; - char *arg; +addarg(int type, char *arg) { ARG *cur; @@ -433,8 +425,7 @@ addarg(type, arg) * off the domain suffix since that's what login(1) does. */ void -hostconv(arg) - char *arg; +hostconv(char *arg) { static int first = 1; static char *hostdot, name[MAXHOSTNAMELEN]; @@ -457,8 +448,7 @@ hostconv(arg) * convert tty to correct name. */ char * -ttyconv(arg) - char *arg; +ttyconv(char *arg) { char *mval; @@ -490,8 +480,7 @@ ttyconv(arg) * Derived from atime_arg1() in usr.bin/touch/touch.c */ time_t -dateconv(arg) - char *arg; +dateconv(char *arg) { time_t timet; struct tm *t; @@ -562,8 +551,7 @@ terr: errx(1, * on interrupt, we inform the user how far we've gotten */ void -onintr(signo) - int signo; +onintr(int signo) { char ct[80]; struct tm *tm; diff --git a/usr.bin/lastcomm/lastcomm.c b/usr.bin/lastcomm/lastcomm.c index 5583b995b395..dc47eb1bfee6 100644 --- a/usr.bin/lastcomm/lastcomm.c +++ b/usr.bin/lastcomm/lastcomm.c @@ -77,9 +77,7 @@ static void usage(void); #define AC_HZ ((double)AHZ) int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { char *p; struct acct ab; @@ -222,8 +220,7 @@ main(argc, argv) } time_t -expand(t) - u_int t; +expand(u_int t) { time_t nt; @@ -237,8 +234,7 @@ expand(t) } char * -flagbits(f) - int f; +flagbits(int f) { static char flags[20] = "-"; char *p; @@ -256,9 +252,7 @@ flagbits(f) } int -requested(argv, acp) - char *argv[]; - struct acct *acp; +requested(char *argv[], struct acct *acp) { const char *p; @@ -275,8 +269,7 @@ requested(argv, acp) } const char * -getdev(dev) - dev_t dev; +getdev(dev_t dev) { static dev_t lastdev = (dev_t)-1; static const char *lastname; @@ -291,7 +284,7 @@ getdev(dev) } static void -usage() +usage(void) { (void)fprintf(stderr, "usage: lastcomm [-EScesu] [ -f file ] [command ...] [user ...] [tty ...]\n"); diff --git a/usr.bin/leave/leave.c b/usr.bin/leave/leave.c index 6931582aed55..89c3f5285716 100644 --- a/usr.bin/leave/leave.c +++ b/usr.bin/leave/leave.c @@ -64,13 +64,11 @@ static void usage(void); * It nags you like a mother hen. */ int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { - register u_int secs; - register int hours, minutes; - register char c, *cp = NULL; + u_int secs; + int hours, minutes; + char c, *cp = NULL; struct tm *t; time_t now; int plusnow, t_12_hour; @@ -139,10 +137,9 @@ main(argc, argv) } void -doalarm(secs) - u_int secs; +doalarm(u_int secs) { - register int bother; + int bother; time_t daytime; char tb[80]; int pid; @@ -192,7 +189,7 @@ doalarm(secs) } static void -usage() +usage(void) { fprintf(stderr, "usage: leave [[+]hhmm]\n"); exit(1); diff --git a/usr.bin/lock/lock.c b/usr.bin/lock/lock.c index 17f73128fd64..aa6af6af95d9 100644 --- a/usr.bin/lock/lock.c +++ b/usr.bin/lock/lock.c @@ -88,9 +88,7 @@ int vtyunlock; /* Unlock flag and code. */ /*ARGSUSED*/ int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { struct passwd *pw; struct timeval timval; @@ -242,7 +240,7 @@ main(argc, argv) static void -usage() +usage(void) { (void)fprintf(stderr, "usage: lock [-npv] [-t timeout]\n"); exit(1); diff --git a/usr.bin/logger/logger.c b/usr.bin/logger/logger.c index 25692af13339..3832752528b7 100644 --- a/usr.bin/logger/logger.c +++ b/usr.bin/logger/logger.c @@ -85,9 +85,7 @@ int send_to_all = 0; /* send message to all IPv4/IPv6 addresses */ * log. */ int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int ch, logflags, pri; char *tag, *host, buf[1024]; @@ -142,7 +140,7 @@ main(argc, argv) /* log input line if appropriate */ if (argc > 0) { - register char *p, *endp; + char *p, *endp; size_t len; for (p = buf, endp = buf + sizeof(buf) - 2; *argv;) { @@ -240,8 +238,7 @@ logmessage(int pri, char *host, char *buf) * Decode a symbolic name to a numeric value */ int -pencode(s) - register char *s; +pencode(char *s) { char *save; int fac, lev; @@ -265,11 +262,9 @@ pencode(s) } int -decode(name, codetab) - char *name; - CODE *codetab; +decode(char *name, CODE *codetab) { - register CODE *c; + CODE *c; if (isdigit(*name)) return (atoi(name)); @@ -282,7 +277,7 @@ decode(name, codetab) } static void -usage() +usage(void) { (void)fprintf(stderr, "usage: %s\n", "logger [-46Ais] [-f file] [-h host] [-p pri] [-t tag] [message ...]" diff --git a/usr.bin/logname/logname.c b/usr.bin/logname/logname.c index ebbce4931836..05faf7612416 100644 --- a/usr.bin/logname/logname.c +++ b/usr.bin/logname/logname.c @@ -53,9 +53,7 @@ __FBSDID("$FreeBSD$"); void usage(void); int -main(argc, argv) - int argc; - char *argv[] __unused; +main(int argc, char *argv[] __unused) { char *p; @@ -68,7 +66,7 @@ main(argc, argv) } void -usage() +usage(void) { (void)fprintf(stderr, "usage: logname\n"); exit(1); diff --git a/usr.bin/look/look.c b/usr.bin/look/look.c index 402ec9f78d13..33a12955de1c 100644 --- a/usr.bin/look/look.c +++ b/usr.bin/look/look.c @@ -101,9 +101,7 @@ void print_from(unsigned char *, unsigned char *, unsigned char *); static void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { struct stat sb; int ch, fd, termchar, match; @@ -160,11 +158,10 @@ main(argc, argv) } int -look(string, front, back) - unsigned char *string, *front, *back; +look(unsigned char *string, unsigned char *front, unsigned char *back) { - register int ch; - register unsigned char *readp, *writep; + int ch; + unsigned char *readp, *writep; /* Reformat string string to avoid doing it multiple times later. */ for (readp = writep = string; (ch = *readp++);) { @@ -228,10 +225,9 @@ look(string, front, back) while (p < back && *p++ != '\n'); char * -binary_search(string, front, back) - register unsigned char *string, *front, *back; +binary_search(unsigned char *string, unsigned char *front, unsigned char *back) { - register unsigned char *p; + unsigned char *p; p = front + (back - front) / 2; SKIP_PAST_NEWLINE(p, back); @@ -263,8 +259,7 @@ binary_search(string, front, back) * o front is before or at the first line to be printed. */ char * -linear_search(string, front, back) - unsigned char *string, *front, *back; +linear_search(unsigned char *string, unsigned char *front, unsigned char *back) { while (front < back) { switch (compare(string, front, back)) { @@ -286,8 +281,7 @@ linear_search(string, front, back) * Print as many lines as match string, starting at front. */ void -print_from(string, front, back) - register unsigned char *string, *front, *back; +print_from(unsigned char *string, unsigned char *front, unsigned char *back) { for (; front < back && compare(string, front, back) == EQUAL; ++front) { for (; front < back && *front != '\n'; ++front) @@ -312,10 +306,9 @@ print_from(string, front, back) * "back" terminated). */ int -compare(s1, s2, back) - register unsigned char *s1, *s2, *back; +compare(unsigned char *s1, unsigned char *s2, unsigned char *back) { - register int ch; + int ch; for (; *s1 && s2 < back && *s2 != '\n'; ++s1, ++s2) { ch = *s2; @@ -335,7 +328,7 @@ compare(s1, s2, back) } static void -usage() +usage(void) { (void)fprintf(stderr, "usage: look [-df] [-t char] string [file ...]\n"); exit(2); diff --git a/usr.bin/makewhatis/makewhatis.c b/usr.bin/makewhatis/makewhatis.c index 0ac4fc1ec999..30f2da8d0ba7 100644 --- a/usr.bin/makewhatis/makewhatis.c +++ b/usr.bin/makewhatis/makewhatis.c @@ -98,7 +98,7 @@ static const char *whatis_name="whatis";/* -n option: the name */ static char *common_output; /* -o option: the single output file */ static char *locale; /* user's locale if -L is used */ static char *lang_locale; /* short form of locale */ -static char *machine; +static const char *machine; static int exit_code; /* exit code to use when finished */ static SLIST_HEAD(, visited_dir) visited_dirs = @@ -358,7 +358,7 @@ open_output(char *name) static int linesort(const void *a, const void *b) { - return strcmp((const char *)(*(const char **)a), (const char *)(*(const char **)b)); + return strcmp((*(const char * const *)a), (*(const char * const *)b)); } /* @@ -810,8 +810,8 @@ process_page(struct page_info *page, char *section_dir) static int pagesort(const void *a, const void *b) { - struct page_info *p1 = *(struct page_info **) a; - struct page_info *p2 = *(struct page_info **) b; + const struct page_info *p1 = *(struct page_info * const *) a; + const struct page_info *p2 = *(struct page_info * const *) b; if (p1->inode == p2->inode) return strcmp(p1->name, p2->name); return p1->inode - p2->inode; @@ -964,8 +964,6 @@ int main(int argc, char **argv) { int opt; - extern int optind; - extern char *optarg; FILE *fp = NULL; while ((opt = getopt(argc, argv, "ai:n:o:vL")) != -1) { diff --git a/usr.bin/mesg/mesg.c b/usr.bin/mesg/mesg.c index 6c4a1e280887..8b39ec7b3db9 100644 --- a/usr.bin/mesg/mesg.c +++ b/usr.bin/mesg/mesg.c @@ -62,9 +62,7 @@ __FBSDID("$FreeBSD$"); static void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { struct stat sb; char *tty; @@ -111,7 +109,7 @@ main(argc, argv) } static void -usage() +usage(void) { (void)fprintf(stderr, "usage: mesg [y | n]\n"); exit(2); diff --git a/usr.bin/mkfifo/mkfifo.c b/usr.bin/mkfifo/mkfifo.c index e2aa1cd11591..85cd6e145ac9 100644 --- a/usr.bin/mkfifo/mkfifo.c +++ b/usr.bin/mkfifo/mkfifo.c @@ -63,9 +63,7 @@ static void usage(void); static int f_mode; int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { char *modestr; void *modep; @@ -109,7 +107,7 @@ main(argc, argv) } static void -usage() +usage(void) { (void)fprintf(stderr, "usage: mkfifo [-m mode] fifo_name ...\n"); exit(1); diff --git a/usr.bin/msgs/msgs.c b/usr.bin/msgs/msgs.c index d1d3bd426f5f..044fccc51d88 100644 --- a/usr.bin/msgs/msgs.c +++ b/usr.bin/msgs/msgs.c @@ -162,8 +162,7 @@ void prmesg(int); static void usage(void); int -main(argc, argv) -int argc; char *argv[]; +main(int argc, char *argv[]) { bool newrc, already; int rcfirst = 0; /* first message to print (from .rc) */ @@ -287,8 +286,8 @@ int argc; char *argv[]; lastmsg = 0; for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)){ - register char *cp = dp->d_name; - register int i = 0; + char *cp = dp->d_name; + int i = 0; if (dp->d_ino == 0) continue; @@ -622,15 +621,14 @@ int argc; char *argv[]; } static void -usage() +usage(void) { fprintf(stderr, "usage: msgs [fhlopq] [[-]number]\n"); exit(1); } void -prmesg(length) -int length; +prmesg(int length) { FILE *outf; char *env_pager; @@ -677,8 +675,7 @@ int length; } void -onintr(unused) - int unused __unused; +onintr(int unused __unused) { signal(SIGINT, onintr); if (mailing) @@ -703,8 +700,7 @@ onintr(unused) * We have just gotten a susp. Suspend and prepare to resume. */ void -onsusp(unused) - int unused __unused; +onsusp(int unused __unused) { signal(SIGTSTP, SIG_DFL); sigsetmask(0); @@ -715,8 +711,7 @@ onsusp(unused) } int -linecnt(f) -FILE *f; +linecnt(FILE *f) { off_t oldpos = ftello(f); int l = 0; @@ -730,8 +725,7 @@ FILE *f; } int -next(buf) -char *buf; +next(char *buf) { int i; sscanf(buf, "%d", &i); @@ -740,8 +734,7 @@ char *buf; } void -ask(prompt) -const char *prompt; +ask(const char *prompt) { char inch; int n, cmsg, fd; @@ -827,8 +820,7 @@ const char *prompt; } void -gfrsub(infile) -FILE *infile; +gfrsub(FILE *infile) { off_t frompos; int count; @@ -908,8 +900,7 @@ FILE *infile; } char * -nxtfld(s) -unsigned char *s; +nxtfld(unsigned char *s) { if (*s) while (*s && !isspace(*s)) s++; /* skip over this field */ if (*s) while (*s && isspace(*s)) s++; /* find start of next field */ diff --git a/usr.bin/ncplogin/ncplogin.c b/usr.bin/ncplogin/ncplogin.c index 2a0dd8f56f0f..7bc2f66267ad 100644 --- a/usr.bin/ncplogin/ncplogin.c +++ b/usr.bin/ncplogin/ncplogin.c @@ -41,7 +41,9 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include +#include +#include #include #include diff --git a/usr.bin/nice/nice.c b/usr.bin/nice/nice.c index 527e3f0689b8..93f6a98213a6 100644 --- a/usr.bin/nice/nice.c +++ b/usr.bin/nice/nice.c @@ -64,9 +64,7 @@ __FBSDID("$FreeBSD$"); void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { long niceness = DEFNICE; int ch; @@ -108,7 +106,7 @@ main(argc, argv) } void -usage() +usage(void) { (void)fprintf(stderr, "usage: nice [-n incr] utility [arguments]\n"); diff --git a/usr.bin/pr/extern.h b/usr.bin/pr/extern.h index 93efa652dbb3..da552c03e8e8 100644 --- a/usr.bin/pr/extern.h +++ b/usr.bin/pr/extern.h @@ -49,11 +49,11 @@ int inln(FILE *, char *, int, int *, int, int *); int inskip(FILE *, int, int); void mfail(void); int mulfile(int, char **); -FILE *nxtfile(int, char **, char **, char *, int); +FILE *nxtfile(int, char **, const char **, char *, int); int onecol(int, char **); int otln(char *, int, int *, int *, int); void pfail(void); -int prhead(char *, char *, int); +int prhead(char *, const char *, int); int prtail(int, int); int setup(int, char **); void terminate(int); diff --git a/usr.bin/pr/pr.c b/usr.bin/pr/pr.c index 169b6c9128c9..bef76c528313 100644 --- a/usr.bin/pr/pr.c +++ b/usr.bin/pr/pr.c @@ -103,7 +103,7 @@ char schar; /* text column separation character */ int sflag; /* -s option for multiple columns */ int nohead; /* do not write head and trailer */ int pgwd; /* page width with multiple col output */ -char *timefrmt; /* time conversion string */ +const char *timefrmt; /* time conversion string */ /* * misc globals @@ -187,7 +187,7 @@ onecol(int argc, char *argv[]) char *hbuf; char *ohbuf; FILE *inf; - char *fname; + const char *fname; int mor; if (nmwd) @@ -339,7 +339,7 @@ vertcol(int argc, char *argv[]) char *buf; char *hbuf; char *ohbuf; - char *fname; + const char *fname; FILE *inf; int ips = 0; int cps = 0; @@ -649,7 +649,7 @@ horzcol(int argc, char *argv[]) char *buf; char *hbuf; char *ohbuf; - char *fname; + const char *fname; FILE *inf; int ips = 0; int cps = 0; @@ -795,7 +795,7 @@ mulfile(int argc, char *argv[]) char *buf; char *hbuf; char *ohbuf; - char *fname; + const char *fname; int ips = 0; int cps = 0; int ops = 0; @@ -1262,7 +1262,7 @@ inskip(FILE *inf, int pgcnt, int lncnt) * dt if set skips the date processing (used with -m) */ FILE * -nxtfile(int argc, char *argv[], char **fname, char *buf, int dt) +nxtfile(int argc, char **argv, const char **fname, char *buf, int dt) { FILE *inf = NULL; struct timeval tv; @@ -1423,7 +1423,7 @@ addnum(char *buf, int wdth, int line) * pagcnt page number */ int -prhead(char *buf, char *fname, int pagcnt) +prhead(char *buf, const char *fname, int pagcnt) { int ips = 0; int ops = 0; diff --git a/usr.bin/printenv/printenv.c b/usr.bin/printenv/printenv.c index 5d5bebf1deb4..8ad23c7454da 100644 --- a/usr.bin/printenv/printenv.c +++ b/usr.bin/printenv/printenv.c @@ -62,13 +62,11 @@ void usage(void); * February, 1979 */ int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { extern char **environ; - register char *cp, **ep; - register size_t len; + char *cp, **ep; + size_t len; int ch; while ((ch = getopt(argc, argv, "")) != -1) @@ -98,7 +96,7 @@ main(argc, argv) } void -usage() +usage(void) { (void)fprintf(stderr, "usage: printenv [name]\n"); exit(1); diff --git a/usr.bin/printf/printf.c b/usr.bin/printf/printf.c index a63d6cd21efe..cc32e4f7c371 100644 --- a/usr.bin/printf/printf.c +++ b/usr.bin/printf/printf.c @@ -103,12 +103,10 @@ static char **gargv; int #ifdef BUILTIN -progprintf(argc, argv) +progprintf(int argc, char *argv[]) #else -main(argc, argv) +main(int argc, char *argv[]) #endif - int argc; - char *argv[]; { static const char *skip1, *skip2; int ch, chopped, end, fieldwidth, haveprec, havewidth, precision, rval; @@ -292,9 +290,7 @@ next: for (start = fmt;; ++fmt) { } static char * -mkquad(str, ch) - char *str; - int ch; +mkquad(char *str, int ch) { static char *copy; static size_t copy_size; @@ -325,12 +321,10 @@ mkquad(str, ch) } static int -escape(fmt, percent) - register char *fmt; - int percent; +escape(char *fmt, int percent) { - register char *store; - register int value, c; + char *store; + int value, c; for (store = fmt; (c = *fmt); ++fmt, ++store) { if (c != '\\') { @@ -395,7 +389,7 @@ escape(fmt, percent) } static int -getchr() +getchr(void) { if (!*gargv) return ('\0'); @@ -403,7 +397,7 @@ getchr() } static const char * -getstr() +getstr(void) { if (!*gargv) return (""); @@ -411,8 +405,7 @@ getstr() } static int -getint(ip) - int *ip; +getint(int *ip) { quad_t val; u_quad_t uval; @@ -430,10 +423,7 @@ getint(ip) } static int -getquads(qp, uqp, signedconv) - quad_t *qp; - u_quad_t *uqp; - int signedconv; +getquads(quad_t *qp, u_quad_t *uqp, int signedconv) { char *ep; int rval; @@ -472,8 +462,7 @@ getquads(qp, uqp, signedconv) } static int -getdouble(dp) - double *dp; +getdouble(double *dp) { char *ep; int rval; @@ -503,9 +492,9 @@ getdouble(dp) } static int -asciicode() +asciicode(void) { - register int ch; + int ch; ch = **gargv; if (ch == '\'' || ch == '"') @@ -515,7 +504,7 @@ asciicode() } static void -usage() +usage(void) { (void)fprintf(stderr, "usage: printf format [arg ...]\n"); } diff --git a/usr.bin/rev/rev.c b/usr.bin/rev/rev.c index 86d7276442f4..6a48d5e7e35e 100644 --- a/usr.bin/rev/rev.c +++ b/usr.bin/rev/rev.c @@ -58,9 +58,7 @@ __FBSDID("$FreeBSD$"); void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { const char *filename, *p, *t; FILE *fp; @@ -108,7 +106,7 @@ main(argc, argv) } void -usage() +usage(void) { (void)fprintf(stderr, "usage: rev [file ...]\n"); exit(1); diff --git a/usr.bin/rwall/rwall.c b/usr.bin/rwall/rwall.c index ea5f77e5b7ca..861c8cffaa62 100644 --- a/usr.bin/rwall/rwall.c +++ b/usr.bin/rwall/rwall.c @@ -177,7 +177,7 @@ makemsg(const char *fname) mbuf = malloc(mbufsize); if (mbuf == NULL) err(1, "out of memory"); - if (fread(mbuf, sizeof(*mbuf), mbufsize, fp) != mbufsize) + if (fread(mbuf, sizeof(*mbuf), mbufsize, fp) != (u_int)mbufsize) err(1, "can't read temporary file"); close(fd); } diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c index c58923980372..25c5bdc2c2f5 100644 --- a/usr.bin/script/script.c +++ b/usr.bin/script/script.c @@ -79,9 +79,7 @@ void finish(void); static void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int cc; struct termios rtt, stt; @@ -199,7 +197,7 @@ main(argc, argv) } static void -usage() +usage(void) { (void)fprintf(stderr, "usage: script [-a] [-q] [-k] [-t time] [file] [command]\n"); @@ -207,7 +205,7 @@ usage() } void -finish() +finish(void) { pid_t pid; int die, e, status; @@ -229,8 +227,7 @@ finish() } void -doshell(av) - char **av; +doshell(char **av) { const char *shell; @@ -252,15 +249,14 @@ doshell(av) } void -fail() +fail(void) { (void)kill(0, SIGTERM); done(1); } void -done(eno) - int eno; +done(int eno) { time_t tvec; diff --git a/usr.bin/soelim/soelim.c b/usr.bin/soelim/soelim.c index d25520cfa09f..d930fd94df31 100644 --- a/usr.bin/soelim/soelim.c +++ b/usr.bin/soelim/soelim.c @@ -70,9 +70,7 @@ static const char rcsid[] = int process(const char *); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { argc--; @@ -90,11 +88,10 @@ main(argc, argv) } int -process(file) - const char *file; +process(const char *file) { - register char *cp; - register int c; + char *cp; + int c; char fname[BUFSIZ]; FILE *soee; int isfile; diff --git a/usr.bin/tee/tee.c b/usr.bin/tee/tee.c index 5ac05db7ba8d..123a2de69ab5 100644 --- a/usr.bin/tee/tee.c +++ b/usr.bin/tee/tee.c @@ -66,13 +66,11 @@ void add(int, const char *); static void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { - register LIST *p; - register int n, fd, rval, wval; - register char *bp; + LIST *p; + int n, fd, rval, wval; + char *bp; int append, ch, exitval; char *buf; #define BSIZE (8 * 1024) @@ -125,16 +123,14 @@ main(argc, argv) } static void -usage() +usage(void) { (void)fprintf(stderr, "usage: tee [-ai] [file ...]\n"); exit(1); } void -add(fd, name) - int fd; - const char *name; +add(int fd, const char *name) { LIST *p; diff --git a/usr.bin/time/time.c b/usr.bin/time/time.c index 88178a390fa6..c7a248629a25 100644 --- a/usr.bin/time/time.c +++ b/usr.bin/time/time.c @@ -68,11 +68,9 @@ static void usage(void); static char decimal_point; int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { - register int pid; + int pid; int aflag, ch, hflag, lflag, status, pflag; struct timeval before, after; struct rusage ru; @@ -223,7 +221,7 @@ main(argc, argv) } static void -usage() +usage(void) { fprintf(stderr, "usage: time [-al] [-h|-p] [-o file] utility [argument ...]\n"); @@ -234,7 +232,7 @@ usage() * Return the frequency of the kernel's statistics clock. */ static int -getstathz() +getstathz(void) { struct clockinfo clockrate; int mib[2]; @@ -249,10 +247,7 @@ getstathz() } static void -humantime(out, sec, usec) - FILE *out; - long sec; - long usec; +humantime(FILE *out, long sec, long usec) { long days, hrs, mins; diff --git a/usr.bin/touch/touch.c b/usr.bin/touch/touch.c index 26ccf0e0271b..30d22ed35b99 100644 --- a/usr.bin/touch/touch.c +++ b/usr.bin/touch/touch.c @@ -65,9 +65,7 @@ void stime_file(char *, struct timeval *); void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { struct stat sb; struct timeval tv[2]; @@ -197,9 +195,7 @@ main(argc, argv) #define ATOI2(ar) ((ar)[0] - '0') * 10 + ((ar)[1] - '0'); (ar) += 2; void -stime_arg1(arg, tvp) - char *arg; - struct timeval *tvp; +stime_arg1(char *arg, struct timeval *tvp) { time_t now; struct tm *t; @@ -260,10 +256,7 @@ terr: errx(1, } void -stime_arg2(arg, year, tvp) - char *arg; - int year; - struct timeval *tvp; +stime_arg2(char *arg, int year, struct timeval *tvp) { time_t now; struct tm *t; @@ -293,9 +286,7 @@ stime_arg2(arg, year, tvp) } void -stime_file(fname, tvp) - char *fname; - struct timeval *tvp; +stime_file(char *fname, struct timeval *tvp) { struct stat sb; @@ -306,10 +297,7 @@ stime_file(fname, tvp) } int -rw(fname, sbp, force) - char *fname; - struct stat *sbp; - int force; +rw(char *fname, struct stat *sbp, int force) { int fd, needed_chmod, rval; u_char byte; @@ -358,7 +346,7 @@ err: rval = 1; } void -usage() +usage(void) { (void)fprintf(stderr, "usage: touch [-acfhm] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file ...\n"); exit(1); diff --git a/usr.bin/tput/tput.c b/usr.bin/tput/tput.c index 99bb90325fff..a74e36af8d34 100644 --- a/usr.bin/tput/tput.c +++ b/usr.bin/tput/tput.c @@ -62,9 +62,7 @@ static void usage(void); static char **process(const char *, char *, char **); int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { int ch, exitval, n; char *cptr, *term, buf[1024], tbuf[1024]; @@ -120,8 +118,7 @@ errx(2, "no terminal type specified and no TERM environmental variable."); } static void -prlongname(buf) - char *buf; +prlongname(char *buf) { int savech; char *p, *savep; @@ -134,9 +131,7 @@ prlongname(buf) } static char ** -process(cap, str, argv) - const char *cap; - char *str, **argv; +process(const char *cap, char *str, char **argv) { static const char errfew[] = "not enough arguments (%d) for capability `%s'"; @@ -211,7 +206,7 @@ process(cap, str, argv) } static void -usage() +usage(void) { (void)fprintf(stderr, "usage: tput [-T term] attribute ...\n"); exit(2); diff --git a/usr.bin/tr/tr.c b/usr.bin/tr/tr.c index 1fb5fd261134..407b4f439e61 100644 --- a/usr.bin/tr/tr.c +++ b/usr.bin/tr/tr.c @@ -106,9 +106,7 @@ static void setup(int *, char *, STR *, int, int); static void usage(void); int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { static int collorder[NCHARS], tmpmap[NCHARS]; int ch, cnt, lastch, *p; @@ -280,12 +278,7 @@ main(argc, argv) } static void -setup(string, arg, str, cflag, Cflag) - int *string; - char *arg; - STR *str; - int cflag; - int Cflag; +setup(int *string, char *arg, STR *str, int cflag, int Cflag) { int cnt, *p; @@ -313,7 +306,7 @@ charcoll(const void *a, const void *b) } static void -usage() +usage(void) { (void)fprintf(stderr, "%s\n%s\n%s\n%s\n", "usage: tr [-Ccsu] string1 string2", diff --git a/usr.bin/tset/tset.c b/usr.bin/tset/tset.c index 5d3891ec674e..dc4c333e2f90 100644 --- a/usr.bin/tset/tset.c +++ b/usr.bin/tset/tset.c @@ -72,9 +72,7 @@ int Lines, Columns; /* window size */ speed_t Ospeed; int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { #ifdef TIOCGWINSZ struct winsize win; @@ -242,10 +240,7 @@ main(argc, argv) * Tell the user if a control key has been changed from the default value. */ void -report(name, which, def) - const char *name; - int which; - u_int def; +report(const char *name, int which, u_int def) { u_int old, new; @@ -273,8 +268,7 @@ report(name, which, def) * This means that -e, -i and -k get default arguments supplied for them. */ void -obsolete(argv) - char *argv[]; +obsolete(char *argv[]) { for (; *argv; ++argv) { if (argv[0][0] != '-' || (argv[1] && argv[1][0] != '-') || @@ -296,7 +290,7 @@ obsolete(argv) } void -usage() +usage(void) { (void)fprintf(stderr, "%s\n%s\n", "usage: tset [-IQrSs] [-] [-e ch] [-i ch] [-k ch] [-m mapping] [terminal]", diff --git a/usr.bin/tsort/tsort.c b/usr.bin/tsort/tsort.c index 1c71b40fd3e6..ce35207f436a 100644 --- a/usr.bin/tsort/tsort.c +++ b/usr.bin/tsort/tsort.c @@ -113,12 +113,10 @@ void tsort(void); void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { - register BUF *b; - register int c, n; + BUF *b; + int c, n; FILE *fp; int bsize, ch, nused; BUF bufs[2]; @@ -190,9 +188,7 @@ main(argc, argv) /* double the size of oldbuf and return a pointer to the new buffer. */ void * -grow_buf(bp, size) - void *bp; - size_t size; +grow_buf(void *bp, size_t size) { if ((bp = realloc(bp, size)) == NULL) err(1, NULL); @@ -204,10 +200,9 @@ grow_buf(bp, size) * the graph, then add them. */ void -add_arc(s1, s2) - char *s1, *s2; +add_arc(char *s1, char *s2) { - register NODE *n1; + NODE *n1; NODE *n2; int bsize, i; @@ -240,8 +235,7 @@ add_arc(s1, s2) /* Find a node in the graph (insert if not found) and return a pointer to it. */ NODE * -get_node(name) - char *name; +get_node(char *name) { DBT data, key; NODE *n; @@ -293,7 +287,7 @@ get_node(name) * Clear the NODEST flag from all nodes. */ void -clear_cycle() +clear_cycle(void) { NODE *n; @@ -303,10 +297,10 @@ clear_cycle() /* do topological sort on graph */ void -tsort() +tsort(void) { - register NODE *n, *next; - register int cnt, i; + NODE *n, *next; + int cnt, i; while (graph != NULL) { /* @@ -366,11 +360,10 @@ tsort() /* print node and remove from graph (does not actually free node) */ void -remove_node(n) - register NODE *n; +remove_node(NODE *n) { - register NODE **np; - register int i; + NODE **np; + int i; (void)printf("%s\n", n->n_name); for (np = n->n_arcs, i = n->n_narcs; --i >= 0; np++) @@ -384,12 +377,10 @@ remove_node(n) /* look for the longest? cycle from node from to node to. */ int -find_cycle(from, to, longest_len, depth) - NODE *from, *to; - int depth, longest_len; +find_cycle(NODE *from, NODE *to, int longest_len, int depth) { - register NODE **np; - register int i, len; + NODE **np; + int i, len; /* * avoid infinite loops and ignore portions of the graph known @@ -432,7 +423,7 @@ find_cycle(from, to, longest_len, depth) } void -usage() +usage(void) { (void)fprintf(stderr, "usage: tsort [-dlq] [file]\n"); exit(1); diff --git a/usr.bin/ul/ul.c b/usr.bin/ul/ul.c index c4ffccf96085..de779b1c9b69 100644 --- a/usr.bin/ul/ul.c +++ b/usr.bin/ul/ul.c @@ -101,9 +101,7 @@ void outc(int); #define PRINT(s) if (s == NULL) /* void */; else tputs(s, 1, outchar) int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { int c; const char *termtype; @@ -159,15 +157,14 @@ main(argc, argv) } static void -usage() +usage(void) { fprintf(stderr, "usage: ul [-i] [-t terminal] file...\n"); exit(1); } void -filter(f) - FILE *f; +filter(FILE *f) { int c; @@ -277,7 +274,7 @@ filter(f) } void -flushln() +flushln(void) { int lastmode; int i; @@ -317,11 +314,11 @@ flushln() * We don't do anything with halfline ups and downs, or Greek. */ void -overstrike() +overstrike(void) { - register int i; + int i; char lbuf[256]; - register char *cp = lbuf; + char *cp = lbuf; int hadbold=0; /* Set up overstrike buffer */ @@ -355,11 +352,11 @@ overstrike() } void -iattr() +iattr(void) { - register int i; + int i; char lbuf[256]; - register char *cp = lbuf; + char *cp = lbuf; for (i=0; i int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { if (argc > 1) for(;;)