o __P has been reoved

o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
  they already are.

Approved by: arch@, new style(9)
This commit is contained in:
Warner Losh 2002-02-02 06:24:13 +00:00
parent 5dce647c1b
commit f9bcb0beb5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=90108
11 changed files with 106 additions and 156 deletions

View File

@ -67,16 +67,14 @@ static const char rcsid[] =
time_t tval; time_t tval;
int retval; int retval;
static void setthetime __P((const char *, const char *, int, int)); static void setthetime(const char *, const char *, int, int);
static void badformat __P((void)); static void badformat(void);
static void usage __P((void)); static void usage(void);
int logwtmp __P((char *, char *, char *)); int logwtmp(char *, char *, char *);
int int
main(argc, argv) main(int argc, char *argv[])
int argc;
char **argv;
{ {
struct timezone tz; struct timezone tz;
int ch, rflag; int ch, rflag;
@ -182,12 +180,9 @@ main(argc, argv)
#define ATOI2(s) ((s) += 2, ((s)[-2] - '0') * 10 + ((s)[-1] - '0')) #define ATOI2(s) ((s) += 2, ((s)[-2] - '0') * 10 + ((s)[-1] - '0'))
void void
setthetime(fmt, p, jflag, nflag) setthetime(const char *fmt, const char *p, int jflag, int nflag)
const char *fmt;
register const char *p;
int jflag, nflag;
{ {
register struct tm *lt; struct tm *lt;
struct timeval tv; struct timeval tv;
const char *dot, *t; const char *dot, *t;
int century; int century;
@ -295,14 +290,14 @@ setthetime(fmt, p, jflag, nflag)
} }
static void static void
badformat() badformat(void)
{ {
warnx("illegal time format"); warnx("illegal time format");
usage(); usage();
} }
static void static void
usage() usage(void)
{ {
(void)fprintf(stderr, "%s\n%s\n", (void)fprintf(stderr, "%s\n%s\n",
"usage: date [-jnu] [-d dst] [-r seconds] [-t west] " "usage: date [-jnu] [-d dst] [-r seconds] [-t west] "

View File

@ -34,4 +34,4 @@
* $FreeBSD$ * $FreeBSD$
*/ */
int netsettime __P((time_t)); int netsettime(time_t);

View File

@ -68,8 +68,7 @@ extern int retval;
* Returns 0 on success. Returns > 0 on failure, setting retval to 2; * Returns 0 on success. Returns > 0 on failure, setting retval to 2;
*/ */
int int
netsettime(tval) netsettime(time_t tval)
time_t tval;
{ {
struct timeval tout; struct timeval tout;
struct servent *sp; struct servent *sp;

View File

@ -54,25 +54,25 @@ static const char rcsid[] =
#include "dd.h" #include "dd.h"
#include "extern.h" #include "extern.h"
static int c_arg __P((const void *, const void *)); static int c_arg(const void *, const void *);
static int c_conv __P((const void *, const void *)); static int c_conv(const void *, const void *);
static void f_bs __P((char *)); static void f_bs(char *);
static void f_cbs __P((char *)); static void f_cbs(char *);
static void f_conv __P((char *)); static void f_conv(char *);
static void f_count __P((char *)); static void f_count(char *);
static void f_files __P((char *)); static void f_files(char *);
static void f_ibs __P((char *)); static void f_ibs(char *);
static void f_if __P((char *)); static void f_if(char *);
static void f_obs __P((char *)); static void f_obs(char *);
static void f_of __P((char *)); static void f_of(char *);
static void f_seek __P((char *)); static void f_seek(char *);
static void f_skip __P((char *)); static void f_skip(char *);
static u_quad_t get_num __P((const char *)); static u_quad_t get_num(const char *);
static off_t get_off_t __P((const char *)); static off_t get_off_t(const char *);
static const struct arg { static const struct arg {
const char *name; const char *name;
void (*f) __P((char *)); void (*f)(char *);
u_int set, noset; u_int set, noset;
} args[] = { } args[] = {
{ "bs", f_bs, C_BS, C_BS|C_IBS|C_OBS|C_OSYNC }, { "bs", f_bs, C_BS, C_BS|C_IBS|C_OBS|C_OSYNC },
@ -96,8 +96,7 @@ static char *oper;
* args -- parse JCL syntax of dd. * args -- parse JCL syntax of dd.
*/ */
void void
jcl(argv) jcl(char **argv)
char **argv;
{ {
struct arg *ap, tmp; struct arg *ap, tmp;
char *arg; char *arg;
@ -173,8 +172,7 @@ jcl(argv)
} }
static int static int
c_arg(a, b) c_arg(const void *a, const void *b)
const void *a, *b;
{ {
return (strcmp(((const struct arg *)a)->name, return (strcmp(((const struct arg *)a)->name,
@ -182,8 +180,7 @@ c_arg(a, b)
} }
static void static void
f_bs(arg) f_bs(char *arg)
char *arg;
{ {
u_quad_t res; u_quad_t res;
@ -194,8 +191,7 @@ f_bs(arg)
} }
static void static void
f_cbs(arg) f_cbs(char *arg)
char *arg;
{ {
u_quad_t res; u_quad_t res;
@ -206,8 +202,7 @@ f_cbs(arg)
} }
static void static void
f_count(arg) f_count(char *arg)
char *arg;
{ {
u_quad_t res; u_quad_t res;
@ -221,8 +216,7 @@ f_count(arg)
} }
static void static void
f_files(arg) f_files(char *arg)
char *arg;
{ {
files_cnt = get_num(arg); files_cnt = get_num(arg);
@ -231,8 +225,7 @@ f_files(arg)
} }
static void static void
f_ibs(arg) f_ibs(char *arg)
char *arg;
{ {
u_quad_t res; u_quad_t res;
@ -245,16 +238,14 @@ f_ibs(arg)
} }
static void static void
f_if(arg) f_if(char *arg)
char *arg;
{ {
in.name = arg; in.name = arg;
} }
static void static void
f_obs(arg) f_obs(char *arg)
char *arg;
{ {
u_quad_t res; u_quad_t res;
@ -267,24 +258,21 @@ f_obs(arg)
} }
static void static void
f_of(arg) f_of(char *arg)
char *arg;
{ {
out.name = arg; out.name = arg;
} }
static void static void
f_seek(arg) f_seek(char *arg)
char *arg;
{ {
out.offset = get_off_t(arg); out.offset = get_off_t(arg);
} }
static void static void
f_skip(arg) f_skip(char *arg)
char *arg;
{ {
in.offset = get_off_t(arg); in.offset = get_off_t(arg);
@ -314,8 +302,7 @@ static const struct conv {
}; };
static void static void
f_conv(arg) f_conv(char *arg)
char *arg;
{ {
struct conv *cp, tmp; struct conv *cp, tmp;
@ -334,8 +321,7 @@ f_conv(arg)
} }
static int static int
c_conv(a, b) c_conv(const void *a, const void *b)
const void *a, *b;
{ {
return (strcmp(((const struct conv *)a)->name, return (strcmp(((const struct conv *)a)->name,
@ -355,8 +341,7 @@ c_conv(a, b)
* the product of the indicated values. * the product of the indicated values.
*/ */
static u_quad_t static u_quad_t
get_num(val) get_num(const char *val)
const char *val;
{ {
u_quad_t num, mult, prevnum; u_quad_t num, mult, prevnum;
char *expr; char *expr;
@ -424,8 +409,7 @@ get_num(val)
* cast down to an off_t, if possible. * cast down to an off_t, if possible.
*/ */
static off_t static off_t
get_off_t(val) get_off_t(const char *val)
const char *val;
{ {
quad_t num, mult, prevnum; quad_t num, mult, prevnum;
char *expr; char *expr;

View File

@ -58,7 +58,7 @@ static const char rcsid[] =
* Worst case buffer calculation is (ibs + obs - 1). * Worst case buffer calculation is (ibs + obs - 1).
*/ */
void void
def() def(void)
{ {
u_char *inp; u_char *inp;
const u_char *t; const u_char *t;
@ -87,7 +87,7 @@ def()
} }
void void
def_close() def_close(void)
{ {
/* Just update the count, everything is already in the buffer. */ /* Just update the count, everything is already in the buffer. */
if (in.dbcnt) if (in.dbcnt)
@ -102,7 +102,7 @@ def_close()
* max out buffer: obs + cbsz * max out buffer: obs + cbsz
*/ */
void void
block() block(void)
{ {
u_char *inp, *outp; u_char *inp, *outp;
const u_char *t; const u_char *t;
@ -188,7 +188,7 @@ block()
} }
void void
block_close() block_close(void)
{ {
/* /*
* Copy any remaining data into the output buffer and pad to a record. * Copy any remaining data into the output buffer and pad to a record.
@ -215,7 +215,7 @@ block_close()
* max out buffer: obs + cbsz * max out buffer: obs + cbsz
*/ */
void void
unblock() unblock(void)
{ {
u_char *inp; u_char *inp;
const u_char *t; const u_char *t;
@ -249,7 +249,7 @@ unblock()
} }
void void
unblock_close() unblock_close(void)
{ {
u_char *t; u_char *t;
size_t cnt; size_t cnt;

View File

@ -69,15 +69,14 @@ static const char rcsid[] =
#include "dd.h" #include "dd.h"
#include "extern.h" #include "extern.h"
static void dd_close __P((void)); static void dd_close(void);
static void dd_in __P((void)); static void dd_in(void);
int main __P((int, char *[])); static void getfdtype(IO *);
static void getfdtype __P((IO *)); static void setup(void);
static void setup __P((void));
IO in, out; /* input/output state */ IO in, out; /* input/output state */
STAT st; /* statistics */ STAT st; /* statistics */
void (*cfunc) __P((void)); /* conversion function */ void (*cfunc)(void); /* conversion function */
u_quad_t cpy_cnt; /* # of blocks to copy */ u_quad_t cpy_cnt; /* # of blocks to copy */
off_t pending = 0; /* pending seek if sparse */ off_t pending = 0; /* pending seek if sparse */
u_int ddflags; /* conversion options */ u_int ddflags; /* conversion options */
@ -86,9 +85,7 @@ quad_t files_cnt = 1; /* # of files to copy */
const u_char *ctab; /* conversion table */ const u_char *ctab; /* conversion table */
int int
main(argc, argv) main(int argc __unused, char *argv[])
int argc __unused;
char *argv[];
{ {
(void)setlocale(LC_CTYPE, ""); (void)setlocale(LC_CTYPE, "");
jcl(argv); jcl(argv);
@ -107,7 +104,7 @@ main(argc, argv)
} }
static void static void
setup() setup(void)
{ {
u_int cnt; u_int cnt;
struct timeval tv; struct timeval tv;
@ -209,8 +206,7 @@ setup()
} }
static void static void
getfdtype(io) getfdtype(IO *io)
IO *io;
{ {
struct stat sb; struct stat sb;
int type; int type;
@ -246,7 +242,7 @@ getfdtype(io)
} }
static void static void
dd_in() dd_in(void)
{ {
ssize_t n; ssize_t n;
@ -353,7 +349,7 @@ dd_in()
* is truncated. * is truncated.
*/ */
static void static void
dd_close() dd_close(void)
{ {
if (cfunc == def) if (cfunc == def)
def_close(); def_close();
@ -373,8 +369,7 @@ dd_close()
} }
void void
dd_out(force) dd_out(int force)
int force;
{ {
u_char *outp; u_char *outp;
size_t cnt, i, n; size_t cnt, i, n;

View File

@ -40,23 +40,23 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
void block __P((void)); void block(void);
void block_close __P((void)); void block_close(void);
void dd_out __P((int)); void dd_out(int);
void def __P((void)); void def(void);
void def_close __P((void)); void def_close(void);
void jcl __P((char **)); void jcl(char **);
void pos_in __P((void)); void pos_in(void);
void pos_out __P((void)); void pos_out(void);
void summary __P((void)); void summary(void);
void summaryx __P((int)); void summaryx(int);
void terminate __P((int)); void terminate(int);
void unblock __P((void)); void unblock(void);
void unblock_close __P((void)); void unblock_close(void);
extern IO in, out; extern IO in, out;
extern STAT st; extern STAT st;
extern void (*cfunc) __P((void)); extern void (*cfunc)(void);
extern u_quad_t cpy_cnt; extern u_quad_t cpy_cnt;
extern size_t cbsz; extern size_t cbsz;
extern u_int ddflags; extern u_int ddflags;

View File

@ -56,7 +56,7 @@ static const char rcsid[] =
#include "extern.h" #include "extern.h"
void void
summary() summary(void)
{ {
struct timeval tv; struct timeval tv;
double secs; double secs;
@ -89,8 +89,7 @@ summary()
/* ARGSUSED */ /* ARGSUSED */
void void
summaryx(notused) summaryx(int notused __unused)
int notused __unused;
{ {
int save_errno = errno; int save_errno = errno;
@ -100,8 +99,7 @@ summaryx(notused)
/* ARGSUSED */ /* ARGSUSED */
void void
terminate(sig) terminate(int sig)
int sig;
{ {
summary(); summary();

View File

@ -60,7 +60,7 @@ static const char rcsid[] =
* output. * output.
*/ */
void void
pos_in() pos_in(void)
{ {
off_t cnt; off_t cnt;
int warned; int warned;
@ -123,7 +123,7 @@ pos_in()
} }
void void
pos_out() pos_out(void)
{ {
struct mtop t_op; struct mtop t_op;
off_t cnt; off_t cnt;

View File

@ -96,27 +96,24 @@ typedef enum { NONE, KILO, MEGA, GIGA, TERA, PETA, UNIT_MAX } unit_t;
int unitp [] = { NONE, KILO, MEGA, GIGA, TERA, PETA }; int unitp [] = { NONE, KILO, MEGA, GIGA, TERA, PETA };
int bread __P((off_t, void *, int)); int bread(off_t, void *, int);
int checkvfsname __P((const char *, char **)); int checkvfsname(const char *, char **);
char *getmntpt __P((char *)); char *getmntpt(char *);
int main __P((int, char *[])); char *makenetvfslist(void);
char *makenetvfslist __P((void)); char **makevfslist(char *);
char **makevfslist __P((char *)); void prthuman(struct statfs *, long);
void prthuman __P((struct statfs *, long)); void prthumanval(double);
void prthumanval __P((double)); void prtstat(struct statfs *, int);
void prtstat __P((struct statfs *, int)); long regetmntinfo(struct statfs **, long, char **);
long regetmntinfo __P((struct statfs **, long, char **)); int ufs_df(char *, int);
int ufs_df __P((char *, int)); unit_t unit_adjust(double *);
unit_t unit_adjust __P((double *)); void usage(void);
void usage __P((void));
int aflag = 0, hflag, iflag, nflag; int aflag = 0, hflag, iflag, nflag;
struct ufs_args mdev; struct ufs_args mdev;
int int
main(argc, argv) main(int argc, char *argv[])
int argc;
char *argv[];
{ {
struct stat stbuf; struct stat stbuf;
struct statfs statfsbuf, *mntbuf; struct statfs statfsbuf, *mntbuf;
@ -269,8 +266,7 @@ main(argc, argv)
} }
char * char *
getmntpt(name) getmntpt(char *name)
char *name;
{ {
long mntsize, i; long mntsize, i;
struct statfs *mntbuf; struct statfs *mntbuf;
@ -289,10 +285,7 @@ getmntpt(name)
* current (not cached) info. Returns the new count of valid statfs bufs. * current (not cached) info. Returns the new count of valid statfs bufs.
*/ */
long long
regetmntinfo(mntbufp, mntsize, vfslist) regetmntinfo(struct statfs **mntbufp, long mntsize, char **vfslist)
struct statfs **mntbufp;
long mntsize;
char **vfslist;
{ {
int i, j; int i, j;
struct statfs *mntbuf; struct statfs *mntbuf;
@ -320,8 +313,7 @@ regetmntinfo(mntbufp, mntsize, vfslist)
* *
*/ */
unit_t unit_t
unit_adjust(val) unit_adjust(double *val)
double *val;
{ {
double abval; double abval;
unit_t unit; unit_t unit;
@ -342,9 +334,7 @@ unit_adjust(val)
} }
void void
prthuman(sfsp, used) prthuman(struct statfs *sfsp, long used)
struct statfs *sfsp;
long used;
{ {
prthumanval((double)sfsp->f_blocks * (double)sfsp->f_bsize); prthumanval((double)sfsp->f_blocks * (double)sfsp->f_bsize);
@ -353,8 +343,7 @@ prthuman(sfsp, used)
} }
void void
prthumanval(bytes) prthumanval(double bytes)
double bytes;
{ {
unit_t unit; unit_t unit;
@ -380,9 +369,7 @@ prthumanval(bytes)
* Print out status about a filesystem. * Print out status about a filesystem.
*/ */
void void
prtstat(sfsp, maxwidth) prtstat(struct statfs *sfsp, int maxwidth)
struct statfs *sfsp;
int maxwidth;
{ {
static long blocksize; static long blocksize;
static int headerlen, timesthrough; static int headerlen, timesthrough;
@ -447,9 +434,7 @@ union {
int rfd; int rfd;
int int
ufs_df(file, maxwidth) ufs_df(char *file, int maxwidth)
char *file;
int maxwidth;
{ {
struct statfs statfsbuf; struct statfs statfsbuf;
struct statfs *sfsp; struct statfs *sfsp;
@ -491,10 +476,7 @@ ufs_df(file, maxwidth)
} }
int int
bread(off, buf, cnt) bread(off_t off, void *buf, int cnt)
off_t off;
void *buf;
int cnt;
{ {
ssize_t nr; ssize_t nr;
@ -510,7 +492,7 @@ bread(off, buf, cnt)
} }
void void
usage() usage(void)
{ {
(void)fprintf(stderr, (void)fprintf(stderr,
@ -519,7 +501,7 @@ usage()
} }
char * char *
makenetvfslist() makenetvfslist(void)
{ {
char *str, *strptr, **listptr; char *str, *strptr, **listptr;
int mib[3], maxvfsconf, cnt=0, i; int mib[3], maxvfsconf, cnt=0, i;

View File

@ -53,13 +53,10 @@ static const char rcsid[] =
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
int main __P((int, char *[])); static void usage(void);
void usage __P((void));
int int
main(argc,argv) main(int argc, char *argv[])
int argc;
char *argv[];
{ {
int ch; int ch;
char domainname[MAXHOSTNAMELEN]; char domainname[MAXHOSTNAMELEN];
@ -86,8 +83,8 @@ main(argc,argv)
exit(0); exit(0);
} }
void static void
usage() usage(void)
{ {
(void)fprintf(stderr, "usage: domainname [ypdomain]\n"); (void)fprintf(stderr, "usage: domainname [ypdomain]\n");
exit(1); exit(1);