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
This commit is contained in:
dwmalone 2002-09-04 23:29:10 +00:00
parent 9878f0eb0e
commit e3e153e6ce
75 changed files with 423 additions and 751 deletions

View File

@ -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");

View File

@ -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,

View File

@ -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");

View File

@ -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",

View File

@ -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) {

View File

@ -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 ...]",

View File

@ -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;

6
usr.bin/env/env.c vendored
View File

@ -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");

View File

@ -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);

View File

@ -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 *);

View File

@ -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;

View File

@ -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 @@ 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;

View File

@ -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;

View File

@ -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 @@ sflag_print()
}
static void
stimeprint(w)
WHERE *w;
stimeprint(WHERE *w)
{
struct tm *delta;

View File

@ -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];

View File

@ -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)

View File

@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
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))

View File

@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
#include <sys/user.h>
#include <sys/sysctl.h>
#include <arpa/inet.h>
#include <machine/elf.h>
#include <machine/vmparam.h>
@ -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;

View File

@ -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);

View File

@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
#include <sys/user.h>
#include <sys/sysctl.h>
#include <arpa/inet.h>
#include <machine/elf.h>
#include <machine/vmparam.h>
@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -6,9 +6,7 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
int c;
int status = 0;

View File

@ -30,9 +30,7 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
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;

View File

@ -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",

View File

@ -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) {

View File

@ -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, "");

View File

@ -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 */

View File

@ -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]",

View File

@ -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;

View File

@ -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);
}

View File

@ -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)

View File

@ -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;

View File

@ -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]",

View File

@ -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;

View File

@ -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");

View File

@ -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);

View File

@ -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);

View File

@ -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 ...]"

View File

@ -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);

View File

@ -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);

View File

@ -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) {

View File

@ -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);

View File

@ -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);

View File

@ -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 */

View File

@ -41,7 +41,9 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <sysexits.h>
#include <unistd.h>

View File

@ -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");

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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");
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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",

View File

@ -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]",

View File

@ -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);

View File

@ -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<maxcol; i++)
switch (obuf[i].c_mode) {
@ -379,7 +376,7 @@ iattr()
}
void
initbuf()
initbuf(void)
{
bzero((char *)obuf, sizeof (obuf)); /* depends on NORMAL == 0 */
@ -389,7 +386,7 @@ initbuf()
}
void
fwd()
fwd(void)
{
int oldcol, oldmax;
@ -401,7 +398,7 @@ fwd()
}
void
reverse()
reverse(void)
{
upln++;
fwd();
@ -411,7 +408,7 @@ reverse()
}
void
initcap()
initcap(void)
{
static char tcapbuf[512];
char *bp = tcapbuf;
@ -464,8 +461,7 @@ initcap()
}
int
outchar(c)
int c;
outchar(int c)
{
return(putchar(c & 0177));
}
@ -473,8 +469,7 @@ outchar(c)
static int curmode = 0;
void
outc(c)
int c;
outc(int c)
{
putchar(c);
if (must_use_uc && (curmode&UNDERL)) {
@ -484,8 +479,7 @@ outc(c)
}
void
setnewmode(newmode)
int newmode;
setnewmode(int newmode)
{
if (!iflag) {
if (curmode != NORMAL && newmode != NORMAL)

View File

@ -56,9 +56,7 @@ static const char sccsid[] = "@(#)uname.c 8.2 (Berkeley) 5/4/95";
void usage(void);
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
#define MFLAG 0x01
#define NFLAG 0x02
@ -174,7 +172,7 @@ main(argc, argv)
}
void
usage()
usage(void)
{
(void)fprintf(stderr, "usage: uname [-amnprsv]\n");
exit(1);

View File

@ -66,9 +66,7 @@ static void usage(void);
static void tabify(void);
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
int ch, failed;
char *filename;
@ -110,14 +108,14 @@ main(argc, argv)
}
static void
usage()
usage(void)
{
fprintf(stderr, "usage: unexpand [-a] [-t tablist] [file ...]\n");
exit(1);
}
static void
tabify()
tabify(void)
{
int ch, dcol, doneline, limit, n, ocol;
@ -199,8 +197,7 @@ tabify()
}
static void
getstops(cp)
const char *cp;
getstops(const char *cp)
{
int i;

View File

@ -71,11 +71,9 @@ static void usage(void);
int stricoll(char *, char*);
int
main (argc, argv)
int argc;
char *argv[];
main (int argc, char *argv[])
{
register char *t1, *t2;
char *t1, *t2;
FILE *ifp, *ofp;
int ch;
char *prevline, *thisline, *p;
@ -199,9 +197,7 @@ getline(char *buf, size_t buflen, FILE *fp)
* of the line.
*/
void
show(ofp, str)
FILE *ofp;
char *str;
show(FILE *ofp, char *str)
{
if (cflag && *str)
@ -211,10 +207,9 @@ show(ofp, str)
}
char *
skip(str)
register char *str;
skip(char *str)
{
register int nchars, nfields;
int nchars, nfields;
for (nfields = 0; *str != '\0' && nfields++ != numfields; ) {
while (isblank((unsigned char)*str))
@ -227,8 +222,7 @@ skip(str)
}
FILE *
file(name, mode)
const char *name, *mode;
file(const char *name, const char *mode)
{
FILE *fp;
@ -238,8 +232,7 @@ file(name, mode)
}
void
obsolete(argv)
char *argv[];
obsolete(char *argv[])
{
int len;
char *ap, *p, *start;
@ -268,7 +261,7 @@ obsolete(argv)
}
static void
usage()
usage(void)
{
(void)fprintf(stderr,
"usage: uniq [-c | -d | -u] [-i] [-f fields] [-s chars] [input [output]]\n");
@ -276,8 +269,7 @@ usage()
}
int
stricoll(s1, s2)
char *s1, *s2;
stricoll(char *s1, char *s2)
{
char *p, line1[MAXLINELEN], line2[MAXLINELEN];

View File

@ -55,9 +55,7 @@ void process(FILE *, const char *);
static void usage(void);
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
FILE *fp;
int ch;
@ -85,18 +83,16 @@ main(argc, argv)
}
static void
usage()
usage(void)
{
fprintf(stderr, "usage: unvis [file ...]\n");
exit(1);
}
void
process(fp, filename)
FILE *fp;
const char *filename;
process(FILE *fp, const char *filename)
{
register int offset = 0, c, ret;
int offset = 0, c, ret;
int state = 0;
char outc;

View File

@ -59,9 +59,7 @@ int scmp(const void *, const void *);
static void usage(void);
int
main(argc, argv)
int argc;
char **argv;
main(int argc, char **argv)
{
namebuf *names = NULL;
int ncnt = 0;
@ -107,15 +105,14 @@ main(argc, argv)
}
static void
usage()
usage(void)
{
(void)fprintf(stderr, "usage: users\n");
exit(1);
}
int
scmp(p, q)
const void *p, *q;
scmp(const void *p, const void *q)
{
return(strncmp(p, q, UT_NAMESIZE));
}

View File

@ -60,9 +60,7 @@ void process(FILE *);
static void usage(void);
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
FILE *fp;
int ch;
@ -129,7 +127,7 @@ main(argc, argv)
static void
usage()
usage(void)
{
#ifdef DEBUG
fprintf(stderr, "usage: vis [-cbflnostwd] [-F foldwidth] [file ...]\n");
@ -140,13 +138,12 @@ usage()
}
void
process(fp)
FILE *fp;
process(FILE *fp)
{
static int col = 0;
static char dummy[] = "\0";
register char *cp = dummy+1; /* so *(cp-1) starts out != '\n' */
register int c, rachar;
char *cp = dummy+1; /* so *(cp-1) starts out != '\n' */
int c, rachar;
char buff[5];
c = getc(fp);

View File

@ -60,9 +60,7 @@ static void usage(void);
* what
*/
int
main(argc, argv)
int argc;
char **argv;
main(int argc, char **argv)
{
int c;
@ -90,16 +88,16 @@ main(argc, argv)
}
static void
usage()
usage(void)
{
(void)fprintf(stderr, "usage: what [-s] [file ...]\n");
exit(1);
}
void
search()
search(void)
{
register int c;
int c;
while ((c = getchar()) != EOF) {
loop: if (c != '@')

View File

@ -74,11 +74,9 @@ void search_utmp(char *, char *, char *, uid_t);
int utmp_chk(char *, char *);
int
main(argc, argv)
int argc;
char **argv;
main(int argc, char **argv)
{
register char *cp;
char *cp;
time_t atime;
uid_t myuid;
int msgsok, myttyfd;
@ -136,7 +134,7 @@ main(argc, argv)
}
static void
usage()
usage(void)
{
(void)fprintf(stderr, "usage: write user [tty]\n");
exit(1);
@ -147,8 +145,7 @@ usage()
* the given tty
*/
int
utmp_chk(user, tty)
char *user, *tty;
utmp_chk(char *user, char *tty)
{
struct utmp u;
int ufd;
@ -179,9 +176,7 @@ utmp_chk(user, tty)
* writing from, unless that's the only terminal with messages enabled.
*/
void
search_utmp(user, tty, mytty, myuid)
char *user, *tty, *mytty;
uid_t myuid;
search_utmp(char *user, char *tty, char *mytty, uid_t myuid)
{
struct utmp u;
time_t bestatime, atime;
@ -233,10 +228,7 @@ search_utmp(user, tty, mytty, myuid)
* and the access time
*/
int
term_chk(tty, msgsokP, atimeP, showerror)
char *tty;
int *msgsokP, showerror;
time_t *atimeP;
term_chk(char *tty, int *msgsokP, time_t *atimeP, int showerror)
{
struct stat s;
char path[MAXPATHLEN];
@ -256,9 +248,7 @@ term_chk(tty, msgsokP, atimeP, showerror)
* do_write - actually make the connection
*/
void
do_write(tty, mytty, myuid)
char *tty, *mytty;
uid_t myuid;
do_write(char *tty, char *mytty, uid_t myuid)
{
const char *login;
char *nows;
@ -298,8 +288,7 @@ do_write(tty, mytty, myuid)
* done - cleanup and exit
*/
void
done(n)
int n __unused;
done(int n __unused)
{
(void)printf("EOF\r\n");
exit(0);
@ -310,8 +299,7 @@ done(n)
* turns \n into \r\n
*/
void
wr_fputs(s)
unsigned char *s;
wr_fputs(unsigned char *s)
{
#define PUTC(c) if (putchar(c) == EOF) err(1, NULL);

View File

@ -100,9 +100,7 @@ int trymmap(int);
void usage(void);
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
struct stat from_sb, to_sb;
mode_t *set;
@ -238,8 +236,7 @@ main(argc, argv)
}
u_long
numeric_id(name, type)
const char *name, *type;
numeric_id(const char *name, const char *type)
{
u_long val;
char *ep;
@ -262,10 +259,7 @@ numeric_id(name, type)
* build a path name and install the file
*/
void
install(from_name, to_name, fset, flags)
const char *from_name, *to_name;
u_long fset;
u_int flags;
install(const char *from_name, const char *to_name, u_long fset, u_int flags)
{
struct stat from_sb, temp_sb, to_sb;
struct utimbuf utb;
@ -575,10 +569,7 @@ compare(int from_fd, const char *from_name __unused, size_t from_len,
* create a temporary file based on path and open it
*/
int
create_tempfile(path, temp, tsize)
const char *path;
char *temp;
size_t tsize;
create_tempfile(const char *path, char *temp, size_t tsize)
{
char *p;
@ -598,10 +589,7 @@ create_tempfile(path, temp, tsize)
* create a new file, overwriting an existing one if necessary
*/
int
create_newfile(path, target, sbp)
const char *path;
int target;
struct stat *sbp;
create_newfile(const char *path, int target, struct stat *sbp)
{
char backup[MAXPATHLEN];
@ -638,12 +626,10 @@ create_newfile(path, target, sbp)
* copy from one file to another
*/
void
copy(from_fd, from_name, to_fd, to_name, size)
register int from_fd, to_fd;
const char *from_name, *to_name;
off_t size;
copy(int from_fd, const char *from_name, int to_fd, const char *to_name,
off_t size)
{
register int nr, nw;
int nr, nw;
int serrno;
char *p, buf[MAXBSIZE];
int done_copy;
@ -693,8 +679,7 @@ copy(from_fd, from_name, to_fd, to_name, size)
* use strip(1) to strip the target file
*/
void
strip(to_name)
const char *to_name;
strip(const char *to_name)
{
const char *stripbin;
int serrno, status;
@ -726,10 +711,9 @@ strip(to_name)
* build directory heirarchy
*/
void
install_dir(path)
char *path;
install_dir(char *path)
{
register char *p;
char *p;
struct stat sb;
int ch;
@ -761,7 +745,7 @@ install_dir(path)
* print a usage message and die
*/
void
usage()
usage(void)
{
(void)fprintf(stderr, "\
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]\n\
@ -778,8 +762,7 @@ usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]\n\
* return true (1) if mmap should be tried, false (0) if not.
*/
int
trymmap(fd)
int fd;
trymmap(int fd)
{
/*
* The ifdef is for bootstrapping - f_fstypename doesn't exist in

View File

@ -97,9 +97,7 @@ void prstr(char *);
void xsdotc(void);
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
int c;
@ -146,7 +144,7 @@ main(argc, argv)
}
static void
usage()
usage(void)
{
fprintf(stderr, "usage: xstr [-v] [-c] [-] [name ...]\n");
exit (1);
@ -155,8 +153,7 @@ usage()
char linebuf[BUFSIZ];
void
process(name)
const char *name;
process(const char *name)
{
char *cp;
int c;
@ -224,8 +221,7 @@ process(name)
}
off_t
yankstr(cpp)
char **cpp;
yankstr(char **cpp)
{
char *cp = *cpp;
int c, ch;
@ -283,14 +279,13 @@ yankstr(cpp)
}
int
octdigit(c)
char c;
octdigit(char c)
{
return (isdigit(c) && c != '8' && c != '9');
}
void
inithash()
inithash(void)
{
char buf[BUFSIZ];
FILE *mesgread = fopen(strings, "r");
@ -307,10 +302,7 @@ inithash()
}
int
fgetNUL(obuf, rmdr, file)
char *obuf;
int rmdr;
FILE *file;
fgetNUL(char *obuf, int rmdr, FILE *file)
{
int c;
char *buf = obuf;
@ -322,8 +314,7 @@ fgetNUL(obuf, rmdr, file)
}
int
xgetc(file)
FILE *file;
xgetc(FILE *file)
{
tellpt++;
@ -340,9 +331,7 @@ struct hash {
} bucket[BUCKETS];
off_t
hashit(str, new)
char *str;
int new;
hashit(char *str, int new)
{
int i;
struct hash *hp, *hp0;
@ -367,7 +356,7 @@ hashit(str, new)
}
void
flushsh()
flushsh(void)
{
int i;
struct hash *hp;
@ -400,10 +389,7 @@ flushsh()
}
void
found(new, off, str)
int new;
off_t off;
char *str;
found(int new, off_t off, char *str)
{
if (vflg == 0)
return;
@ -416,8 +402,7 @@ found(new, off, str)
}
void
prstr(cp)
char *cp;
prstr(char *cp)
{
int c;
@ -433,7 +418,7 @@ prstr(cp)
}
void
xsdotc()
xsdotc(void)
{
FILE *strf = fopen(strings, "r");
FILE *xdotcf;
@ -468,8 +453,7 @@ xsdotc()
}
char
lastchr(cp)
char *cp;
lastchr(char *cp)
{
while (cp[0] && cp[1])
@ -478,8 +462,7 @@ lastchr(cp)
}
int
istail(str, of)
char *str, *of;
istail(char *str, char *of)
{
int d = strlen(of) - strlen(str);
@ -489,8 +472,7 @@ istail(str, of)
}
void
onintr(dummy)
int dummy __unused;
onintr(int dummy __unused)
{
ignore(signal(SIGINT, SIG_IGN));

View File

@ -48,9 +48,7 @@ static const char rcsid[] = "$FreeBSD$";
#include <stdio.h>
int
main(argc, argv)
int argc;
char **argv;
main(int argc, char **argv)
{
if (argc > 1)
for(;;)