From 9dd6ab89a53571a63351083f86cb7bf1662fe356 Mon Sep 17 00:00:00 2001 From: Eirik Nygaard Date: Sat, 15 Nov 2003 23:33:35 +0000 Subject: [PATCH] * K&R function cleanup --- usr.sbin/bootparamd/bootparamd/bootparamd.c | 18 ++--- usr.sbin/bootparamd/bootparamd/main.c | 8 +-- usr.sbin/bootparamd/callbootd/callbootd.c | 22 ++---- usr.sbin/cdcontrol/cdcontrol.c | 74 +++++++++++++-------- usr.sbin/chown/chown.c | 20 ++---- usr.sbin/chroot/chroot.c | 8 +-- 6 files changed, 73 insertions(+), 77 deletions(-) diff --git a/usr.sbin/bootparamd/bootparamd/bootparamd.c b/usr.sbin/bootparamd/bootparamd/bootparamd.c index b4066d94aa..8819d145ac 100644 --- a/usr.sbin/bootparamd/bootparamd/bootparamd.c +++ b/usr.sbin/bootparamd/bootparamd/bootparamd.c @@ -9,7 +9,7 @@ use and modify. Please send modifications and/or suggestions + bug fixes to /* * $FreeBSD: src/usr.sbin/bootparamd/bootparamd/bootparamd.c,v 1.10 1999/08/28 01:15:39 peter Exp $ - * $DragonFly: src/usr.sbin/bootparamd/bootparamd/bootparamd.c,v 1.3 2003/11/03 19:31:35 eirikn Exp $ + * $DragonFly: src/usr.sbin/bootparamd/bootparamd/bootparamd.c,v 1.4 2003/11/15 23:33:35 eirikn Exp $ */ #include #include @@ -41,8 +41,7 @@ int getthefile(char *, char *, char *, int); int checkhost(char *, char *, int); bp_whoami_res * -bootparamproc_whoami_1(whoami) -bp_whoami_arg *whoami; +bootparamproc_whoami_1(bp_whoami_arg *whoami) { long haddr; static bp_whoami_res res; @@ -106,8 +105,7 @@ bp_whoami_arg *whoami; bp_getfile_res * - bootparamproc_getfile_1(getfile) -bp_getfile_arg *getfile; +bootparamproc_getfile_1(bp_getfile_arg *getfile) { char *where, *index(); static bp_getfile_res res; @@ -179,10 +177,7 @@ bp_getfile_arg *getfile; empty answer for the file "dump") */ int -getthefile(askname,fileid,buffer,blen) -char *askname; -char *fileid, *buffer; -int blen; +getthefile(char *askname, char *fileid, char *buffer, int blen) { FILE *bpf; char *where; @@ -275,10 +270,7 @@ int blen; name for a host in the database */ int -checkhost(askname, hostname, len) -char *askname; -char *hostname; -int len; +checkhost(char *askname, char *hostname, int len) { int ch, pch; FILE *bpf; diff --git a/usr.sbin/bootparamd/bootparamd/main.c b/usr.sbin/bootparamd/bootparamd/main.c index 367e3eb44e..64ca61b0fb 100644 --- a/usr.sbin/bootparamd/bootparamd/main.c +++ b/usr.sbin/bootparamd/bootparamd/main.c @@ -9,7 +9,7 @@ use and modify. Please send modifications and/or suggestions + bug fixes to /* * $FreeBSD: src/usr.sbin/bootparamd/bootparamd/main.c,v 1.9 1999/08/28 01:15:39 peter Exp $ - * $DragonFly: src/usr.sbin/bootparamd/bootparamd/main.c,v 1.3 2003/11/03 19:31:35 eirikn Exp $ + * $DragonFly: src/usr.sbin/bootparamd/bootparamd/main.c,v 1.4 2003/11/15 23:33:35 eirikn Exp $ */ #include #include @@ -39,9 +39,7 @@ extern void bootparamprog_1(); static void usage(void); int -main(argc, argv) -int argc; -char **argv; +main(int argc, char **argv) { SVCXPRT *transp; int i; @@ -110,7 +108,7 @@ char **argv; } static void -usage() +usage(void) { fprintf(stderr, "usage: bootparamd [-d] [-s] [-r router] [-f bootparmsfile]\n"); diff --git a/usr.sbin/bootparamd/callbootd/callbootd.c b/usr.sbin/bootparamd/callbootd/callbootd.c index ba2404db1c..a09716d6b0 100644 --- a/usr.sbin/bootparamd/callbootd/callbootd.c +++ b/usr.sbin/bootparamd/callbootd/callbootd.c @@ -9,7 +9,7 @@ use and modify. Please send modifications and/or suggestions + bug fixes to /* * $FreeBSD: src/usr.sbin/bootparamd/callbootd/callbootd.c,v 1.8 1999/08/28 01:15:40 peter Exp $ - * $DragonFly: src/usr.sbin/bootparamd/callbootd/callbootd.c,v 1.3 2003/11/03 19:31:35 eirikn Exp $ + * $DragonFly: src/usr.sbin/bootparamd/callbootd/callbootd.c,v 1.4 2003/11/15 23:33:35 eirikn Exp $ */ #include "bootparam_prot.h" #include @@ -36,9 +36,7 @@ int printgetfile(bp_getfile_res *); int printwhoami(bp_whoami_res *); int -eachres_whoami(resultp, raddr) -bp_whoami_res *resultp; -struct sockaddr_in *raddr; +eachres_whoami(bp_whoami_res *resultp, struct sockaddr_in *raddr) { struct hostent *he; @@ -49,9 +47,7 @@ struct sockaddr_in *raddr; return(0); } -eachres_getfile(resultp, raddr) -bp_getfile_res *resultp; -struct sockaddr_in *raddr; +eachres_getfile(bp_getfile_res *resultp, struct sockaddr_in *raddr) { struct hostent *he; @@ -64,9 +60,7 @@ struct sockaddr_in *raddr; int -main(argc, argv) -int argc; -char **argv; +main(int argc, char **argv) { char *server; @@ -151,7 +145,7 @@ char **argv; static void -usage() +usage(void) { fprintf(stderr, "usage: callbootd server procnum (IP-addr | host fileid)\n"); @@ -159,8 +153,7 @@ usage() } int -printwhoami(res) -bp_whoami_res *res; +printwhoami(bp_whoami_res *res) { if ( res) { printf("client_name:\t%s\ndomain_name:\t%s\n", @@ -181,8 +174,7 @@ bp_whoami_res *res; int -printgetfile(res) -bp_getfile_res *res; +printgetfile(bp_getfile_res *res) { if (res) { printf("server_name:\t%s\nserver_address:\t%s\npath:\t%s\n", diff --git a/usr.sbin/cdcontrol/cdcontrol.c b/usr.sbin/cdcontrol/cdcontrol.c index b874f52f56..8dc5a1b070 100644 --- a/usr.sbin/cdcontrol/cdcontrol.c +++ b/usr.sbin/cdcontrol/cdcontrol.c @@ -18,7 +18,7 @@ * Some code style reformatting. * * $FreeBSD: src/usr.sbin/cdcontrol/cdcontrol.c,v 1.24.2.11 2002/11/20 00:26:19 njl Exp $ - * $DragonFly: src/usr.sbin/cdcontrol/cdcontrol.c,v 1.4 2003/11/03 19:31:36 eirikn Exp $ + * $DragonFly: src/usr.sbin/cdcontrol/cdcontrol.c,v 1.5 2003/11/15 23:33:35 eirikn Exp $ */ #include @@ -143,7 +143,8 @@ const char *strstatus(int); static u_int dbprog_discid(void); const char *cdcontrol_prompt(void); -void help () +void +help(void) { struct cmdtab *c; const char *s; @@ -169,13 +170,15 @@ void help () printf ("\tThe plain target address is taken as a synonym for play.\n"); } -void usage () +void +usage(void) { fprintf (stderr, "usage: cdcontrol [-sv] [-f device] [command ...]\n"); exit (1); } -char *use_cdrom_instead(const char *old_envvar) +char +*use_cdrom_instead(const char *old_envvar) { char *device; @@ -187,7 +190,8 @@ char *use_cdrom_instead(const char *old_envvar) } -int main (int argc, char **argv) +int +main(int argc, char **argv) { int cmd; char *arg; @@ -276,7 +280,8 @@ int main (int argc, char **argv) } } -int run (int cmd, char *arg) +int +run(int cmd, char *arg) { long speed; int l, r, rc; @@ -450,7 +455,8 @@ int run (int cmd, char *arg) } } -int play (char *arg) +int +play(char *arg) { struct ioc_toc_header h; unsigned int n; @@ -733,7 +739,8 @@ Clean_up: return (0); } -int next_prev (char *arg, int cmd) +int +next_prev(char *arg, int cmd) { struct ioc_toc_header h; int dir, junk, n, off, rc, trk; @@ -763,7 +770,8 @@ int next_prev (char *arg, int cmd) return (play_track (trk, 1, n, 1)); } -const char *strstatus (int sts) +const char +*strstatus(int sts) { switch (sts) { case ASTS_INVALID: return ("invalid"); @@ -776,7 +784,8 @@ const char *strstatus (int sts) } } -int pstatus (char *arg) +int +pstatus(char *arg) { struct ioc_vol v; struct ioc_read_subchannel ss; @@ -887,7 +896,7 @@ dbprog_sum(int n) * The integer disc ID. */ static u_int -dbprog_discid() +dbprog_discid(void) { struct ioc_toc_header h; int rc; @@ -918,7 +927,8 @@ dbprog_discid() return((n % 0xff) << 24 | t << 8 | ntr); } -int cdid () +int +cdid(void) { u_int id; @@ -932,7 +942,8 @@ int cdid () return id ? 0 : 1; } -int info (char *arg __unused) +int +info(char *arg __unused) { struct ioc_toc_header h; int rc, i, n; @@ -969,7 +980,8 @@ int info (char *arg __unused) return (0); } -void lba2msf (unsigned long lba, u_char *m, u_char *s, u_char *f) +void +lba2msf(unsigned long lba, u_char *m, u_char *s, u_char *f) { lba += 150; /* block start offset */ lba &= 0xffffff; /* negative lbas use only 24 bits */ @@ -979,12 +991,14 @@ void lba2msf (unsigned long lba, u_char *m, u_char *s, u_char *f) *f = lba % 75; } -unsigned int msf2lba (u_char m, u_char s, u_char f) +unsigned int +msf2lba(u_char m, u_char s, u_char f) { return (((m * 60) + s) * 75 + f) - 150; } -void prtrack (struct cd_toc_entry *e, int lastflag) +void +prtrack(struct cd_toc_entry *e, int lastflag) { int block, next, len; u_char m, s, f; @@ -1022,7 +1036,8 @@ void prtrack (struct cd_toc_entry *e, int lastflag) (e->control & 4) ? "data" : "audio"); } -int play_track (int tstart, int istart, int tend, int iend) +int +play_track(int tstart, int istart, int tend, int iend) { struct ioc_play_track t; @@ -1034,7 +1049,8 @@ int play_track (int tstart, int istart, int tend, int iend) return ioctl (fd, CDIOCPLAYTRACKS, &t); } -int play_blocks (int blk, int len) +int +play_blocks(int blk, int len) { struct ioc_play_blocks t; @@ -1044,7 +1060,8 @@ int play_blocks (int blk, int len) return ioctl (fd, CDIOCPLAYBLOCKS, &t); } -int setvol (int left, int right) +int +setvol(int left, int right) { struct ioc_vol v; @@ -1056,7 +1073,8 @@ int setvol (int left, int right) return ioctl (fd, CDIOCSETVOL, &v); } -int read_toc_entrys (int len) +int +read_toc_entrys(int len) { struct ioc_read_toc_entry t; @@ -1068,7 +1086,8 @@ int read_toc_entrys (int len) return (ioctl (fd, CDIOREADTOCENTRYS, (char *) &t)); } -int play_msf (int start_m, int start_s, int start_f, +int +play_msf(int start_m, int start_s, int start_f, int end_m, int end_s, int end_f) { struct ioc_play_msf a; @@ -1083,7 +1102,8 @@ int play_msf (int start_m, int start_s, int start_f, return ioctl (fd, CDIOCPLAYMSF, (char *) &a); } -int status (int *trk, int *min, int *sec, int *frame) +int +status(int *trk, int *min, int *sec, int *frame) { struct ioc_read_subchannel s; struct cd_sub_channel_info data; @@ -1115,13 +1135,13 @@ int status (int *trk, int *min, int *sec, int *frame) } const char * -cdcontrol_prompt() +cdcontrol_prompt(void) { return ("cdcontrol> "); } char * -input (int *cmd) +input(int *cmd) { #define MAXLINE 80 static EditLine *el = NULL; @@ -1168,7 +1188,8 @@ input (int *cmd) return (p); } -char *parse (char *buf, int *cmd) +char +*parse(char *buf, int *cmd) { struct cmdtab *c; char *p; @@ -1232,7 +1253,8 @@ char *parse (char *buf, int *cmd) return p; } -int open_cd () +int +open_cd(void) { char devbuf[MAXPATHLEN]; diff --git a/usr.sbin/chown/chown.c b/usr.sbin/chown/chown.c index dcaf3d0b75..516292d81b 100644 --- a/usr.sbin/chown/chown.c +++ b/usr.sbin/chown/chown.c @@ -33,7 +33,7 @@ * @(#) Copyright (c) 1988, 1993, 1994 The Regents of the University of California. All rights reserved. * @(#)chown.c 8.8 (Berkeley) 4/4/94 * $FreeBSD: src/usr.sbin/chown/chown.c,v 1.15.2.3 2002/08/07 21:24:33 schweikh Exp $ - * $DragonFly: src/usr.sbin/chown/chown.c,v 1.3 2003/11/03 19:31:36 eirikn Exp $ + * $DragonFly: src/usr.sbin/chown/chown.c,v 1.4 2003/11/15 23:33:35 eirikn Exp $ */ #include @@ -63,9 +63,7 @@ int Rflag, ischown, fflag, hflag, vflag; char *gname, *myname; int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char **argv) { FTS *ftsp; FTSENT *p; @@ -200,8 +198,7 @@ main(argc, argv) } void -a_gid(s) - char *s; +a_gid(char *s) { struct group *gr; @@ -212,8 +209,7 @@ a_gid(s) } void -a_uid(s) - char *s; +a_uid(char *s) { struct passwd *pw; @@ -223,8 +219,7 @@ a_uid(s) } u_long -id(name, type) - char *name, *type; +id(char *name, char *type) { u_long val; char *ep; @@ -243,8 +238,7 @@ id(name, type) } void -chownerr(file) - char *file; +chownerr(char *file) { static int euid = -1, ngroups = -1; gid_t groups[NGROUPS]; @@ -266,7 +260,7 @@ chownerr(file) } void -usage() +usage(void) { (void)fprintf(stderr, "%s\n%s\n%s\n", "usage: chown [-R [-H | -L | -P]] [-f] [-h] [-v] owner[:group] file ...", diff --git a/usr.sbin/chroot/chroot.c b/usr.sbin/chroot/chroot.c index 565b1282f4..c69743c7e4 100644 --- a/usr.sbin/chroot/chroot.c +++ b/usr.sbin/chroot/chroot.c @@ -33,7 +33,7 @@ * @(#) Copyright (c) 1988, 1993 The Regents of the University of California. All rights reserved. * @(#)chroot.c 8.1 (Berkeley) 6/9/93 * $FreeBSD: src/usr.sbin/chroot/chroot.c,v 1.4.2.1 2002/03/15 22:54:59 mikeh Exp $ - * $DragonFly: src/usr.sbin/chroot/chroot.c,v 1.4 2003/08/24 15:58:55 drhodus Exp $ + * $DragonFly: src/usr.sbin/chroot/chroot.c,v 1.5 2003/11/15 23:33:35 eirikn Exp $ */ #include @@ -56,9 +56,7 @@ char *group; /* group to switch to ... */ char *grouplist; /* group list to switch to ... */ int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char **argv) { struct group *gp; struct passwd *pw; @@ -170,7 +168,7 @@ main(argc, argv) } static void -usage() +usage(void) { (void)fprintf(stderr, "usage: chroot [-g group] [-G group,group,...] " "[-u user] newroot [command]\n"); -- 2.41.0