diff options
author | Bruce Evans <bde@FreeBSD.org> | 2001-06-13 11:56:00 +0000 |
---|---|---|
committer | Bruce Evans <bde@FreeBSD.org> | 2001-06-13 11:56:00 +0000 |
commit | 87c5c2d426e3a2a450a60224668c969b04dad0a6 (patch) | |
tree | 0eff4ac13d206e050d47c880bf0cb4da306de8ab /usr.sbin/rarpd | |
parent | 5333a1958c815a9d991a540294aef041687876e4 (diff) |
Fixed world breakage on systems where ntohl() doesn't return u_long
(e.g., on alphas, or even on i386's with a POSIX-200x-conformant
ntohl() (ntohl() returns uint32_t which is u_int on i386's)).
Fixed related bugs and bogons while I'm here:
- ntohl() was "fixed" for printing in 1 place by casting to
"(unsigned int )". This breaks the value on systems where u_int
is smaller than uint32_t, and has 2 style bugs.
- spell u_int consistently (never use "unsigned").
- break K&R support some more (don't cast malloc()'s arg to a wrong
type...).
Notes
Notes:
svn path=/head/; revision=78163
Diffstat (limited to 'usr.sbin/rarpd')
-rw-r--r-- | usr.sbin/rarpd/rarpd.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/usr.sbin/rarpd/rarpd.c b/usr.sbin/rarpd/rarpd.c index 6d7780d81492..b7ed67515506 100644 --- a/usr.sbin/rarpd/rarpd.c +++ b/usr.sbin/rarpd/rarpd.c @@ -108,10 +108,6 @@ static const char rcsid[] = #define arp_tpa arp_xtpa #endif -#ifndef __GNUC__ -#define inline -#endif - /* * The structure for each interface. */ @@ -134,15 +130,6 @@ int verbose; /* verbose messages */ int s; /* inet datagram socket */ const char *tftp_dir = TFTP_DIR; /* tftp directory */ -#ifndef __P -#define __P(protos) () -#endif - -#if BSD < 199200 -extern char *malloc(); -extern void exit(); -#endif - int sflag; /* ignore /tftpboot */ static u_char zero[6]; @@ -338,7 +325,7 @@ init_one(struct ifreq *ifrp, char *target) void init(char *target) { - unsigned n; + u_int n; struct ifreq *ifrp, *ifend; struct if_info *ii, *nii, *lii; struct ifconf ifc; @@ -393,7 +380,7 @@ init(char *target) for (ii = iflist; ii != NULL; ii = ii->ii_next) syslog(LOG_DEBUG, "%s %s 0x%08lx %s", ii->ii_ifname, intoa(ntohl(ii->ii_ipaddr)), - ntohl(ii->ii_netmask), eatoa(ii->ii_eaddr)); + (u_long)ntohl(ii->ii_netmask), eatoa(ii->ii_eaddr)); } void @@ -551,7 +538,7 @@ rarp_loop(void) syslog(LOG_ERR, "BIOCGBLEN: %m"); exit(1); } - buf = (u_char *)malloc((unsigned)bufsize); + buf = malloc(bufsize); if (buf == NULL) { syslog(LOG_ERR, "malloc: %m"); exit(1); @@ -637,7 +624,7 @@ rarp_bootable(u_long addr) char ipname[9]; static DIR *dd = NULL; - (void)sprintf(ipname, "%08X", (unsigned int )ntohl(addr)); + (void)sprintf(ipname, "%08lX", (u_long)ntohl(addr)); /* * If directory is already open, rewind it. Otherwise, open it. |