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

View File

@ -34,4 +34,4 @@
* $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;
*/
int
netsettime(tval)
time_t tval;
netsettime(time_t tval)
{
struct timeval tout;
struct servent *sp;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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