*** SPAM *** [PATCH] libexec/bootpd WARNS=6, style(9) cleanup
Joe Talbott
josepht at cstone.net
Wed May 4 13:08:29 PDT 2005
Here's a patch for WARNS=6 and style(9) cleanup of libexec/bootpd.
Joe
Index: Makefile
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- Makefile 17 Jun 2003 04:27:07 -0000 1.2
+++ Makefile 3 May 2005 17:26:44 -0000
@@ -6,6 +6,8 @@
CFLAGS+= -DETC_ETHERS
CFLAGS+= -DSYSLOG -DDEBUG -DVEND_CMU
+WARNS?= 6
+
SUBDIR= bootpgw tools
SRCS= bootpd.c dovend.c readfile.c hash.c dumptab.c \
Index: bootpd.c
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/bootpd.c,v
retrieving revision 1.2
diff -u -r1.2 bootpd.c
--- bootpd.c 17 Jun 2003 04:27:07 -0000 1.2
+++ bootpd.c 4 May 2005 19:31:20 -0000
@@ -106,26 +106,19 @@
* 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(const 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));
+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);
-#undef P
/*
* IP port numbers for client and server obtained from /etc/services
@@ -159,7 +152,7 @@
int s; /* Socket file descriptor */
char *pktbuf; /* Receive packet buffer */
-int pktlen;
+size_t pktlen;
char *progname;
char *chdir_path;
struct in_addr my_ip_addr;
@@ -175,8 +168,8 @@
* Globals below are associated with the bootp database file (bootptab).
*/
-char *bootptab = CONFIG_FILE;
-char *bootpd_dump = DUMPTAB_FILE;
+const char *bootptab = CONFIG_FILE;
+const char *bootpd_dump = DUMPTAB_FILE;
@@ -186,16 +179,16 @@
*/
int
-main(argc, argv)
- int argc;
- char **argv;
+main(int argc, char **argv)
{
struct timeval *timeout;
struct bootp *bp;
struct servent *servp;
struct hostent *hep;
char *stmp;
- int n, ba_len, ra_len;
+ int n;
+ int ba_len;
+ int ra_len;
int nfound, readfds;
int standalone;
#ifdef SA_NOCLDSTOP /* Have POSIX sigaction(2). */
@@ -400,7 +393,7 @@
n = open(_PATH_TTY, O_RDWR);
if (n >= 0) {
ioctl(n, TIOCNOTTY, (char *) 0);
- (void) close(n);
+ close(n);
}
#endif /* TIOCNOTTY */
#else /* SETSID */
@@ -556,7 +549,7 @@
report(LOG_INFO, "recvd pkt from IP addr %s",
inet_ntoa(recv_addr.sin_addr));
}
- if (n < sizeof(struct bootp)) {
+ if (n < (int)sizeof(struct bootp)) {
if (debug) {
report(LOG_NOTICE, "received short packet");
}
@@ -575,7 +568,7 @@
break;
}
}
- return 0;
+ return(0);
}
@@ -586,7 +579,7 @@
*/
PRIVATE void
-usage()
+usage(void)
{
fprintf(stderr,
"usage: bootpd [-d level] [-i] [-s] [-t timeout] [configfile [dumpfile]]\n");
@@ -600,8 +593,7 @@
/* Signal catchers */
PRIVATE void
-catcher(sig)
- int sig;
+catcher(int sig)
{
if (sig == SIGHUP)
do_readtab = 1;
@@ -627,7 +619,7 @@
* forward the request there.)
*/
PRIVATE void
-handle_request()
+handle_request(void)
{
struct bootp *bp = (struct bootp *) pktbuf;
struct host *hp = NULL;
@@ -635,7 +627,7 @@
int32 bootsize = 0;
unsigned hlen, hashcode;
int32 dest;
- char realpath[1024];
+ char rpath[1024];
char *clntpath;
char *homedir, *bootfile;
int n;
@@ -840,11 +832,11 @@
* daemon chroot directory (i.e. /tftpboot).
*/
if (hp->flags.tftpdir) {
- snprintf(realpath, sizeof(realpath), "%s", hp->tftpdir->string);
- clntpath = &realpath[strlen(realpath)];
+ snprintf(rpath, sizeof(rpath), "%s", hp->tftpdir->string);
+ clntpath = &rpath[strlen(rpath)];
} else {
- realpath[0] = '\0';
- clntpath = realpath;
+ rpath[0] = '\0';
+ clntpath = rpath;
}
/*
@@ -901,9 +893,9 @@
n = strlen(clntpath);
strcat(clntpath, ".");
strcat(clntpath, hp->hostname->string);
- if (chk_access(realpath, &bootsize) < 0) {
+ if (chk_access(rpath, &bootsize) < 0) {
clntpath[n] = 0; /* Try it without the suffix */
- if (chk_access(realpath, &bootsize) < 0) {
+ if (chk_access(rpath, &bootsize) < 0) {
/* neither "file.host" nor "file" was found */
#ifdef CHECK_FILE_ACCESS
@@ -1001,7 +993,7 @@
* Process BOOTREPLY packet.
*/
PRIVATE void
-handle_reply()
+handle_reply(void)
{
if (debug) {
report(LOG_INFO, "processing boot reply");
@@ -1016,9 +1008,7 @@
* 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,17 +1122,15 @@
*/
PRIVATE int
-chk_access(path, filesize)
- char *path;
- int32 *filesize;
+chk_access(char *path, int32 *filesize)
{
struct stat st;
if ((stat(path, &st) == 0) && (st.st_mode & (S_IREAD >> 6))) {
*filesize = (int32) st.st_size;
- return 0;
+ return(0);
} else {
- return -1;
+ return(-1);
}
}
@@ -1162,9 +1150,7 @@
*/
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 +1218,7 @@
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;
@@ -1265,7 +1248,8 @@
*/
{
byte *p, *ep;
- byte tag, len;
+ byte tag;
+ byte length;
short msgsz = 0;
p = vp + 4;
@@ -1278,10 +1262,10 @@
if (tag == TAG_END)
break;
/* Now scan the length byte. */
- len = *p++;
+ length = *p++;
switch (tag) {
case TAG_MAX_MSGSZ:
- if (len == 2) {
+ if (length == 2) {
bcopy(p, (char*)&msgsz, 2);
msgsz = ntohs(msgsz);
}
@@ -1290,10 +1274,10 @@
/* XXX - Should preserve this if given... */
break;
} /* swtich */
- p += len;
+ p += length;
}
- if (msgsz > sizeof(*bp) + BP_MSG_OVERHEAD) {
+ if (msgsz > (short)sizeof(*bp) + BP_MSG_OVERHEAD) {
if (debug > 1)
report(LOG_INFO, "request has DHCP msglen=%d", msgsz);
pktlen = msgsz - BP_MSG_OVERHEAD;
@@ -1324,7 +1308,7 @@
insert_u_long(hp->subnet_mask.s_addr, &vp); /* -4 bytes */
bytesleft -= 6; /* Fix real count */
if (hp->flags.gateway) {
- (void) insert_ip(TAG_GATEWAY,
+ insert_ip(TAG_GATEWAY,
hp->gateway,
&vp, &bytesleft);
}
Index: bootpd.h
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/bootpd.h,v
retrieving revision 1.2
diff -u -r1.2 bootpd.h
--- bootpd.h 17 Jun 2003 04:27:07 -0000 1.2
+++ bootpd.h 3 May 2005 20:20:47 -0000
@@ -202,7 +202,7 @@
*/
extern int debug;
-extern char *bootptab;
+extern const char *bootptab;
extern char *progname;
extern u_char vm_cmu[4];
Index: bptypes.h
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/bptypes.h,v
retrieving revision 1.2
diff -u -r1.2 bptypes.h
--- bptypes.h 17 Jun 2003 04:27:07 -0000 1.2
+++ bptypes.h 3 May 2005 17:28:22 -0000
@@ -1,5 +1,5 @@
/* $FreeBSD: src/libexec/bootpd/bptypes.h,v 1.2 1999/11/12 10:11:48 marcel Exp $
-/* $DragonFly: src/libexec/bootpd/bptypes.h,v 1.2 2003/06/17 04:27:07 dillon Exp $
+ * $DragonFly: src/libexec/bootpd/bptypes.h,v 1.2 2003/06/17 04:27:07 dillon Exp $
*/
#ifndef BPTYPES_H
Index: dovend.c
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/dovend.c,v
retrieving revision 1.2
diff -u -r1.2 dovend.c
--- dovend.c 17 Jun 2003 04:27:07 -0000 1.2
+++ dovend.c 4 May 2005 19:10:25 -0000
@@ -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 @@
*/
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;
@@ -65,7 +56,7 @@
if (bytesleft < (LEN)) { \
report(LOG_NOTICE, noroom, \
hp->hostname->string, MSG); \
- return (vp - buf); \
+ return(vp - buf); \
} while (0)
/*
@@ -268,7 +259,7 @@
/*
* The end marker is inserted by the caller.
*/
- return (vp - buf);
+ return(vp - buf);
#undef NEED
} /* dovend_rfc1497 */
@@ -288,18 +279,14 @@
*/
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;
byte *d;
if (iplist == NULL)
- return (0);
+ return(0);
if (*bytesleft >= 6) {
d = *dest; /* Save pointer for later */
@@ -316,7 +303,7 @@
}
d[1] = (byte) ((*dest - d - 2) & 0xFF);
}
- return (addrcount);
+ return(addrcount);
}
@@ -331,17 +318,14 @@
*/
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;
int skipped = 0;
if (gendata == NULL)
- return (0);
+ return(0);
srcptr = gendata->data;
length = gendata->length;
@@ -369,7 +353,7 @@
break;
}
} /* while */
- return (skipped);
+ return(skipped);
}
/*
@@ -386,9 +370,7 @@
*/
void
-insert_u_long(value, dest)
- u_int32 value;
- byte **dest;
+insert_u_long(u_int32 value, byte **dest)
{
byte *temp;
int n;
Index: dovend.h
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/dovend.h,v
retrieving revision 1.1
diff -u -r1.1 dovend.h
--- dovend.h 17 Jun 2003 02:51:50 -0000 1.1
+++ dovend.h 4 May 2005 15:37:10 -0000
@@ -1,13 +1,6 @@
/* dovend.h */
-#ifdef __STDC__
-#define P(args) args
-#else
-#define P(args) ()
-#endif
+extern int dovend_rfc1497 (struct host *hp, u_char *buf, int len);
+extern int insert_ip (byte, struct in_addr_list *, u_char **, int *);
+extern void insert_u_long (u_int32, u_char **);
-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
Index: dumptab.c
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/dumptab.c,v
retrieving revision 1.2
diff -u -r1.2 dumptab.c
--- dumptab.c 17 Jun 2003 04:27:07 -0000 1.2
+++ dumptab.c 4 May 2005 15:39:30 -0000
@@ -29,24 +29,17 @@
#include "patchlevel.h"
#include "bootpd.h"
-#ifdef __STDC__
-#define P(args) args
-#else
-#define P(args) ()
-#endif
+void dumptab(const char *);
#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(const char *filename __unused)
{
report(LOG_INFO, "No dumptab support!");
}
@@ -58,8 +51,7 @@
*/
void
-dumptab(filename)
- char *filename;
+dumptab(const char *filename)
{
int n;
struct host *hp;
@@ -139,9 +131,7 @@
*/
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 +298,7 @@
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 +341,7 @@
*/
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;
Index: getether.c
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/getether.c,v
retrieving revision 1.3
diff -u -r1.3 getether.c
--- getether.c 13 Feb 2004 03:49:47 -0000 1.3
+++ getether.c 4 May 2005 19:11:26 -0000
@@ -40,8 +40,8 @@
#include <sys/ioctl.h>
#include <net/if.h> /* struct ifdevea */
-getether(ifname, eap)
- char *ifname, *eap;
+int
+getether(char *ifname, char *eap)
{
int rc = -1;
int fd;
@@ -50,7 +50,7 @@
strcpy(phys.ifr_name, ifname);
if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
report(LOG_ERR, "getether: socket(INET,DGRAM) failed");
- return -1;
+ return(-1);
}
if (ioctl(fd, SIOCRPHYSADDR, &phys) < 0) {
report(LOG_ERR, "getether: ioctl SIOCRPHYSADDR failed");
@@ -59,7 +59,7 @@
rc = 0;
}
close(fd);
- return rc;
+ return(rc);
}
#define GETETHER
@@ -73,9 +73,13 @@
#include <net/nit_if.h> /* for NIOCBIND */
#include <net/if.h> /* for struct ifreq */
-getether(ifname, eap)
- char *ifname; /* interface name from ifconfig structure */
- char *eap; /* Ether address (output) */
+/*
+ * getether (char *ifname, char *eap);
+ * ifname - interface name from ifconfig structure
+ * eap - Ether address (output)
+ */
+int
+getether(char *ifname, char *eap)
{
int rc = -1;
@@ -89,7 +93,7 @@
if (nit < 0) {
report(LOG_ERR, "getether: open /dev/nit: %s",
get_errmsg());
- return rc;
+ return(rc);
}
do {
if (ioctl(nit, NIOCBIND, &ifrnit) < 0) {
@@ -104,7 +108,7 @@
rc = 0;
} while (0);
close(nit);
- return rc;
+ return(rc);
}
#define GETETHER
@@ -120,21 +124,19 @@
#include <net/if_types.h>
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);
if (fd < 0) {
report(LOG_ERR, "getether: socket %s: %s", ifname, get_errmsg());
- return (fd);
+ return(fd);
}
ifc.ifc_len = sizeof(ibuf);
ifc.ifc_buf = (caddr_t) ibuf;
@@ -164,7 +166,7 @@
out:
close(fd);
- return (rc);
+ return(rc);
}
#define GETETHER
@@ -186,9 +188,7 @@
#endif
int
-getether(ifname, eap)
- char *ifname; /* interface name from ifconfig structure */
- char *eap; /* Ether address (output) */
+getether(char *ifname, char *eap)
{
int rc = -1;
char devname[32];
@@ -214,7 +214,7 @@
if (fd < 0) {
report(LOG_ERR, "getether: open %s: %s",
devname, get_errmsg());
- return rc;
+ return(rc);
}
}
#ifdef DL_ATTACH_REQ
@@ -315,7 +315,7 @@
out:
close(fd);
- return rc;
+ return(rc);
}
#define GETETHER
@@ -339,8 +339,7 @@
#include <sys/socketio.h> /* Needed for IOCTL defs */
int
-getether(ifname, eap)
- char *ifname, *eap;
+getether(char *ifname, char *eap)
{
int rc = -1;
int fd;
@@ -350,7 +349,7 @@
strcpy(phys.ifr_name, ifname);
if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
report(LOG_ERR, "getether: socket(INET,DGRAM) failed");
- return -1;
+ return(-1);
}
if (ioctl(fd, SIOCGIFHWADDR, &phys) < 0) {
report(LOG_ERR, "getether: ioctl SIOCGIFHWADDR failed");
@@ -359,7 +358,7 @@
rc = 0;
}
close(fd);
- return rc;
+ return(rc);
}
#define GETETHER
@@ -369,10 +368,9 @@
/* If we don't know how on this system, just return an error. */
#ifndef GETETHER
int
-getether(ifname, eap)
- char *ifname, *eap;
+getether(char *ifname __unused, char *eap __unused)
{
- return -1;
+ return(-1);
}
#endif /* !GETETHER */
Index: getif.c
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/getif.c,v
retrieving revision 1.2
diff -u -r1.2 getif.c
--- getif.c 17 Jun 2003 04:27:07 -0000 1.2
+++ getif.c 4 May 2005 19:12:03 -0000
@@ -37,13 +37,14 @@
static struct ifreq ifreq[10]; /* Holds interface configuration */
static struct ifconf ifconf; /* points to ifreq */
-static int nmatch();
+static int nmatch(u_char *, u_char *);
-/* 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;
@@ -53,7 +54,7 @@
/* If no address was supplied, just return NULL. */
if (!addrp)
- return (struct ifreq *) 0;
+ return(struct ifreq *) 0;
/* Get the interface config if not done already. */
if (ifconf.ifc_len == 0) {
@@ -77,7 +78,7 @@
#endif /* SVR4 */
if ((m < 0) || (ifconf.ifc_len <= 0)) {
report(LOG_ERR, "ioctl SIOCGIFCONF");
- return (struct ifreq *) 0;
+ return(struct ifreq *) 0;
}
}
maxmatch = 7; /* this many bits or less... */
@@ -87,7 +88,7 @@
while (len > 0) {
ifrq = (struct ifreq *) p;
sip = (struct sockaddr_in *) &ifrq->ifr_addr;
- m = nmatch(addrp, &(sip->sin_addr));
+ m = nmatch((u_char *)addrp, (u_char *)&(sip->sin_addr));
if (m > maxmatch) {
maxmatch = m;
ifrmax = ifrq;
@@ -103,7 +104,7 @@
len -= incr;
}
- return ifrmax;
+ return(ifrmax);
}
/*
@@ -111,8 +112,7 @@
* internet addresses supplied.
*/
static int
-nmatch(ca, cb)
- u_char *ca, *cb; /* ptrs to IP address, network order */
+nmatch(u_char *ca, u_char *cb) /* ptrs to IP address, network order */
{
u_int m = 0; /* count of matching bits */
u_int n = 4; /* bytes left, then bitmask */
@@ -132,7 +132,7 @@
n >>= 1;
}
}
- return (m);
+ return(m);
}
/*
Index: hash.c
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/hash.c,v
retrieving revision 1.2
diff -u -r1.2 hash.c
--- hash.c 17 Jun 2003 04:27:07 -0000 1.2
+++ hash.c 4 May 2005 19:13:58 -0000
@@ -62,15 +62,8 @@
#define PRIVATE static
#endif
-#ifdef __STDC__
-#define P(args) args
-#else
-#define P(args) ()
-#endif
+PRIVATE void hashi_FreeMembers (hash_member *, hash_freefp);
-PRIVATE void hashi_FreeMembers P((hash_member *, hash_freefp));
-
-#undef P
@@ -84,11 +77,10 @@
*/
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)
@@ -103,7 +95,7 @@
} else {
hashtblptr = NULL; /* Disallow zero-length tables */
}
- return hashtblptr; /* NULL if failure */
+ return(hashtblptr); /* NULL if failure */
}
@@ -114,9 +106,7 @@
*/
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) {
@@ -136,9 +126,7 @@
*/
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;
@@ -175,18 +163,16 @@
*/
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--) {
accum <<= 1;
accum += (unsigned) (*string++ & 0xFF);
}
- return accum;
+ return(accum);
}
@@ -197,22 +183,21 @@
*/
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) {
if ((*compare) (key, memberptr->data)) {
- return TRUE; /* Entry does exist */
+ return(TRUE); /* Entry does exist */
}
memberptr = memberptr->next;
}
- return FALSE; /* Entry does not exist */
+ return(FALSE); /* Entry does not exist */
}
@@ -228,26 +213,26 @@
*/
int
-hash_Insert(hashtable, hashcode, compare, key, element)
- hash_tbl *hashtable;
- unsigned hashcode;
- hash_cmpfp compare;
- hash_datum *key, *element;
+ unsigned hashcode,
+ hash_cmpfp compare,
+ hash_datum *key,
+ hash_datum *element)
{
hash_member *temp;
hashcode %= hashtable->size;
if (hash_Exists(hashtable, hashcode, compare, key)) {
- return -1; /* At least one entry already exists */
+ return(-1); /* At least one entry already exists */
}
temp = (hash_member *) malloc(sizeof(hash_member));
if (!temp)
- return -1; /* malloc failed! */
+ return(-1); /* malloc failed! */
temp->data = element;
temp->next = (hashtable->table)[hashcode];
(hashtable->table)[hashcode] = temp;
- return 0; /* Success */
+ return(0); /* Success */
}
@@ -259,12 +244,11 @@
*/
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;
@@ -312,7 +296,7 @@
memberptr = memberptr->next;
}
}
- return retval;
+ return(retval);
}
@@ -325,22 +309,21 @@
*/
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;
memberptr = (hashtable->table)[hashcode % (hashtable->size)];
while (memberptr) {
if ((*compare) (key, memberptr->data)) {
- return (memberptr->data);
+ return(memberptr->data);
}
memberptr = memberptr->next;
}
- return NULL;
+ return(NULL);
}
@@ -350,11 +333,10 @@
*/
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.
@@ -362,7 +344,7 @@
memberptr = hashtable->member;
if (memberptr) {
hashtable->member = memberptr->next; /* Set up for next call */
- return memberptr->data; /* Return the data */
+ return(memberptr->data); /* Return the data */
}
/*
* We hit the end of a chain, so look through the array of buckets
@@ -386,14 +368,14 @@
/*
* But return end-of-table indication to the caller this time.
*/
- return NULL;
+ return(NULL);
}
/*
* Must have found a non-empty bucket.
*/
hashtable->bucketnum = bucket;
hashtable->member = memberptr->next; /* Set up for next call */
- return memberptr->data; /* Return the data */
+ return(memberptr->data); /* Return the data */
}
@@ -403,12 +385,11 @@
*/
hash_datum *
-hash_FirstEntry(hashtable)
- hash_tbl *hashtable;
+hash_FirstEntry(hash_tbl *hashtable)
{
hashtable->bucketnum = 0;
hashtable->member = (hashtable->table)[0];
- return hash_NextEntry(hashtable);
+ return(hash_NextEntry(hashtable));
}
/*
Index: hwaddr.c
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/hwaddr.c,v
retrieving revision 1.3
diff -u -r1.3 hwaddr.c
--- hwaddr.c 14 Nov 2003 03:54:29 -0000 1.3
+++ hwaddr.c 4 May 2005 19:14:54 -0000
@@ -82,7 +82,7 @@
{6, "IEEE 802"}, /* Type 6: IEEE 802 Networks */
{0, "ARCNET"} /* Type 7: ARCNET */
};
-int hwinfocnt = sizeof(hwinfolist) / sizeof(hwinfolist[0]);
+u_int32 hwinfocnt = sizeof(hwinfolist) / sizeof(hwinfolist[0]);
/*
@@ -90,12 +90,11 @@
* bound to hardware address 'ha' of length 'len'.
*/
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 __unused /* socket fd */,
+ struct in_addr *ia /* protocol address */,
+ int hafamily __unused, /* HW address family */
+ u_char *haddr /* HW address data */,
+ int halen)
{
#ifdef SIOCSARP
#ifdef WIN_TCP
@@ -216,9 +215,7 @@
* 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;
@@ -233,7 +230,7 @@
hlen--;
}
bufptr[-1] = 0;
- return (haddrbuf);
+ return(haddrbuf);
}
@@ -295,9 +292,7 @@
};
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 +307,7 @@
* bit-reverse table above.
*/
static int
-bitrev(n)
- int n;
+bitrev(int n)
{
int i, r;
@@ -323,10 +317,11 @@
r |= (n & 1);
n >>= 1;
}
- return r;
+ return(r);
}
-main()
+int
+main(void)
{
int i;
for (i = 0; i <= 0xFF; i++) {
Index: hwaddr.h
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/hwaddr.h,v
retrieving revision 1.2
diff -u -r1.2 hwaddr.h
--- hwaddr.h 17 Jun 2003 04:27:07 -0000 1.2
+++ hwaddr.h 4 May 2005 13:53:12 -0000
@@ -17,11 +17,11 @@
*/
struct hwinfo {
unsigned int hlen;
- char *name;
+ const char *name;
};
extern struct hwinfo hwinfolist[];
-extern int hwinfocnt;
+extern u_int32 hwinfocnt;
#ifdef __STDC__
#define P(args) args
Index: lookup.c
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/lookup.c,v
retrieving revision 1.2
diff -u -r1.2 lookup.c
--- lookup.c 17 Jun 2003 04:27:07 -0000 1.2
+++ lookup.c 4 May 2005 19:15:56 -0000
@@ -14,7 +14,6 @@
#ifdef ETC_ETHERS
#include <net/ethernet.h>
-extern int ether_hostton();
#endif
#include <netdb.h>
@@ -35,9 +34,7 @@
* Return NULL if addr not found.
*/
u_char *
-lookup_hwa(hostname, htype)
- char *hostname;
- int htype;
+lookup_hwa(char *hostname, int htype)
{
switch (htype) {
@@ -51,9 +48,9 @@
if (ether_hostton(hostname, &ea)) {
report(LOG_ERR, "no HW addr for host \"%s\"",
hostname);
- return (u_char *) 0;
+ return(u_char *) 0;
}
- return (u_char *) & ea;
+ return((u_char *) &ea);
}
#endif /* ETC_ETHERS */
@@ -62,7 +59,7 @@
} /* switch */
/* If the system can't do it, just return an error. */
- return (u_char *) 0;
+ return((u_char *) 0);
}
@@ -71,16 +68,14 @@
* 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);
if (!hp)
- return -1;
+ return(-1);
bcopy(hp->h_addr, result, sizeof(*result));
- return 0;
+ return(0);
}
@@ -93,9 +88,7 @@
* 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) /* both in network order */
{
int32 m, a;
@@ -112,9 +105,9 @@
m = IN_CLASSC_NET;
if (!m)
- return -1;
+ return(-1);
*result = htonl(m);
- return 0;
+ return(0);
}
/*
Index: readfile.c
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/readfile.c,v
retrieving revision 1.2
diff -u -r1.2 readfile.c
--- readfile.c 17 Jun 2003 04:27:07 -0000 1.2
+++ readfile.c 4 May 2005 19:32:05 -0000
@@ -135,13 +135,13 @@
*/
struct symbolmap {
- char *symbol;
+ const char *symbol;
int symbolcode;
};
struct htypename {
- char *name;
+ const char *name;
byte htype;
};
@@ -228,63 +228,52 @@
* 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 *));
-
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 +294,7 @@
* (shared by bootpd and bootpef)
*/
void
-rdtab_init()
+rdtab_init(void)
{
hwhashtable = hash_Init(HASHTABLESIZE);
iphashtable = hash_Init(HASHTABLESIZE);
@@ -323,8 +312,7 @@
*/
void
-readtab(force)
- int force;
+readtab(int force)
{
struct host *hp;
FILE *fp;
@@ -506,12 +494,10 @@
*/
PRIVATE void
-read_entry(fp, buffer, bufsiz)
- FILE *fp;
- char *buffer;
- unsigned *bufsiz;
+read_entry(FILE *fp, char *buffer, unsigned *bufsiz)
{
- int c, length;
+ int c;
+ unsigned length;
length = 0;
@@ -645,15 +631,13 @@
*/
PRIVATE int
-process_entry(host, src)
- struct host *host;
- char *src;
+process_entry(struct host *host, char *src)
{
int retval;
- char *msg;
+ const char *msg;
if (!host || *src == '\0') {
- return -1;
+ return(-1);
}
host->hostname = get_shared_string(&src);
#if 0
@@ -661,7 +645,7 @@
if (!goodname(host->hostname->string)) {
report(LOG_ERR, "bad hostname: \"%s\"", host->hostname->string);
del_string(host->hostname);
- return -1;
+ return(-1);
}
#endif
current_hostname = host->hostname->string;
@@ -674,7 +658,7 @@
}
if (retval == E_END_OF_ENTRY) {
/* The default subnet mask is set in readtab() */
- return 0;
+ return(0);
}
/* Some kind of error. */
switch (retval) {
@@ -708,7 +692,7 @@
} /* switch */
report(LOG_ERR, "in entry named \"%s\", symbol \"%s\": %s",
current_hostname, current_tagname, msg);
- return -1;
+ return(-1);
}
}
@@ -718,68 +702,68 @@
*/
/* Parse one INET address stored directly in MEMBER. */
-#define PARSE_IA1(MEMBER) do \
-{ \
- if (optype == OP_BOOLEAN) \
- return E_SYNTAX_ERROR; \
- hp->flags.MEMBER = FALSE; \
- if (optype == OP_ADDITION) { \
- if (prs_inetaddr(symbol, &value) < 0) \
- return E_BAD_IPADDR; \
- hp->MEMBER.s_addr = value; \
- hp->flags.MEMBER = TRUE; \
- } \
+#define PARSE_IA1(MEMBER) do \
+{ \
+ if (optype == OP_BOOLEAN) \
+ return(E_SYNTAX_ERROR); \
+ hp->flags.MEMBER = FALSE; \
+ if (optype == OP_ADDITION) { \
+ if (prs_inetaddr(symbol, &value) < 0) \
+ return(E_BAD_IPADDR); \
+ hp->MEMBER.s_addr = value; \
+ hp->flags.MEMBER = TRUE; \
+ } \
} while (0)
/* Parse a list of INET addresses pointed to by MEMBER */
-#define PARSE_IAL(MEMBER) do \
-{ \
- if (optype == OP_BOOLEAN) \
- return E_SYNTAX_ERROR; \
- if (hp->flags.MEMBER) { \
- hp->flags.MEMBER = FALSE; \
- assert(hp->MEMBER); \
- del_iplist(hp->MEMBER); \
- hp->MEMBER = NULL; \
- } \
- if (optype == OP_ADDITION) { \
- hp->MEMBER = get_addresses(symbol); \
- if (hp->MEMBER == NULL) \
- return E_SYNTAX_ERROR; \
- hp->flags.MEMBER = TRUE; \
- } \
+#define PARSE_IAL(MEMBER) do \
+{ \
+ if (optype == OP_BOOLEAN) \
+ return(E_SYNTAX_ERROR); \
+ if (hp->flags.MEMBER) { \
+ hp->flags.MEMBER = FALSE; \
+ assert(hp->MEMBER); \
+ del_iplist(hp->MEMBER); \
+ hp->MEMBER = NULL; \
+ } \
+ if (optype == OP_ADDITION) { \
+ hp->MEMBER = get_addresses(symbol); \
+ if (hp->MEMBER == NULL) \
+ return(E_SYNTAX_ERROR); \
+ hp->flags.MEMBER = TRUE; \
+ } \
} while (0)
/* Parse a shared string pointed to by MEMBER */
-#define PARSE_STR(MEMBER) do \
-{ \
- if (optype == OP_BOOLEAN) \
- return E_SYNTAX_ERROR; \
- if (hp->flags.MEMBER) { \
- hp->flags.MEMBER = FALSE; \
- assert(hp->MEMBER); \
- del_string(hp->MEMBER); \
- hp->MEMBER = NULL; \
- } \
- if (optype == OP_ADDITION) { \
+#define PARSE_STR(MEMBER) do \
+{ \
+ if (optype == OP_BOOLEAN) \
+ return(E_SYNTAX_ERROR); \
+ if (hp->flags.MEMBER) { \
+ hp->flags.MEMBER = FALSE; \
+ assert(hp->MEMBER); \
+ del_string(hp->MEMBER); \
+ hp->MEMBER = NULL; \
+ } \
+ if (optype == OP_ADDITION) { \
hp->MEMBER = get_shared_string(symbol); \
- if (hp->MEMBER == NULL) \
- return E_SYNTAX_ERROR; \
- hp->flags.MEMBER = TRUE; \
- } \
+ if (hp->MEMBER == NULL) \
+ return(E_SYNTAX_ERROR); \
+ hp->flags.MEMBER = TRUE; \
+ } \
} while (0)
/* Parse an unsigned integer value for MEMBER */
-#define PARSE_UINT(MEMBER) do \
-{ \
- if (optype == OP_BOOLEAN) \
- return E_SYNTAX_ERROR; \
- hp->flags.MEMBER = FALSE; \
- if (optype == OP_ADDITION) { \
- value = get_u_long(symbol); \
- hp->MEMBER = value; \
- hp->flags.MEMBER = TRUE; \
- } \
+#define PARSE_UINT(MEMBER) do \
+{ \
+ if (optype == OP_BOOLEAN) \
+ return(E_SYNTAX_ERROR); \
+ hp->flags.MEMBER = FALSE; \
+ if (optype == OP_ADDITION) { \
+ value = get_u_long(symbol); \
+ hp->MEMBER = value; \
+ hp->flags.MEMBER = TRUE; \
+ } \
} while (0)
/*
@@ -791,9 +775,7 @@
* 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;
@@ -812,10 +794,10 @@
current_tagname[2] = 0;
if ((*symbol)[0] == '\0') {
- return E_END_OF_ENTRY;
+ return(E_END_OF_ENTRY);
}
if ((*symbol)[0] == ':') {
- return SUCCESS;
+ return(SUCCESS);
}
if ((*symbol)[0] == 'T') { /* generic symbol */
(*symbol)++;
@@ -824,7 +806,7 @@
"T%d", (int)value);
eat_whitespace(symbol);
if ((*symbol)[0] != '=') {
- return E_SYNTAX_ERROR;
+ return(E_SYNTAX_ERROR);
}
(*symbol)++;
if (!(hp->generic)) {
@@ -832,9 +814,9 @@
smalloc(sizeof(struct shared_bindata));
}
if (process_generic(symbol, &(hp->generic), (byte) (value & 0xFF)))
- return E_SYNTAX_ERROR;
+ return(E_SYNTAX_ERROR);
hp->flags.generic = TRUE;
- return SUCCESS;
+ return(SUCCESS);
}
/*
* Determine the type of operation to be done on this symbol
@@ -851,7 +833,7 @@
optype = OP_BOOLEAN;
break;
default:
- return E_SYNTAX_ERROR;
+ return(E_SYNTAX_ERROR);
}
symbolptr = symbol_list;
@@ -864,7 +846,7 @@
symbolptr++;
}
if (i >= numsymbols) {
- return E_UNKNOWN_SYMBOL;
+ return(E_UNKNOWN_SYMBOL);
}
/*
* Skip past the = or @ character (to point to the data) if this
@@ -896,7 +878,7 @@
case SYM_HWADDR:
if (optype == OP_BOOLEAN)
- return E_SYNTAX_ERROR;
+ return(E_SYNTAX_ERROR);
hp->flags.haddr = FALSE;
if (optype == OP_ADDITION) {
/* Default the HW type to Ethernet */
@@ -906,7 +888,7 @@
}
tmphaddr = prs_haddr(symbol, hp->htype);
if (!tmphaddr)
- return E_BAD_HWADDR;
+ return(E_BAD_HWADDR);
bcopy(tmphaddr, hp->haddr, haddrlength(hp->htype));
hp->flags.haddr = TRUE;
}
@@ -918,7 +900,7 @@
case SYM_HTYPE:
if (optype == OP_BOOLEAN)
- return E_SYNTAX_ERROR;
+ return(E_SYNTAX_ERROR);
hp->flags.htype = FALSE;
if (optype == OP_ADDITION) {
value = 0L; /* Assume an illegal value */
@@ -927,7 +909,7 @@
value = get_u_long(symbol);
} else {
len = sizeof(tmpstr);
- (void) get_string(symbol, tmpstr, &len);
+ get_string(symbol, tmpstr, &len);
makelower(tmpstr);
numsymbols = sizeof(htnamemap) /
sizeof(struct htypename);
@@ -941,7 +923,7 @@
}
}
if (value >= hwinfocnt) {
- return E_BAD_HWATYPE;
+ return(E_BAD_HWATYPE);
}
hp->htype = (byte) (value & 0xFF);
hp->flags.htype = TRUE;
@@ -978,16 +960,16 @@
case SYM_TIME_OFFSET:
if (optype == OP_BOOLEAN)
- return E_SYNTAX_ERROR;
+ return(E_SYNTAX_ERROR);
hp->flags.time_offset = FALSE;
if (optype == OP_ADDITION) {
len = sizeof(tmpstr);
- (void) get_string(symbol, tmpstr, &len);
+ get_string(symbol, tmpstr, &len);
if (!strncmp(tmpstr, "auto", 4)) {
hp->time_offset = secondswest;
} else {
if (sscanf(tmpstr, "%d", (int*)&timeoff) != 1)
- return E_BAD_LONGWORD;
+ return(E_BAD_LONGWORD);
hp->time_offset = timeoff;
}
hp->flags.time_offset = TRUE;
@@ -1000,7 +982,7 @@
case SYM_VENDOR_MAGIC:
if (optype == OP_BOOLEAN)
- return E_SYNTAX_ERROR;
+ return(E_SYNTAX_ERROR);
hp->flags.vm_cookie = FALSE;
if (optype == OP_ADDITION) {
if (strncmp(*symbol, "auto", 4)) {
@@ -1011,9 +993,9 @@
bcopy(vm_cmu, hp->vm_cookie, 4);
} else {
if (!isdigit(**symbol))
- return E_BAD_IPADDR;
+ return(E_BAD_IPADDR);
if (prs_inetaddr(symbol, &value) < 0)
- return E_BAD_IPADDR;
+ return(E_BAD_IPADDR);
bcopy(&value, hp->vm_cookie, 4);
}
hp->flags.vm_cookie = TRUE;
@@ -1027,14 +1009,14 @@
fill_defaults(hp, symbol);
break;
default:
- return E_SYNTAX_ERROR;
+ return(E_SYNTAX_ERROR);
}
break;
case SYM_NAME_SWITCH:
switch (optype) {
case OP_ADDITION:
- return E_SYNTAX_ERROR;
+ return(E_SYNTAX_ERROR);
case OP_DELETION:
hp->flags.send_name = FALSE;
hp->flags.name_switch = FALSE;
@@ -1076,7 +1058,7 @@
PARSE_STR(tftpdir);
if ((hp->tftpdir != NULL) &&
(hp->tftpdir->string[0] != '/'))
- return E_BAD_PATHNAME;
+ return(E_BAD_PATHNAME);
break;
case SYM_DUMP_FILE:
@@ -1125,7 +1107,7 @@
PARSE_UINT(msg_size);
if (hp->msg_size < BP_MINPKTSZ ||
hp->msg_size > MAX_MSG_SIZE)
- return E_BAD_VALUE;
+ return(E_BAD_VALUE);
break;
case SYM_MIN_WAIT:
@@ -1135,11 +1117,11 @@
/* XXX - Add new tags here */
default:
- return E_UNKNOWN_SYMBOL;
+ return(E_UNKNOWN_SYMBOL);
} /* switch symbolcode */
- return SUCCESS;
+ return(SUCCESS);
}
#undef PARSE_IA1
#undef PARSE_IAL
@@ -1165,9 +1147,7 @@
*/
PRIVATE char *
-get_string(src, dest, length)
- char **src, *dest;
- unsigned *length;
+get_string(char **src, char *dest, unsigned *length)
{
int n, len, quoteflag;
@@ -1203,7 +1183,7 @@
*dest = '\0';
*length = n;
- return dest;
+ return(dest);
}
@@ -1217,22 +1197,21 @@
*/
PRIVATE struct shared_string *
-get_shared_string(src)
- char **src;
+get_shared_string(char **src)
{
char retstring[MAXSTRINGLEN];
struct shared_string *s;
unsigned length;
length = sizeof(retstring);
- (void) get_string(src, retstring, &length);
+ get_string(src, retstring, &length);
s = (struct shared_string *) smalloc(sizeof(struct shared_string)
+ length);
s->linkcount = 1;
strcpy(s->string, retstring);
- return s;
+ return(s);
}
@@ -1254,10 +1233,9 @@
*/
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;
@@ -1269,7 +1247,7 @@
str++; /* Skip over length field */
if ((*src)[0] == '"') { /* ASCII data */
newlength = sizeof(tmpbuf) - 2; /* Set maximum allowed length */
- (void) get_string(src, (char *) str, &newlength);
+ get_string(src, (char *) str, &newlength);
newlength++; /* null terminator */
} else { /* Numeric data */
newlength = 0;
@@ -1283,7 +1261,7 @@
}
}
if ((*src)[0] != ':')
- return -1;
+ return(-1);
tmpbuf[1] = (newlength & 0xFF);
oldlength = ((*dest)->length);
@@ -1299,7 +1277,7 @@
del_bindata(*dest);
}
*dest = bdata;
- return 0;
+ return(0);
}
@@ -1312,12 +1290,11 @@
*/
PRIVATE boolean
-goodname(hostname)
- register char *hostname;
+goodname(char *hostname)
{
do {
if (!isalpha(*hostname++)) { /* First character must be a letter */
- return FALSE;
+ return(FALSE);
}
while (isalnum(*hostname) ||
(*hostname == '-') ||
@@ -1326,14 +1303,14 @@
hostname++; /* Alphanumeric or a hyphen */
}
if (!isalnum(hostname[-1])) { /* Last must be alphanumeric */
- return FALSE;
+ return(FALSE);
}
if (*hostname == '\0') {/* Done? */
- return TRUE;
+ return(TRUE);
}
} while (*hostname++ == '.'); /* Dot, loop for next label */
- return FALSE; /* If it's not a dot, lose */
+ return(FALSE); /* If it's not a dot, lose */
}
@@ -1345,10 +1322,9 @@
*/
PRIVATE boolean
-nullcmp(d1, d2)
- hash_datum *d1, *d2;
+nullcmp(hash_datum *d1 __unused, hash_datum *d2 __unused)
{
- return FALSE;
+ return(FALSE);
}
@@ -1358,13 +1334,12 @@
*/
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;
- return !strcmp(name, hp->hostname->string);
+ return(!strcmp(name, hp->hostname->string));
}
@@ -1381,27 +1356,26 @@
*/
-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;
if (host1->htype != host2->htype) {
- return FALSE;
+ return(FALSE);
}
if (bcmp(host1->haddr, host2->haddr, haddrlength(host1->htype))) {
- return FALSE;
+ return(FALSE);
}
/* XXX - Is the subnet_mask field set yet? */
if ((host1->subnet_mask.s_addr) == (host2->subnet_mask.s_addr)) {
if (((host1->iaddr.s_addr) & (host1->subnet_mask.s_addr)) !=
((host2->iaddr.s_addr) & (host2->subnet_mask.s_addr)))
{
- return FALSE;
+ return(FALSE);
}
}
- return TRUE;
+ return(TRUE);
}
@@ -1409,24 +1383,24 @@
* Macros for use in the function below:
*/
-#define DUP_COPY(MEMBER) do \
-{ \
- if (!hp->flags.MEMBER) { \
- if ((hp->flags.MEMBER = hp2->flags.MEMBER) != 0) { \
- hp->MEMBER = hp2->MEMBER; \
- } \
- } \
+#define DUP_COPY(MEMBER) do \
+{ \
+ if (!hp->flags.MEMBER) { \
+ if ((hp->flags.MEMBER = hp2->flags.MEMBER) != 0) { \
+ hp->MEMBER = hp2->MEMBER; \
+ } \
+ } \
} while (0)
-#define DUP_LINK(MEMBER) do \
-{ \
- if (!hp->flags.MEMBER) { \
- if ((hp->flags.MEMBER = hp2->flags.MEMBER) != 0) { \
- assert(hp2->MEMBER); \
- hp->MEMBER = hp2->MEMBER; \
- (hp->MEMBER->linkcount)++; \
- } \
- } \
+#define DUP_LINK(MEMBER) do \
+{ \
+ if (!hp->flags.MEMBER) { \
+ if ((hp->flags.MEMBER = hp2->flags.MEMBER) != 0) { \
+ assert(hp2->MEMBER); \
+ hp->MEMBER = hp2->MEMBER; \
+ (hp->MEMBER->linkcount)++; \
+ } \
+ } \
} while (0)
/*
@@ -1437,16 +1411,14 @@
* 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;
char tstring[MAXSTRINGLEN];
tlen = sizeof(tstring);
- (void) get_string(src, tstring, &tlen);
+ get_string(src, tstring, &tlen);
hashcode = hash_HashFunction((u_char *) tstring, tlen);
hp2 = (struct host *) hash_Lookup(nmhashtable, hashcode, nmcmp, tstring);
@@ -1529,10 +1501,9 @@
*/
PRIVATE void
-adjust(s)
- char **s;
+adjust(char **s)
{
- register char *t;
+ char *t;
t = *s;
while (*t && (*t != ':')) {
@@ -1554,10 +1525,9 @@
*/
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 @@
*/
PRIVATE void
-makelower(s)
- char *s;
+makelower(char *s)
{
while (*s) {
if (isupper(*s)) {
@@ -1614,8 +1583,7 @@
*/
PRIVATE struct in_addr_list *
-get_addresses(src)
- char **src;
+get_addresses(char **src)
{
struct in_addr tmpaddrlist[MAXINADDRS];
struct in_addr *address1, *address2;
@@ -1651,7 +1619,7 @@
address2++;
}
}
- return result;
+ return(result);
}
@@ -1671,12 +1639,10 @@
*/
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;
@@ -1696,7 +1662,7 @@
n = lookup_ipa(tmpstr, result);
if (n < 0)
report(LOG_ERR, "can not get IP addr for %s", tmpstr);
- return n;
+ return(n);
}
/*
@@ -1709,19 +1675,19 @@
loop:
/* If it's not a digit, return error. */
if (!isdigit(**src))
- return -1;
+ return(-1);
*pp++ = get_u_long(src);
if (**src == '.') {
if (pp < (parts + 4)) {
(*src)++;
goto loop;
}
- return (-1);
+ return(-1);
}
#if 0
/* This is handled by the caller. */
if (**src && !(isspace(**src) || (**src == ':'))) {
- return (-1);
+ return(-1);
}
#endif
@@ -1746,10 +1712,10 @@
((parts[2] & 0xFF) << 8) | (parts[3] & 0xFF);
break;
default:
- return (-1);
+ return(-1);
}
*result = htonl(value);
- return (0);
+ return(0);
}
@@ -1771,9 +1737,7 @@
*/
PRIVATE byte *
-prs_haddr(src, htype)
- char **src;
- u_int htype;
+prs_haddr(char **src, u_int htype)
{
static byte haddr[MAXHADDRLEN];
byte *hap;
@@ -1785,7 +1749,7 @@
hal = haddrlength(htype); /* Get length of this address type */
if (hal <= 0) {
report(LOG_ERR, "Invalid addr type for HW addr parse");
- return NULL;
+ return(NULL);
}
tmplen = sizeof(tmpstr);
get_string(src, tmpstr, &tmplen);
@@ -1795,7 +1759,7 @@
if (goodname(p)) {
/* Lookup Hardware Address for hostname. */
if ((hap = lookup_hwa(p, htype)) != NULL)
- return hap; /* success */
+ return(hap); /* success */
report(LOG_ERR, "Add 0x prefix if hex value starts with A-F");
/* OK, assume it must be numeric. */
}
@@ -1805,10 +1769,10 @@
if ((*p == '.') || (*p == ':'))
p++;
if (interp_byte(&p, hap++) < 0) {
- return NULL;
+ return(NULL);
}
}
- return haddr;
+ return(haddr);
}
@@ -1826,9 +1790,7 @@
*/
PRIVATE int
-interp_byte(src, retbyte)
- char **src;
- byte *retbyte;
+interp_byte(char **src, byte *retbyte)
{
int v;
@@ -1838,14 +1800,14 @@
(*src) += 2; /* allow 0x for hex, but don't require it */
}
if (!isxdigit((*src)[0]) || !isxdigit((*src)[1])) {
- return -1;
+ return(-1);
}
if (sscanf(*src, "%2x", &v) != 1) {
- return -1;
+ return(-1);
}
(*src) += 2;
*retbyte = (byte) (v & 0xFF);
- return 0;
+ return(0);
}
@@ -1858,10 +1820,9 @@
*/
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;
/*
@@ -1891,7 +1852,7 @@
}
break;
}
- return value;
+ return(value);
}
@@ -1907,8 +1868,7 @@
*/
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 @@
*/
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 @@
*/
PRIVATE void
-del_string(stringptr)
- struct shared_string *stringptr;
+del_string(struct shared_string *stringptr)
{
if (stringptr) {
if (!(--(stringptr->linkcount))) {
@@ -2002,8 +1960,7 @@
*/
PRIVATE void
-del_bindata(dataptr)
- struct shared_bindata *dataptr;
+del_bindata(struct shared_bindata *dataptr)
{
if (dataptr) {
if (!(--(dataptr->linkcount))) {
@@ -2024,8 +1981,7 @@
*/
PRIVATE char *
-smalloc(nbytes)
- unsigned nbytes;
+smalloc(unsigned nbytes)
{
char *retvalue;
@@ -2035,7 +1991,7 @@
exit(1);
}
bzero(retvalue, nbytes);
- return retvalue;
+ return(retvalue);
}
@@ -2049,19 +2005,18 @@
*/
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;
if (host1->htype != host2->htype) {
- return FALSE;
+ return(FALSE);
}
if (bcmp(host1->haddr, host2->haddr, haddrlength(host1->htype))) {
- return FALSE;
+ return(FALSE);
}
- return TRUE;
+ return(TRUE);
}
@@ -2070,13 +2025,12 @@
*/
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;
- return (host1->iaddr.s_addr == host2->iaddr.s_addr);
+ return(host1->iaddr.s_addr == host2->iaddr.s_addr);
}
/*
Index: report.c
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/report.c,v
retrieving revision 1.2
diff -u -r1.2 report.c
--- report.c 17 Jun 2003 04:27:07 -0000 1.2
+++ report.c 4 May 2005 19:29:36 -0000
@@ -5,11 +5,7 @@
* report() - calls syslog
*/
-#ifdef __STDC__
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#include <stdio.h>
#include <syslog.h>
@@ -38,8 +34,7 @@
static int stderr_only = 1;
void
-report_init(nolog)
- int nolog;
+report_init(int nolog)
{
stderr_only = nolog;
#ifdef SYSLOG
@@ -61,7 +56,7 @@
* newlines and adds its own at the end).
*/
-static char *levelnames[] = {
+static const char *levelnames[] = {
#ifdef LOG_SALERT
"level(0): ",
"alert(1): ",
@@ -93,17 +88,8 @@
* Print a log message using syslog(3) and/or stderr.
* The message passed in should not include a newline.
*/
-#ifdef __STDC__
void
report(int priority, const char *fmt,...)
-#else
-/*VARARGS2*/
-void
-report(priority, fmt, va_alist)
- int priority;
- const char *fmt;
- va_dcl
-#endif
{
va_list ap;
static char buf[128];
@@ -111,11 +97,7 @@
if ((priority < 0) || (priority >= numlevels)) {
priority = numlevels - 1;
}
-#ifdef __STDC__
va_start(ap, fmt);
-#else
- va_start(ap);
-#endif
vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
@@ -138,9 +120,9 @@
* Return pointer to static string which gives full filesystem error message.
*/
const char *
-get_errmsg()
+get_errmsg(void)
{
- return strerror(errno);
+ return(strerror(errno));
}
/*
Index: rtmsg.c
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/rtmsg.c,v
retrieving revision 1.3
diff -u -r1.3 rtmsg.c
--- rtmsg.c 14 Nov 2003 03:54:29 -0000 1.3
+++ rtmsg.c 4 May 2005 19:29:56 -0000
@@ -74,6 +74,10 @@
static int rtmsg (int);
+static void init_blank_sin (struct sockaddr_inarp *);
+static void init_so_mask (struct sockaddr_in *);
+static void init_blank_sdl (struct sockaddr_dl *);
+int bsd_arp_set(struct in_addr *, char *, int);
static int s = -1; /* routing socket */
@@ -81,11 +85,13 @@
/*
* Open the routing socket
*/
-static void getsocket () {
+static void
+getsocket (void)
+{
if (s < 0) {
s = socket(PF_ROUTE, SOCK_RAW, 0);
if (s < 0) {
- report(LOG_ERR, "socket %s", strerror(errno));
+ report(LOG_ERR, "socket %s", get_errmsg ());
exit(1);
}
} else {
@@ -97,40 +103,64 @@
ioctl(s, FIONREAD, &n);
while (n > 0) {
- read(s, buf, sizeof buf);
+ read(s, buf, sizeof(buf));
ioctl(s, FIONREAD, &n);
}
}
}
-static struct sockaddr_in so_mask = {8, 0, 0, { 0xffffffff}};
-static struct sockaddr_inarp blank_sin = {sizeof(blank_sin), AF_INET }, sin_m;
-static struct sockaddr_dl blank_sdl = {sizeof(blank_sdl), AF_LINK }, sdl_m;
+static struct sockaddr_in so_mask;
+static struct sockaddr_inarp blank_sin, sin_m;
+static struct sockaddr_dl blank_sdl, sdl_m;
static int expire_time, flags, export_only, doing_proxy;
static struct {
struct rt_msghdr m_rtm;
char m_space[512];
} m_rtmsg;
+static void
+init_blank_sin (struct sockaddr_inarp *psinarp)
+{
+ psinarp->sin_len = sizeof(struct sockaddr_inarp);
+ psinarp->sin_family = AF_INET;
+}
+
+static void
+init_so_mask (struct sockaddr_in *psin)
+{
+ psin->sin_len = 8;
+ psin->sin_family = 0;
+ psin->sin_port = 0;
+ psin->sin_addr.s_addr = 0xffffffff;
+}
+
+static void
+init_blank_sdl (struct sockaddr_dl *sdl)
+{
+ sdl->sdl_len = sizeof(struct sockaddr_dl);
+ sdl->sdl_family = AF_LINK;
+}
+
/*
* Set an individual arp entry
*/
-int bsd_arp_set(ia, eaddr, len)
- 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);
+int
+bsd_arp_set(struct in_addr *ia, char *eaddr, int len)
+{
+ struct sockaddr_inarp *psin_m = &sin_m;
+ struct sockaddr_dl *sdl;
+ struct rt_msghdr *rtm = &(m_rtmsg.m_rtm);
u_char *ea;
- struct timeval time;
+ struct timeval tval;
int op = RTM_ADD;
+ init_blank_sin (&blank_sin);
+ init_blank_sdl (&blank_sdl);
+
getsocket();
sdl_m = blank_sdl;
sin_m = blank_sin;
- sin->sin_addr = *ia;
+ psin_m->sin_addr = *ia;
ea = (u_char *)LLADDR(&sdl_m);
bcopy(eaddr, ea, len);
@@ -138,17 +168,17 @@
doing_proxy = flags = export_only = expire_time = 0;
/* make arp entry temporary */
- gettimeofday(&time, 0);
- expire_time = time.tv_sec + 20 * 60;
+ gettimeofday(&tval, 0);
+ expire_time = tval.tv_sec + 20 * 60;
tryagain:
if (rtmsg(RTM_GET) < 0) {
- report(LOG_WARNING, "rtmget: %s", strerror(errno));
- return (1);
+ report(LOG_WARNING, "rtmget: %s", get_errmsg());
+ return(1);
}
- sin = (struct sockaddr_inarp *)(rtm + 1);
- sdl = (struct sockaddr_dl *)(sin->sin_len + (char *)sin);
- if (sin->sin_addr.s_addr == sin_m.sin_addr.s_addr) {
+ psin_m = (struct sockaddr_inarp *)(rtm + 1);
+ sdl = (struct sockaddr_dl *)(psin_m->sin_len + (char *)psin_m);
+ if (psin_m->sin_addr.s_addr == sin_m.sin_addr.s_addr) {
if (sdl->sdl_family == AF_LINK &&
(rtm->rtm_flags & RTF_LLINFO) &&
!(rtm->rtm_flags & RTF_GATEWAY)) switch (sdl->sdl_type) {
@@ -159,8 +189,8 @@
}
if (doing_proxy == 0) {
report(LOG_WARNING, "set: can only proxy for %s\n",
- inet_ntoa(sin->sin_addr));
- return (1);
+ inet_ntoa(psin_m->sin_addr));
+ return(1);
}
if (sin_m.sin_other & SIN_PROXY) {
report(LOG_WARNING,
@@ -175,23 +205,22 @@
if (sdl->sdl_family != AF_LINK) {
report(LOG_WARNING,
"cannot intuit interface index and type for %s\n",
- inet_ntoa(sin->sin_addr));
- return (1);
+ inet_ntoa(psin_m->sin_addr));
+ return(1);
}
sdl_m.sdl_type = sdl->sdl_type;
sdl_m.sdl_index = sdl->sdl_index;
- return (rtmsg(op));
+ return(rtmsg(op));
}
-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));
@@ -227,6 +256,7 @@
NEXTADDR(RTA_DST, sin_m);
NEXTADDR(RTA_GATEWAY, sdl_m);
+ init_so_mask (&so_mask);
NEXTADDR(RTA_NETMASK, so_mask);
rtm->rtm_msglen = cp - (char *)&m_rtmsg;
@@ -237,8 +267,8 @@
if ((rlen = write(s, (char *)&m_rtmsg, l)) < 0) {
if ((errno != ESRCH) && !(errno == EEXIST && cmd == RTM_ADD)){
report(LOG_WARNING, "writing to routing socket: %s",
- strerror(errno));
- return (-1);
+ get_errmsg());
+ return(-1);
}
}
do {
@@ -246,8 +276,8 @@
} while (l > 0 && (rtm->rtm_type != cmd || rtm->rtm_seq != seq || rtm->rtm_pid != getpid()));
if (l < 0)
report(LOG_WARNING, "arp: read from routing socket: %s\n",
- strerror(errno));
- return (0);
+ get_errmsg());
+ return(0);
}
#endif /* BSD */
Index: trygetea.c
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/trygetea.c,v
retrieving revision 1.2
diff -u -r1.2 trygetea.c
--- trygetea.c 17 Jun 2003 04:27:07 -0000 1.2
+++ trygetea.c 4 May 2005 19:03:18 -0000
@@ -29,10 +29,8 @@
int debug = 0;
char *progname;
-void
-main(argc, argv)
- int argc;
- char **argv;
+int
+main(int argc, char **argv)
{
u_char ea[16]; /* Ethernet address */
int i;
Index: trygetif.c
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/trygetif.c,v
retrieving revision 1.2
diff -u -r1.2 trygetif.c
--- trygetif.c 17 Jun 2003 04:27:07 -0000 1.2
+++ trygetif.c 4 May 2005 19:03:54 -0000
@@ -29,10 +29,8 @@
int debug = 0;
char *progname;
-void
-main(argc, argv)
- int argc;
- char **argv;
+int
+main(int argc, char **argv)
{
struct hostent *hep;
struct sockaddr_in *sip; /* Interface address */
Index: trylook.c
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/trylook.c,v
retrieving revision 1.2
diff -u -r1.2 trylook.c
--- trylook.c 17 Jun 2003 04:27:07 -0000 1.2
+++ trylook.c 4 May 2005 19:05:05 -0000
@@ -18,10 +18,8 @@
int debug = 0;
char *progname;
-void
-main(argc, argv)
- int argc;
- char **argv;
+int
+main(int argc, char **argv)
{
int i;
struct in_addr in;
@@ -51,7 +49,7 @@
int i;
for (i = 0; i < 6; i++)
printf(":%x", hwa[i] & 0xFF);
- putchar('\n');
+ printf("\n");
}
}
Index: tzone.c
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/tzone.c,v
retrieving revision 1.2
diff -u -r1.2 tzone.c
--- tzone.c 17 Jun 2003 04:27:07 -0000 1.2
+++ tzone.c 4 May 2005 19:05:56 -0000
@@ -29,7 +29,7 @@
* configuration file doesn't specify one.
*/
void
-tzone_init()
+tzone_init(void)
{
#ifdef SVR4
/* XXX - Is this really SunOS specific? -gwr */
@@ -38,7 +38,7 @@
struct tm *tm;
time_t now;
- (void)time(&now);
+ time(&now);
if ((tm = localtime(&now)) == NULL) {
secondswest = 0; /* Assume GMT for lack of anything better */
report(LOG_ERR, "localtime() failed");
Index: tzone.h
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/tzone.h,v
retrieving revision 1.1
diff -u -r1.1 tzone.h
--- tzone.h 17 Jun 2003 02:51:51 -0000 1.1
+++ tzone.h 3 May 2005 20:36:26 -0000
@@ -1,3 +1,3 @@
/* tzone.h */
extern int32 secondswest;
-extern void tzone_init();
+extern void tzone_init(void);
Index: tools/bootpef/bootpef.c
===================================================================
RCS file: /home/dcvs/src/libexec/bootpd/tools/bootpef/bootpef.c,v
retrieving revision 1.2
diff -u -r1.2 bootpef.c
--- tools/bootpef/bootpef.c 17 Jun 2003 04:27:07 -0000 1.2
+++ tools/bootpef/bootpef.c 3 May 2005 20:22:51 -0000
@@ -115,7 +115,7 @@
* Globals below are associated with the bootp database file (bootptab).
*/
-char *bootptab = CONFIG_FILE;
+const char *bootptab = CONFIG_FILE;
/*
More information about the Submit
mailing list