From 953df15ce4dd39df097d774dfce2b2c7373c4616 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Fri, 27 Mar 2009 13:46:52 +0100 Subject: [PATCH] bootpd(8): Remove 'register' and P() and silence -Wold-style-definition. --- libexec/bootpd/bootpd.c | 56 +++------- libexec/bootpd/bootpgw/bootpgw.c | 24 ++-- libexec/bootpd/dovend.c | 28 +---- libexec/bootpd/dovend.h | 14 +-- libexec/bootpd/dumptab.c | 32 ++---- libexec/bootpd/getether.c | 12 +- libexec/bootpd/getif.c | 16 ++- libexec/bootpd/hash.c | 72 ++++-------- libexec/bootpd/hash.h | 39 +++---- libexec/bootpd/hwaddr.c | 27 ++--- libexec/bootpd/hwaddr.h | 14 +-- libexec/bootpd/lookup.c | 14 +-- libexec/bootpd/lookup.h | 14 +-- libexec/bootpd/readfile.c | 158 ++++++++++----------------- libexec/bootpd/readfile.h | 19 +--- libexec/bootpd/report.c | 5 +- libexec/bootpd/report.h | 14 +-- libexec/bootpd/rtmsg.c | 26 ++--- libexec/bootpd/tools/bootpef/bootpef.c | 21 +--- libexec/bootpd/tools/bootptest/bootptest.c | 15 +-- libexec/bootpd/tools/bootptest/bootptest.h | 10 +- libexec/bootpd/tools/bootptest/print-bootp.c | 27 ++--- libexec/bootpd/tzone.c | 2 +- 23 files changed, 215 insertions(+), 444 deletions(-) diff --git a/libexec/bootpd/bootpd.c b/libexec/bootpd/bootpd.c index 9f6a3478f2..75e106c736 100644 --- a/libexec/bootpd/bootpd.c +++ b/libexec/bootpd/bootpd.c @@ -106,26 +106,18 @@ SOFTWARE. * Externals, forward declarations, and global variables */ -#ifdef __STDC__ -#define P(args) args -#else -#define P(args) () -#endif - -extern void dumptab P((char *)); +extern void dumptab(char *); -PRIVATE void catcher P((int)); -PRIVATE int chk_access P((char *, int32 *)); +PRIVATE void catcher(int); +PRIVATE int chk_access(char *, int32 *); #ifdef VEND_CMU -PRIVATE void dovend_cmu P((struct bootp *, struct host *)); +PRIVATE void dovend_cmu(struct bootp *, struct host *); #endif -PRIVATE void dovend_rfc1048 P((struct bootp *, struct host *, int32)); -PRIVATE void handle_reply P((void)); -PRIVATE void handle_request P((void)); -PRIVATE void sendreply P((int forward, int32 dest_override)); -PRIVATE void usage P((void)); - -#undef P +PRIVATE void dovend_rfc1048(struct bootp *, struct host *, int32); +PRIVATE void handle_reply(void); +PRIVATE void handle_request(void); +PRIVATE void sendreply(int forward, int32 dest_override); +PRIVATE void usage(void); /* * IP port numbers for client and server obtained from /etc/services @@ -186,9 +178,7 @@ char *bootpd_dump = DUMPTAB_FILE; */ int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { struct timeval *timeout; struct bootp *bp; @@ -586,7 +576,7 @@ main(argc, argv) */ PRIVATE void -usage() +usage(void) { fprintf(stderr, "usage: bootpd [-d level] [-i] [-s] [-t timeout] [configfile [dumpfile]]\n"); @@ -600,8 +590,7 @@ usage() /* Signal catchers */ PRIVATE void -catcher(sig) - int sig; +catcher(int sig) { if (sig == SIGHUP) do_readtab = 1; @@ -627,7 +616,7 @@ catcher(sig) * forward the request there.) */ PRIVATE void -handle_request() +handle_request(void) { struct bootp *bp = (struct bootp *) pktbuf; struct host *hp = NULL; @@ -1001,7 +990,7 @@ null_file_name: * Process BOOTREPLY packet. */ PRIVATE void -handle_reply() +handle_reply(void) { if (debug) { report(LOG_INFO, "processing boot reply"); @@ -1016,9 +1005,7 @@ handle_reply() * not the originator of this reply packet. */ PRIVATE void -sendreply(forward, dst_override) - int forward; - int32 dst_override; +sendreply(int forward, int32 dst_override) { struct bootp *bp = (struct bootp *) pktbuf; struct in_addr dst; @@ -1132,9 +1119,7 @@ sendreply(forward, dst_override) */ PRIVATE int -chk_access(path, filesize) - char *path; - int32 *filesize; +chk_access(char *path, int32 *filesize) { struct stat st; @@ -1162,9 +1147,7 @@ chk_access(path, filesize) */ PRIVATE void -dovend_cmu(bp, hp) - struct bootp *bp; - struct host *hp; +dovend_cmu(struct bootp *bp, struct host *hp) { struct cmu_vend *vendp; struct in_addr_list *taddr; @@ -1232,10 +1215,7 @@ dovend_cmu(bp, hp) return; \ } while (0) PRIVATE void -dovend_rfc1048(bp, hp, bootsize) - struct bootp *bp; - struct host *hp; - int32 bootsize; +dovend_rfc1048(struct bootp *bp, struct host *hp, int32 bootsize) { int bytesleft, len; byte *vp; diff --git a/libexec/bootpd/bootpgw/bootpgw.c b/libexec/bootpd/bootpgw/bootpgw.c index faeedda37a..fa923c01b9 100644 --- a/libexec/bootpd/bootpgw/bootpgw.c +++ b/libexec/bootpd/bootpgw/bootpgw.c @@ -91,17 +91,9 @@ SOFTWARE. * Externals, forward declarations, and global variables */ -#ifdef __STDC__ -#define P(args) args -#else -#define P(args) () -#endif - -static void usage P((void)); -static void handle_reply P((void)); -static void handle_request P((void)); - -#undef P +static void usage(void); +static void handle_reply(void); +static void handle_request(void); /* * IP port numbers for client and server obtained from /etc/services @@ -158,9 +150,7 @@ char *hostname; */ int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { struct timeval *timeout; struct bootp *bp; @@ -509,7 +499,7 @@ main(argc, argv) */ static void -usage() +usage(void) { fprintf(stderr, "usage: bootpgw [-d level] [-i] [-s] [-t timeout] server\n"); @@ -530,7 +520,7 @@ usage() * Note, this just forwards the request to a real server. */ static void -handle_request() +handle_request(void) { struct bootp *bp = (struct bootp *) pktbuf; u_short secs; @@ -621,7 +611,7 @@ handle_request() * Process BOOTREPLY packet. */ static void -handle_reply() +handle_reply(void) { struct bootp *bp = (struct bootp *) pktbuf; struct ifreq *ifr; diff --git a/libexec/bootpd/dovend.c b/libexec/bootpd/dovend.c index 7e0e921c78..fecc20423e 100644 --- a/libexec/bootpd/dovend.c +++ b/libexec/bootpd/dovend.c @@ -30,13 +30,7 @@ #include "report.h" #include "dovend.h" -#ifdef __STDC__ -#define P(args) args -#else -#define P(args) () -#endif - -PRIVATE int insert_generic P((struct shared_bindata *, byte **, int *)); +PRIVATE int insert_generic(struct shared_bindata *, byte **, int *); /* * Insert the 2nd part of the options into an option buffer. @@ -52,10 +46,7 @@ PRIVATE int insert_generic P((struct shared_bindata *, byte **, int *)); */ int -dovend_rfc1497(hp, buf, len) - struct host *hp; - byte *buf; - int len; +dovend_rfc1497(struct host *hp, byte *buf, int len) { int bytesleft = len; byte *vp = buf; @@ -288,11 +279,7 @@ dovend_rfc1497(hp, buf, len) */ int -insert_ip(tag, iplist, dest, bytesleft) - byte tag; - struct in_addr_list *iplist; - byte **dest; - int *bytesleft; +insert_ip(byte tag, struct in_addr_list *iplist, byte **dest, int *bytesleft) { struct in_addr *addrptr; unsigned addrcount = 1; @@ -331,10 +318,7 @@ insert_ip(tag, iplist, dest, bytesleft) */ static int -insert_generic(gendata, buff, bytesleft) - struct shared_bindata *gendata; - byte **buff; - int *bytesleft; +insert_generic(struct shared_bindata *gendata, byte **buff, int *bytesleft) { byte *srcptr; int length, numbytes; @@ -386,9 +370,7 @@ insert_generic(gendata, buff, bytesleft) */ void -insert_u_long(value, dest) - u_int32 value; - byte **dest; +insert_u_long(u_int32 value, byte **dest) { byte *temp; int n; diff --git a/libexec/bootpd/dovend.h b/libexec/bootpd/dovend.h index b30c982d8e..4b9f7d6baa 100644 --- a/libexec/bootpd/dovend.h +++ b/libexec/bootpd/dovend.h @@ -1,13 +1,5 @@ /* dovend.h */ -#ifdef __STDC__ -#define P(args) args -#else -#define P(args) () -#endif - -extern int dovend_rfc1497 P((struct host *hp, u_char *buf, int len)); -extern int insert_ip P((int, struct in_addr_list *, u_char **, int *)); -extern void insert_u_long P((u_int32, u_char **)); - -#undef P +extern int dovend_rfc1497(struct host *hp, u_char *buf, int len); +extern int insert_ip(byte, struct in_addr_list *, byte **, int *); +extern void insert_u_long(u_int32, u_char **); diff --git a/libexec/bootpd/dumptab.c b/libexec/bootpd/dumptab.c index fbcdb0d892..c7a4cae0b1 100644 --- a/libexec/bootpd/dumptab.c +++ b/libexec/bootpd/dumptab.c @@ -29,24 +29,15 @@ #include "patchlevel.h" #include "bootpd.h" -#ifdef __STDC__ -#define P(args) args -#else -#define P(args) () -#endif - #ifdef DEBUG -static void dump_generic P((FILE *, struct shared_bindata *)); -static void dump_host P((FILE *, struct host *)); -static void list_ipaddresses P((FILE *, struct in_addr_list *)); +static void dump_generic(FILE *, struct shared_bindata *); +static void dump_host(FILE *, struct host *); +static void list_ipaddresses(FILE *, struct in_addr_list *); #endif -#undef P - #ifndef DEBUG void -dumptab(filename) - char *filename; +dumptab(char *filename) { report(LOG_INFO, "No dumptab support!"); } @@ -58,8 +49,7 @@ dumptab(filename) */ void -dumptab(filename) - char *filename; +dumptab(char *filename) { int n; struct host *hp; @@ -139,9 +129,7 @@ dumptab(filename) */ static void -dump_host(fp, hp) - FILE *fp; - struct host *hp; +dump_host(FILE *fp, struct host *hp) { /* Print symbols in alphabetical order for reader's convenience. */ if (hp) { @@ -308,9 +296,7 @@ dump_host(fp, hp) static void -dump_generic(fp, generic) - FILE *fp; - struct shared_bindata *generic; +dump_generic(FILE *fp, struct shared_bindata *generic) { u_char *bp = generic->data; u_char *ep = bp + generic->length; @@ -353,9 +339,7 @@ dump_generic(fp, generic) */ static void -list_ipaddresses(fp, ipptr) - FILE *fp; - struct in_addr_list *ipptr; +list_ipaddresses(FILE *fp, struct in_addr_list *ipptr) { unsigned count; struct in_addr *addrptr; diff --git a/libexec/bootpd/getether.c b/libexec/bootpd/getether.c index f77735678b..a4f9c44ea2 100644 --- a/libexec/bootpd/getether.c +++ b/libexec/bootpd/getether.c @@ -119,16 +119,18 @@ getether(ifname, eap) #include #include +/* + * ifname - interface name from ifconfig structure + * eap - Ether address (output) + */ int -getether(ifname, eap) - char *ifname; /* interface name from ifconfig structure */ - char *eap; /* Ether address (output) */ +getether(char *ifname, char *eap) { int fd, rc = -1; - register int n; + int n; struct ifreq ibuf[16]; struct ifconf ifc; - register struct ifreq *ifrp, *ifend; + struct ifreq *ifrp, *ifend; /* Fetch the interface configuration */ fd = socket(AF_INET, SOCK_DGRAM, 0); diff --git a/libexec/bootpd/getif.c b/libexec/bootpd/getif.c index fef1f8ce70..b5b84ec65b 100644 --- a/libexec/bootpd/getif.c +++ b/libexec/bootpd/getif.c @@ -39,11 +39,14 @@ static struct ifconf ifconf; /* points to ifreq */ static int nmatch(); -/* Return a pointer to the interface struct for the passed address. */ +/* + * Return a pointer to the interface struct for the passed address. + * + * s socket file descriptor + * addrp destination address on interface + */ struct ifreq * -getif(s, addrp) - int s; /* socket file descriptor */ - struct in_addr *addrp; /* destination address on interface */ +getif(int s, struct in_addr *addrp) { int maxmatch; int len, m, incr; @@ -109,10 +112,11 @@ getif(s, addrp) /* * Return the number of leading bits matching in the * internet addresses supplied. + * + * ca, cb ptrs to IP address, network order */ static int -nmatch(ca, cb) - u_char *ca, *cb; /* ptrs to IP address, network order */ +nmatch(u_char *ca, u_char *cb) { u_int m = 0; /* count of matching bits */ u_int n = 4; /* bytes left, then bitmask */ diff --git a/libexec/bootpd/hash.c b/libexec/bootpd/hash.c index dd8a852ac6..6397717b8e 100644 --- a/libexec/bootpd/hash.c +++ b/libexec/bootpd/hash.c @@ -59,15 +59,7 @@ SOFTWARE. #define PRIVATE static #endif -#ifdef __STDC__ -#define P(args) args -#else -#define P(args) () -#endif - -PRIVATE void hashi_FreeMembers P((hash_member *, hash_freefp)); - -#undef P +PRIVATE void hashi_FreeMembers(hash_member *, hash_freefp); @@ -81,11 +73,10 @@ PRIVATE void hashi_FreeMembers P((hash_member *, hash_freefp)); */ hash_tbl * -hash_Init(tablesize) - unsigned tablesize; +hash_Init(unsigned tablesize) { - register hash_tbl *hashtblptr; - register unsigned totalsize; + hash_tbl *hashtblptr; + unsigned totalsize; if (tablesize > 0) { totalsize = sizeof(hash_tbl) @@ -111,9 +102,7 @@ hash_Init(tablesize) */ PRIVATE void -hashi_FreeMembers(bucketptr, free_data) - hash_member *bucketptr; - hash_freefp free_data; +hashi_FreeMembers(hash_member *bucketptr, hash_freefp free_data) { hash_member *nextbucket; while (bucketptr) { @@ -133,9 +122,7 @@ hashi_FreeMembers(bucketptr, free_data) */ void -hash_Reset(hashtable, free_data) - hash_tbl *hashtable; - hash_freefp free_data; +hash_Reset(hash_tbl *hashtable, hash_freefp free_data) { hash_member **bucketptr; unsigned i; @@ -172,11 +159,9 @@ hash_Reset(hashtable, free_data) */ unsigned -hash_HashFunction(string, len) - unsigned char *string; - register unsigned len; +hash_HashFunction(unsigned char *string, unsigned len) { - register unsigned accum; + unsigned accum; accum = 0; for (; len > 0; len--) { @@ -194,13 +179,10 @@ hash_HashFunction(string, len) */ int -hash_Exists(hashtable, hashcode, compare, key) - hash_tbl *hashtable; - unsigned hashcode; - hash_cmpfp compare; - hash_datum *key; +hash_Exists(hash_tbl *hashtable, unsigned hashcode, hash_cmpfp compare, + hash_datum *key) { - register hash_member *memberptr; + hash_member *memberptr; memberptr = (hashtable->table)[hashcode % (hashtable->size)]; while (memberptr) { @@ -225,11 +207,8 @@ hash_Exists(hashtable, hashcode, compare, key) */ int -hash_Insert(hashtable, hashcode, compare, key, element) - hash_tbl *hashtable; - unsigned hashcode; - hash_cmpfp compare; - hash_datum *key, *element; +hash_Insert(hash_tbl *hashtable, unsigned hashcode, hash_cmpfp compare, + hash_datum *key, hash_datum *element) { hash_member *temp; @@ -256,12 +235,8 @@ hash_Insert(hashtable, hashcode, compare, key, element) */ int -hash_Delete(hashtable, hashcode, compare, key, free_data) - hash_tbl *hashtable; - unsigned hashcode; - hash_cmpfp compare; - hash_datum *key; - hash_freefp free_data; +hash_Delete(hash_tbl *hashtable, unsigned hashcode, hash_cmpfp compare, + hash_datum *key, hash_freefp free_data) { hash_member *memberptr, *tempptr; hash_member *previous = NULL; @@ -322,11 +297,8 @@ hash_Delete(hashtable, hashcode, compare, key, free_data) */ hash_datum * -hash_Lookup(hashtable, hashcode, compare, key) - hash_tbl *hashtable; - unsigned hashcode; - hash_cmpfp compare; - hash_datum *key; +hash_Lookup(hash_tbl *hashtable, unsigned hashcode, hash_cmpfp compare, + hash_datum *key) { hash_member *memberptr; @@ -347,11 +319,10 @@ hash_Lookup(hashtable, hashcode, compare, key) */ hash_datum * -hash_NextEntry(hashtable) - hash_tbl *hashtable; +hash_NextEntry(hash_tbl *hashtable) { - register unsigned bucket; - register hash_member *memberptr; + unsigned bucket; + hash_member *memberptr; /* * First try to pick up where we left off. @@ -400,8 +371,7 @@ hash_NextEntry(hashtable) */ hash_datum * -hash_FirstEntry(hashtable) - hash_tbl *hashtable; +hash_FirstEntry(hash_tbl *hashtable) { hashtable->bucketnum = 0; hashtable->member = (hashtable->table)[0]; diff --git a/libexec/bootpd/hash.h b/libexec/bootpd/hash.h index 51d0a5ebd3..8f110a6188 100644 --- a/libexec/bootpd/hash.h +++ b/libexec/bootpd/hash.h @@ -119,40 +119,31 @@ struct hash_tblstruct { hash_member *table[1]; /* Dynamically extended */ }; -/* ANSI function prototypes or empty arg list? */ -#ifdef __STDC__ -#define P(args) args -#else -#define P(args) () -#endif +typedef int (*hash_cmpfp)(hash_datum *, hash_datum *); +typedef void (*hash_freefp)(hash_datum *); -typedef int (*hash_cmpfp) P((hash_datum *, hash_datum *)); -typedef void (*hash_freefp) P((hash_datum *)); +extern hash_tbl *hash_Init(u_int tablesize); -extern hash_tbl *hash_Init P((u_int tablesize)); +extern void hash_Reset(hash_tbl *tbl, hash_freefp); -extern void hash_Reset P((hash_tbl *tbl, hash_freefp)); +extern unsigned hash_HashFunction(u_char *str, u_int len); -extern unsigned hash_HashFunction P((u_char *str, u_int len)); +extern int hash_Exists(hash_tbl *, u_int code, + hash_cmpfp, hash_datum *key); -extern int hash_Exists P((hash_tbl *, u_int code, - hash_cmpfp, hash_datum *key)); - -extern int hash_Insert P((hash_tbl *, u_int code, +extern int hash_Insert(hash_tbl *, u_int code, hash_cmpfp, hash_datum *key, - hash_datum *element)); + hash_datum *element); -extern int hash_Delete P((hash_tbl *, u_int code, +extern int hash_Delete(hash_tbl *, u_int code, hash_cmpfp, hash_datum *key, - hash_freefp)); - -extern hash_datum *hash_Lookup P((hash_tbl *, u_int code, - hash_cmpfp, hash_datum *key)); + hash_freefp); -extern hash_datum *hash_FirstEntry P((hash_tbl *)); +extern hash_datum *hash_Lookup(hash_tbl *, u_int code, + hash_cmpfp, hash_datum *key); -extern hash_datum *hash_NextEntry P((hash_tbl *)); +extern hash_datum *hash_FirstEntry(hash_tbl *); -#undef P +extern hash_datum *hash_NextEntry(hash_tbl *); #endif /* HASH_H */ diff --git a/libexec/bootpd/hwaddr.c b/libexec/bootpd/hwaddr.c index 1854924191..33e7a34d13 100644 --- a/libexec/bootpd/hwaddr.c +++ b/libexec/bootpd/hwaddr.c @@ -88,14 +88,14 @@ int hwinfocnt = sizeof(hwinfolist) / sizeof(hwinfolist[0]); /* * Setup the arp cache so that IP address 'ia' will be temporarily * bound to hardware address 'ha' of length 'len'. + * + * s socket fd + * ia protocol address + * hafamily HW address family + * halen HW address data */ void -setarp(s, ia, hafamily, haddr, halen) - int s; /* socket fd */ - struct in_addr *ia; /* protocol address */ - int hafamily; /* HW address family */ - u_char *haddr; /* HW address data */ - int halen; +setarp(int s, struct in_addr *ia, int hafamily, u_char *haddr, int halen) { #ifdef SIOCSARP #ifdef WIN_TCP @@ -216,9 +216,7 @@ setarp(s, ia, hafamily, haddr, halen) * Convert a hardware address to an ASCII string. */ char * -haddrtoa(haddr, hlen) - u_char *haddr; - int hlen; +haddrtoa(u_char *haddr, int hlen) { static char haddrbuf[3 * MAXHADDRLEN + 1]; char *bufptr; @@ -295,9 +293,7 @@ static u_char conv802table[256] = }; void -haddr_conv802(addr_in, addr_out, len) - register u_char *addr_in, *addr_out; - int len; +haddr_conv802(u_char *addr_in, u_char *addr_out, int len) { u_char *lim; @@ -312,8 +308,7 @@ haddr_conv802(addr_in, addr_out, len) * bit-reverse table above. */ static int -bitrev(n) - int n; +bitrev(int n) { int i, r; @@ -326,7 +321,8 @@ bitrev(n) return r; } -main() +int +main(void) { int i; for (i = 0; i <= 0xFF; i++) { @@ -336,6 +332,7 @@ main() if ((i & 7) == 7) printf("\n"); } + return 0; } #endif diff --git a/libexec/bootpd/hwaddr.h b/libexec/bootpd/hwaddr.h index 6ab5742fe6..3addcae9ed 100644 --- a/libexec/bootpd/hwaddr.h +++ b/libexec/bootpd/hwaddr.h @@ -23,17 +23,9 @@ struct hwinfo { extern struct hwinfo hwinfolist[]; extern int hwinfocnt; -#ifdef __STDC__ -#define P(args) args -#else -#define P(args) () -#endif - -extern void setarp P((int, struct in_addr *, int, u_char *, int)); -extern char *haddrtoa P((u_char *, int)); -extern void haddr_conv802 P((u_char *, u_char *, int)); - -#undef P +extern void setarp(int, struct in_addr *, int, u_char *, int); +extern char *haddrtoa(u_char *, int); +extern void haddr_conv802(u_char *, u_char *, int); /* * Return the length in bytes of a hardware address of the given type. diff --git a/libexec/bootpd/lookup.c b/libexec/bootpd/lookup.c index 1b910c81be..2e196d587e 100644 --- a/libexec/bootpd/lookup.c +++ b/libexec/bootpd/lookup.c @@ -35,9 +35,7 @@ extern int ether_hostton(); * Return NULL if addr not found. */ u_char * -lookup_hwa(hostname, htype) - char *hostname; - int htype; +lookup_hwa(char *hostname, int htype) { switch (htype) { @@ -71,9 +69,7 @@ lookup_hwa(hostname, htype) * Return non-zero on failure. */ int -lookup_ipa(hostname, result) - char *hostname; - u_int32 *result; +lookup_ipa(char *hostname, u_int32 *result) { struct hostent *hp; hp = gethostbyname(hostname); @@ -86,16 +82,14 @@ lookup_ipa(hostname, result) /* * Lookup a netmask - * Return non-zero on failure. + * addr and result are both in network order. Return non-zero on failure. * * XXX - This is OK as a default, but to really make this automatic, * we would need to get the subnet mask from the ether interface. * If this is wrong, specify the correct value in the bootptab. */ int -lookup_netmask(addr, result) - u_int32 addr; /* both in network order */ - u_int32 *result; +lookup_netmask(u_int32 addr, u_int32 *result) { int32 m, a; diff --git a/libexec/bootpd/lookup.h b/libexec/bootpd/lookup.h index 04805d8915..3b18909673 100644 --- a/libexec/bootpd/lookup.h +++ b/libexec/bootpd/lookup.h @@ -2,14 +2,6 @@ #include "bptypes.h" /* for int32, u_int32 */ -#ifdef __STDC__ -#define P(args) args -#else -#define P(args) () -#endif - -extern u_char *lookup_hwa P((char *hostname, int htype)); -extern int lookup_ipa P((char *hostname, u_int32 *addr)); -extern int lookup_netmask P((u_int32 addr, u_int32 *mask)); - -#undef P +extern u_char *lookup_hwa(char *hostname, int htype); +extern int lookup_ipa(char *hostname, u_int32 *addr); +extern int lookup_netmask(u_int32 addr, u_int32 *mask); diff --git a/libexec/bootpd/readfile.c b/libexec/bootpd/readfile.c index 9426065fe1..1ecd9a7f9b 100644 --- a/libexec/bootpd/readfile.c +++ b/libexec/bootpd/readfile.c @@ -228,63 +228,55 @@ PRIVATE struct htypename htnamemap[] = { * Externals and forward declarations. */ -#ifdef __STDC__ -#define P(args) args -#else -#define P(args) () -#endif - extern boolean iplookcmp(); -boolean nmcmp P((hash_datum *, hash_datum *)); +boolean nmcmp(hash_datum *, hash_datum *); PRIVATE void - adjust P((char **)); + adjust(char **); PRIVATE void - del_string P((struct shared_string *)); + del_string(struct shared_string *); PRIVATE void - del_bindata P((struct shared_bindata *)); + del_bindata(struct shared_bindata *); PRIVATE void - del_iplist P((struct in_addr_list *)); + del_iplist(struct in_addr_list *); PRIVATE void - eat_whitespace P((char **)); + eat_whitespace(char **); PRIVATE int - eval_symbol P((char **, struct host *)); + eval_symbol(char **, struct host *); PRIVATE void - fill_defaults P((struct host *, char **)); + fill_defaults(struct host *, char **); PRIVATE void - free_host P((hash_datum *)); + free_host(hash_datum *); PRIVATE struct in_addr_list * - get_addresses P((char **)); + get_addresses(char **); PRIVATE struct shared_string * - get_shared_string P((char **)); + get_shared_string(char **); PRIVATE char * - get_string P((char **, char *, u_int *)); + get_string(char **, char *, u_int *); PRIVATE u_int32 - get_u_long P((char **)); + get_u_long(char **); PRIVATE boolean - goodname P((char *)); + goodname(char *); PRIVATE boolean - hwinscmp P((hash_datum *, hash_datum *)); + hwinscmp(hash_datum *, hash_datum *); PRIVATE int - interp_byte P((char **, byte *)); + interp_byte(char **, byte *); PRIVATE void - makelower P((char *)); + makelower(char *); PRIVATE boolean - nullcmp P((hash_datum *, hash_datum *)); + nullcmp(hash_datum *, hash_datum *); PRIVATE int - process_entry P((struct host *, char *)); + process_entry(struct host *, char *); PRIVATE int - process_generic P((char **, struct shared_bindata **, u_int)); + process_generic(char **, struct shared_bindata **, u_int); PRIVATE byte * - prs_haddr P((char **, u_int)); + prs_haddr(char **, u_int); PRIVATE int - prs_inetaddr P((char **, u_int32 *)); + prs_inetaddr(char **, u_int32 *); PRIVATE void - read_entry P((FILE *, char *, u_int *)); + read_entry(FILE *, char *, u_int *); PRIVATE char * - smalloc P((u_int)); - -#undef P + smalloc(u_int); /* @@ -305,7 +297,7 @@ hash_tbl *nmhashtable; * (shared by bootpd and bootpef) */ void -rdtab_init() +rdtab_init(void) { hwhashtable = hash_Init(HASHTABLESIZE); iphashtable = hash_Init(HASHTABLESIZE); @@ -323,8 +315,7 @@ rdtab_init() */ void -readtab(force) - int force; +readtab(int force) { struct host *hp; FILE *fp; @@ -506,10 +497,7 @@ readtab(force) */ PRIVATE void -read_entry(fp, buffer, bufsiz) - FILE *fp; - char *buffer; - unsigned *bufsiz; +read_entry(FILE *fp, char *buffer, unsigned *bufsiz) { int c, length; @@ -645,9 +633,7 @@ read_entry(fp, buffer, bufsiz) */ PRIVATE int -process_entry(host, src) - struct host *host; - char *src; +process_entry(struct host *host, char *src) { int retval; char *msg; @@ -791,9 +777,7 @@ process_entry(host, src) * Obviously, this need a few more comments. . . . */ PRIVATE int -eval_symbol(symbol, hp) - char **symbol; - struct host *hp; +eval_symbol(char **symbol, struct host *hp) { char tmpstr[MAXSTRINGLEN]; byte *tmphaddr; @@ -1165,9 +1149,7 @@ eval_symbol(symbol, hp) */ PRIVATE char * -get_string(src, dest, length) - char **src, *dest; - unsigned *length; +get_string(char **src, char *dest, unsigned *length) { int n, len, quoteflag; @@ -1217,8 +1199,7 @@ get_string(src, dest, length) */ PRIVATE struct shared_string * -get_shared_string(src) - char **src; +get_shared_string(char **src) { char retstring[MAXSTRINGLEN]; struct shared_string *s; @@ -1254,10 +1235,7 @@ get_shared_string(src) */ PRIVATE int -process_generic(src, dest, tagvalue) - char **src; - struct shared_bindata **dest; - u_int tagvalue; +process_generic(char **src, struct shared_bindata **dest, u_int tagvalue) { byte tmpbuf[MAXBUFLEN]; byte *str; @@ -1312,8 +1290,7 @@ process_generic(src, dest, tagvalue) */ PRIVATE boolean -goodname(hostname) - register char *hostname; +goodname(char *hostname) { do { if (!isalpha(*hostname++)) { /* First character must be a letter */ @@ -1345,8 +1322,7 @@ goodname(hostname) */ PRIVATE boolean -nullcmp(d1, d2) - hash_datum *d1, *d2; +nullcmp(hash_datum *d1, hash_datum *d2) { return FALSE; } @@ -1358,8 +1334,7 @@ nullcmp(d1, d2) */ boolean -nmcmp(d1, d2) - hash_datum *d1, *d2; +nmcmp(hash_datum *d1, hash_datum *d2) { char *name = (char *) d1; /* XXX - OK? */ struct host *hp = (struct host *) d2; @@ -1381,8 +1356,7 @@ nmcmp(d1, d2) */ PRIVATE boolean -hwinscmp(d1, d2) - hash_datum *d1, *d2; +hwinscmp(hash_datum *d1, hash_datum *d2) { struct host *host1 = (struct host *) d1; struct host *host2 = (struct host *) d2; @@ -1437,9 +1411,7 @@ hwinscmp(d1, d2) * current host entry are inferred from the template entry. */ PRIVATE void -fill_defaults(hp, src) - struct host *hp; - char **src; +fill_defaults(struct host *hp, char **src) { unsigned int tlen, hashcode; struct host *hp2; @@ -1529,10 +1501,9 @@ fill_defaults(hp, src) */ PRIVATE void -adjust(s) - char **s; +adjust(char **s) { - register char *t; + char *t; t = *s; while (*t && (*t != ':')) { @@ -1554,10 +1525,9 @@ adjust(s) */ PRIVATE void -eat_whitespace(s) - char **s; +eat_whitespace(char **s) { - register char *t; + char *t; t = *s; while (*t && isspace(*t)) { @@ -1573,8 +1543,7 @@ eat_whitespace(s) */ PRIVATE void -makelower(s) - char *s; +makelower(char *s) { while (*s) { if (isupper(*s)) { @@ -1614,8 +1583,7 @@ makelower(s) */ PRIVATE struct in_addr_list * -get_addresses(src) - char **src; +get_addresses(char **src) { struct in_addr tmpaddrlist[MAXINADDRS]; struct in_addr *address1, *address2; @@ -1671,12 +1639,10 @@ get_addresses(src) */ PRIVATE int -prs_inetaddr(src, result) - char **src; - u_int32 *result; +prs_inetaddr(char **src, u_int32 *result) { char tmpstr[MAXSTRINGLEN]; - register u_int32 value; + u_int32 value; u_int32 parts[4], *pp; int n; char *s, *t; @@ -1771,9 +1737,7 @@ prs_inetaddr(src, result) */ PRIVATE byte * -prs_haddr(src, htype) - char **src; - u_int htype; +prs_haddr(char **src, u_int htype) { static byte haddr[MAXHADDRLEN]; byte *hap; @@ -1826,9 +1790,7 @@ prs_haddr(src, htype) */ PRIVATE int -interp_byte(src, retbyte) - char **src; - byte *retbyte; +interp_byte(char **src, byte *retbyte) { int v; @@ -1858,10 +1820,9 @@ interp_byte(src, retbyte) */ PRIVATE u_int32 -get_u_long(src) - char **src; +get_u_long(char **src) { - register u_int32 value, base; + u_int32 value, base; char c; /* @@ -1907,8 +1868,7 @@ get_u_long(src) */ PRIVATE void -free_host(hmp) - hash_datum *hmp; +free_host(hash_datum *hmp) { struct host *hostptr = (struct host *) hmp; if (hostptr == NULL) @@ -1964,8 +1924,7 @@ free_host(hmp) */ PRIVATE void -del_iplist(iplist) - struct in_addr_list *iplist; +del_iplist(struct in_addr_list *iplist) { if (iplist) { if (!(--(iplist->linkcount))) { @@ -1983,8 +1942,7 @@ del_iplist(iplist) */ PRIVATE void -del_string(stringptr) - struct shared_string *stringptr; +del_string(struct shared_string *stringptr) { if (stringptr) { if (!(--(stringptr->linkcount))) { @@ -2002,8 +1960,7 @@ del_string(stringptr) */ PRIVATE void -del_bindata(dataptr) - struct shared_bindata *dataptr; +del_bindata(struct shared_bindata *dataptr) { if (dataptr) { if (!(--(dataptr->linkcount))) { @@ -2024,8 +1981,7 @@ del_bindata(dataptr) */ PRIVATE char * -smalloc(nbytes) - unsigned nbytes; +smalloc(unsigned nbytes) { char *retvalue; @@ -2049,8 +2005,7 @@ smalloc(nbytes) */ boolean -hwlookcmp(d1, d2) - hash_datum *d1, *d2; +hwlookcmp(hash_datum *d1, hash_datum *d2) { struct host *host1 = (struct host *) d1; struct host *host2 = (struct host *) d2; @@ -2070,8 +2025,7 @@ hwlookcmp(d1, d2) */ boolean -iplookcmp(d1, d2) - hash_datum *d1, *d2; +iplookcmp(hash_datum *d1, hash_datum *d2) { struct host *host1 = (struct host *) d1; struct host *host2 = (struct host *) d2; diff --git a/libexec/bootpd/readfile.h b/libexec/bootpd/readfile.h index 3913455857..5da0c42af4 100644 --- a/libexec/bootpd/readfile.h +++ b/libexec/bootpd/readfile.h @@ -3,17 +3,8 @@ #include "bptypes.h" #include "hash.h" -#ifdef __STDC__ -#define P(args) args -#else -#define P(args) () -#endif - -extern boolean hwlookcmp P((hash_datum *, hash_datum *)); -extern boolean iplookcmp P((hash_datum *, hash_datum *)); -extern boolean nmcmp P((hash_datum *, hash_datum *)); -extern void readtab P((int)); -extern void rdtab_init P((void)); - -#undef P - +extern boolean hwlookcmp(hash_datum *, hash_datum *); +extern boolean iplookcmp(hash_datum *, hash_datum *); +extern boolean nmcmp(hash_datum *, hash_datum *); +extern void readtab(int); +extern void rdtab_init(void); diff --git a/libexec/bootpd/report.c b/libexec/bootpd/report.c index b864c84dba..1616134880 100644 --- a/libexec/bootpd/report.c +++ b/libexec/bootpd/report.c @@ -38,8 +38,7 @@ extern char *progname; static int stderr_only = 1; void -report_init(nolog) - int nolog; +report_init(int nolog) { stderr_only = nolog; #ifdef SYSLOG @@ -138,7 +137,7 @@ report(priority, fmt, va_alist) * Return pointer to static string which gives full filesystem error message. */ const char * -get_errmsg() +get_errmsg(void) { return strerror(errno); } diff --git a/libexec/bootpd/report.h b/libexec/bootpd/report.h index 025a2303cf..f4c998a554 100644 --- a/libexec/bootpd/report.h +++ b/libexec/bootpd/report.h @@ -2,14 +2,6 @@ /* $FreeBSD: src/libexec/bootpd/report.h,v 1.1.1.1.14.2 2003/02/15 05:36:01 kris Exp $ */ /* $DragonFly: src/libexec/bootpd/report.h,v 1.2 2003/06/17 04:27:07 dillon Exp $ */ -#ifdef __STDC__ -#define P(args) args -#else -#define P(args) () -#endif - -extern void report_init P((int nolog)); -extern void report P((int, const char *, ...)) __printflike(2, 3); -extern const char *get_errmsg P((void)); - -#undef P +extern void report_init(int nolog); +extern void report(int, const char *, ...) __printflike(2, 3); +extern const char *get_errmsg(void); diff --git a/libexec/bootpd/rtmsg.c b/libexec/bootpd/rtmsg.c index 641e4bcbef..5f29b85c2e 100644 --- a/libexec/bootpd/rtmsg.c +++ b/libexec/bootpd/rtmsg.c @@ -82,7 +82,9 @@ static int s = -1; /* routing socket */ /* * Open the routing socket */ -static void getsocket () { +static void +getsocket(void) +{ if (s < 0) { s = socket(PF_ROUTE, SOCK_RAW, 0); if (s < 0) { @@ -116,14 +118,12 @@ static struct { /* * Set an individual arp entry */ -int bsd_arp_set(ia, eaddr, len) - struct in_addr *ia; - char *eaddr; - int len; +int +bsd_arp_set(struct in_addr *ia, char *eaddr, int len) { - register struct sockaddr_inarp *sin = &sin_m; - register struct sockaddr_dl *sdl; - register struct rt_msghdr *rtm = &(m_rtmsg.m_rtm); + struct sockaddr_inarp *sin = &sin_m; + struct sockaddr_dl *sdl; + struct rt_msghdr *rtm = &(m_rtmsg.m_rtm); u_char *ea; struct timeval time; int op = RTM_ADD; @@ -185,14 +185,14 @@ overwrite: } -static int rtmsg(cmd) - int cmd; +static int +rtmsg(int cmd) { static int seq; int rlen; - register struct rt_msghdr *rtm = &m_rtmsg.m_rtm; - register char *cp = m_rtmsg.m_space; - register int l; + struct rt_msghdr *rtm = &m_rtmsg.m_rtm; + char *cp = m_rtmsg.m_space; + int l; errno = 0; bzero((char *)&m_rtmsg, sizeof(m_rtmsg)); diff --git a/libexec/bootpd/tools/bootpef/bootpef.c b/libexec/bootpd/tools/bootpef/bootpef.c index a52a14151e..0bd4891bae 100644 --- a/libexec/bootpd/tools/bootpef/bootpef.c +++ b/libexec/bootpd/tools/bootpef/bootpef.c @@ -90,16 +90,8 @@ SOFTWARE. * Externals, forward declarations, and global variables */ -#ifdef __STDC__ -#define P(args) args -#else -#define P(args) () -#endif - -static void mktagfile P((struct host *)); -static void usage P((void)); - -#undef P +static void mktagfile(struct host *); +static void usage(void); /* @@ -122,7 +114,7 @@ char *bootptab = CONFIG_FILE; * Print "usage" message and exit */ static void -usage() +usage(void) { fprintf(stderr, "usage: $s [ -c chdir ] [-d level] [-f configfile] [host...]\n"); @@ -138,9 +130,7 @@ usage() * main server loop is started. */ int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { struct host *hp; char *stmp; @@ -284,8 +274,7 @@ main(argc, argv) */ static void -mktagfile(hp) - struct host *hp; +mktagfile(struct host *hp) { FILE *fp; int bytesleft, len; diff --git a/libexec/bootpd/tools/bootptest/bootptest.c b/libexec/bootpd/tools/bootptest/bootptest.c index a8b48ef9f7..1ce0b4affb 100644 --- a/libexec/bootpd/tools/bootptest/bootptest.c +++ b/libexec/bootpd/tools/bootptest/bootptest.c @@ -129,9 +129,7 @@ extern void bootp_print(); */ int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { struct bootp *bp; struct servent *sep; @@ -443,8 +441,7 @@ main(argc, argv) } static void -send_request(s) - int s; +send_request(int s) { /* Print the request packet. */ printf("Sending to %s", inet_ntoa(sin_server.sin_addr)); @@ -466,10 +463,9 @@ send_request(s) * Return true if truncated. */ int -printfn(s, ep) - register u_char *s, *ep; +printfn(u_char *s, u_char *ep) { - register u_char c; + u_char c; putchar('"'); while ((c = *s++) != '\0') { @@ -497,8 +493,7 @@ printfn(s, ep) * (like inet_ntoa, but ina is a pointer) */ char * -ipaddr_string(ina) - struct in_addr *ina; +ipaddr_string(struct in_addr *ina) { static char b[24]; u_char *p; diff --git a/libexec/bootpd/tools/bootptest/bootptest.h b/libexec/bootpd/tools/bootptest/bootptest.h index 27f78ba963..24bdc75175 100644 --- a/libexec/bootpd/tools/bootptest/bootptest.h +++ b/libexec/bootpd/tools/bootptest/bootptest.h @@ -19,12 +19,4 @@ extern int vflag; /* verbose flag */ extern unsigned char *packetp; extern unsigned char *snapend; -#ifdef __STDC__ -#define P(args) args -#else -#define P(args) () -#endif - -extern char *ipaddr_string P((struct in_addr *)); - -#undef P +extern char *ipaddr_string(struct in_addr *); diff --git a/libexec/bootpd/tools/bootptest/print-bootp.c b/libexec/bootpd/tools/bootptest/print-bootp.c index 758baefb74..3521ff45e2 100644 --- a/libexec/bootpd/tools/bootptest/print-bootp.c +++ b/libexec/bootpd/tools/bootptest/print-bootp.c @@ -54,10 +54,7 @@ static void dump_hex(); * Print bootp requests */ void -bootp_print(bp, length, sport, dport) - struct bootp *bp; - int length; - u_short sport, dport; +bootp_print(struct bootp *bp, int length, u_short sport, u_short dport) { static char tstr[] = " [|bootp]"; static unsigned char vm_cmu[4] = VM_CMU; @@ -102,8 +99,8 @@ bootp_print(bp, length, sport, dport) /* Client's Hardware address */ if (bp->bp_hlen) { - register struct ether_header *eh; - register char *e; + struct ether_header *eh; + char *e; TCHECK(bp->bp_chaddr[0], 6); eh = (struct ether_header *) packetp; @@ -275,13 +272,11 @@ rfc1048_opts[] = { #define KNOWN_OPTIONS (sizeof(rfc1048_opts) / sizeof(rfc1048_opts[0])) static void -rfc1048_print(bp, length) - register u_char *bp; - int length; +rfc1048_print(u_char *bp, int length) { u_char tag; u_char *ep; - register int len; + int len; u_int32 ul; u_short us; struct in_addr ia; @@ -377,9 +372,7 @@ rfc1048_print(bp, length) } static void -cmu_print(bp, length) - register u_char *bp; - int length; +cmu_print(u_char *bp, int length) { struct cmu_vend *v; u_char *ep; @@ -428,9 +421,7 @@ cmu_print(bp, length) */ static void -other_print(bp, length) - register u_char *bp; - int length; +other_print(u_char *bp, int length) { u_char *ep; /* end pointer */ u_char *zp; /* points one past last non-zero byte */ @@ -468,9 +459,7 @@ other_print(bp, length) } static void -dump_hex(bp, len) - u_char *bp; - int len; +dump_hex(u_char *bp, int len) { while (len > 0) { printf("%02X", *bp); diff --git a/libexec/bootpd/tzone.c b/libexec/bootpd/tzone.c index 0fbe494513..b681a86802 100644 --- a/libexec/bootpd/tzone.c +++ b/libexec/bootpd/tzone.c @@ -29,7 +29,7 @@ int32 secondswest; * configuration file doesn't specify one. */ void -tzone_init() +tzone_init(void) { #ifdef SVR4 /* XXX - Is this really SunOS specific? -gwr */ -- 2.11.4.GIT