Fix warnings.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5171 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Houdoin 2003-10-25 23:50:03 +00:00
parent acb7e134d4
commit b63115b602
5 changed files with 57 additions and 43 deletions

View File

@ -62,6 +62,9 @@
#include <unistd.h>
#include <sys/time.h>
// phoudoin, 20031026: FIXME: sysctl.h is a kernel private header!
extern int sysctl(int *, uint, void *, size_t *, void *, size_t);
int delete (const char *, const char *);
void search(in_addr_t addr, void (*action)(struct sockaddr_dl *sdl,
struct sockaddr_inarp *sin, struct rt_msghdr *rtm));
@ -77,6 +80,7 @@ void getsocket (void);
int rtmsg (int);
int set (int, char **);
void usage (void);
void err(int error, char *msg);
static int pid;
static int nflag; /* no reverse dns lookups */

View File

@ -50,6 +50,7 @@ void in_getaddr(char *s, int which);
void in_getprefix(char *plen, int which);
void status(int link);
void printif(struct ifreq *ifrm, int ifaliases);
void usage(void);
/* The commands we recognise... */
struct _cmd_ {
@ -90,7 +91,7 @@ const struct afswtch {
const struct afswtch *afp; /*the address family being set or asked about*/
void usage()
void usage(void)
{
fprintf(stderr, "OpenBeOS Network Team: ifconfig: version %s\n", version);
fprintf(stderr, "usage: ifconfig [ -m ] [ -a ] [ -A ] [ interface ]\n"
@ -305,7 +306,7 @@ void printif(struct ifreq *ifrm, int ifaliases)
err(1, "malloc");
if (ioctl(sock, SIOCGIFCONF, &ifc) < 0)
err(1, "SIOCGIFCONF");
if (ifc.ifc_len + sizeof(ifreq) < len)
if ((int) (ifc.ifc_len + sizeof(ifreq)) < len)
break;
len *= 2;
}
@ -315,12 +316,12 @@ void printif(struct ifreq *ifrm, int ifaliases)
ifrp = (struct ifreq *)((caddr_t)ifc.ifc_req + i);
memcpy(ifrbuf, ifrp, sizeof(*ifrp));
siz = ((struct ifreq *)ifrbuf)->ifr_addr.sa_len;
if (siz < sizeof(ifrp->ifr_addr))
if (siz < (int) sizeof(ifrp->ifr_addr))
siz = sizeof(ifrp->ifr_addr);
siz += sizeof(ifrp->ifr_name);
i += siz;
/* avoid alignment issue */
if (sizeof(ifrbuf) < siz)
if ((int) sizeof(ifrbuf) < siz)
err(1, "ifr too big");
memcpy(ifrbuf, ifrp, siz);
ifrp = (struct ifreq *)ifrbuf;

View File

@ -150,17 +150,21 @@ int reset_kerninfo;
#define DEFAULT_BUFSPACE 60*1024 /* default read buffer size */
int bufspace = DEFAULT_BUFSPACE;
void fill (char *, char *);
void catcher(), prtsig(), finish(), summary(int);
void fill(char *, char *);
void catcher(int);
void prtsig(int);
void finish(int);
void summary(int);
int compute_in_cksum (u_short *, int);
void pinger();
void pinger(void);
char *pr_addr (in_addr_t);
int check_icmph (struct ip *);
void pr_icmph (struct icmp *);
void pr_pack (char *, int, struct sockaddr_in *);
void pr_retip (struct ip *);
void pr_iph(struct ip *ip);
uint64 qsqrt (uint64);
void usage();
void usage(void);
static void err(int exitval, char *where)
@ -339,7 +343,7 @@ int main(int argc, char **argv)
if (options & F_FLOOD && options & F_INTERVAL)
err(1, "-f and -i options are incompatible");
if (datalen >= sizeof(uint64)) /* can we time transfer */
if (datalen >= (int) sizeof(uint64)) /* can we time transfer */
timing = 1;
packlen = datalen + MAXIPLEN + MAXICMPLEN;
if (!(packet = (u_char *)malloc((u_int)packlen)))
@ -470,7 +474,7 @@ int main(int argc, char **argv)
pinger();
if ((options & F_FLOOD) == 0)
catcher(); /* start things going */
catcher(0); /* start things going */
fdmasks = _howmany(s+1, NFDBITS) * sizeof(fd_mask);
if ((fdmaskp = (fd_set *)malloc(fdmasks)) == NULL)
@ -509,7 +513,7 @@ int main(int argc, char **argv)
break;
}
free(fdmaskp);
finish();
finish(0);
/* NOTREACHED */
exit(0); /* Make the compiler happy */
}
@ -524,7 +528,7 @@ int main(int argc, char **argv)
* launched exactly at 1-second intervals). This does not affect the
* quality of the delay and loss statistics.
*/
void catcher()
void catcher(int sig)
{
int waittime;
int save_errno = errno;
@ -551,7 +555,7 @@ void catcher()
* Print statistics when SIGINFO is received.
* XXX not race safe
*/
void prtsig()
void prtsig(int sig)
{
int save_errno = errno;
@ -567,7 +571,7 @@ void prtsig()
* of the data portion are used to hold a UNIX "timeval" struct in VAX
* byte-order, to compute the round-trip time.
*/
void pinger()
void pinger(void)
{
struct icmp *icp;
int cc;
@ -701,13 +705,13 @@ void pr_pack(char *buf, int cc, struct sockaddr_in *from)
/* check the data */
cp = (u_char*)&icp->icmp_data[sizeof(bigtime_t)];
dp = &outpack[8 + sizeof(bigtime_t)];
for (i = 8 + sizeof(bigtime_t); i < datalen;
for (i = 8 + sizeof(bigtime_t); (int) i < datalen;
++i, ++cp, ++dp) {
if (*cp != *dp) {
(void)printf("\nwrong data byte #%d should be 0x%x but was 0x%x",
i, *dp, *cp);
cp = (u_char*)&icp->icmp_data[0];
for (i = 8; i < datalen; ++i, ++cp) {
for (i = 8; (int) i < datalen; ++i, ++cp) {
if ((i % 32) == 8)
(void)printf("\n\t");
(void)printf("%x ", *cp);
@ -777,8 +781,8 @@ void pr_pack(char *buf, int cc, struct sockaddr_in *from)
i -= IPOPT_MINOFF;
if (i <= 0)
continue;
if (i == old_rrlen
&& cp == (u_char *)buf + sizeof(struct ip) + 2
if ((int) i == old_rrlen
&& cp == (u_char *) buf + sizeof(struct ip) + 2
&& !memcmp(cp, old_rr, i)
&& !(options & F_FLOOD)) {
(void)printf("\t(same route)");
@ -904,7 +908,7 @@ void summary(int header)
uint64 qsqrt(uint64 qdev)
{
uint64 y, x = 1;
int64 y, x = 1;
if (!qdev)
return(0);
@ -916,14 +920,14 @@ uint64 qsqrt(uint64 qdev)
x /= 2;
} while ((x - y) > 1 || (x - y) > -1);
return(x);
return (uint64) x;
}
/*
* finish --
* Print out statistics, and give up.
*/
void finish()
void finish(int sig)
{
(void)signal(SIGINT, SIG_IGN);
(void)signal(SIGALRM, SIG_IGN);
@ -1151,9 +1155,7 @@ pr_icmph(icp)
* pr_iph --
* Print an IP header with options.
*/
void
pr_iph(ip)
struct ip *ip;
void pr_iph(struct ip *ip)
{
int hlen;
u_char *cp;
@ -1203,9 +1205,7 @@ pr_addr(a)
* pr_retip --
* Dump some info on a returned (via ICMP) IP packet.
*/
void
pr_retip(ip)
struct ip *ip;
void pr_retip(struct ip *ip)
{
int hlen;
u_char *cp;
@ -1241,7 +1241,7 @@ fill(bp, patp)
if (ii > 0)
for (kk = 0;
kk <= MAXPAYLOAD - (8 + sizeof(uint64) + ii);
kk <= (int) (MAXPAYLOAD - (8 + sizeof(uint64) + ii));
kk += ii)
for (jj = 0; jj < ii; ++jj)
bp[jj + kk] = pat[jj];

View File

@ -55,7 +55,8 @@
#include "keywords.h"
int getaddr(int which, char *s, struct hostent **hpp);
// phoudoin, 20031026: FIXME: sysctl.h is a kernel private header!
extern int sysctl(int *, uint, void *, size_t *, void *, size_t);
union sockunion {
struct sockaddr sa;
@ -95,6 +96,16 @@ void mask_addr __P((void));
//int getaddr __P((int, char *, struct hostent **));
int rtmsg __P((int, int));
int x25_makemask __P((void));
int _getopt(int nargc, char *const *nargv, const char *ostr);
void usage(char *cp);
void quit(char *s);
int getaddr(int which, char *s, struct hostent **hpp);
char * any_ntoa(const struct sockaddr *sa);
void set_metric(char *value, int key);
void flushroutes(int argc, char *argv[]);
int keyword(char *cp);
void interfaces(void);
void inet_makenetandmask(uint32 net, struct sockaddr_in *sin, int bits);
extern void show __P((int, char **)); /* XXX - from show.c */
@ -109,6 +120,8 @@ char *optarg;
#define BADARG (int)':'
#define EMSG ""
int _getopt(int nargc, char *const *nargv, const char *ostr)
{
static char *place = EMSG;
@ -262,10 +275,7 @@ main(argc, argv)
* Purge all entries in the routing tables not
* associated with network interfaces.
*/
void
flushroutes(argc, argv)
int argc;
char *argv[];
void flushroutes(int argc, char *argv[])
{
size_t needed;
int mib[6], rlen, seqno;
@ -364,9 +374,7 @@ printf("write gave %d\n", rlen);
static char hexlist[] = "0123456789abcdef";
char *
any_ntoa(sa)
const struct sockaddr *sa;
char * any_ntoa(const struct sockaddr *sa)
{
static char obuf[240];
const char *in = sa->sa_data;
@ -571,10 +579,7 @@ netname(sa)
return (line);
}
void
set_metric(value, key)
char *value;
int key;
void set_metric(char *value, int key)
{
int flag = 0;
u_long noval, *valp = &noval;
@ -1048,7 +1053,7 @@ short ipx_nullh[] = {0,0,0};
short ipx_bh[] = {-1,-1,-1};
void
interfaces()
interfaces(void)
{
size_t needed;
int mib[6];
@ -1077,7 +1082,7 @@ interfaces()
}
void
monitor()
monitor(void)
{
int n;
char msg[2048];

View File

@ -52,6 +52,9 @@
#include <string.h>
#include <unistd.h>
// phoudoin, 20031026: FIXME: sysctl.h is a kernel private header!
extern int sysctl(int *, uint, void *, size_t *, void *, size_t);
/* XXX: things from route.c */
extern char *routename __P((struct sockaddr *));
extern char *netname __P((struct sockaddr *));
@ -95,6 +98,7 @@ static void pr_family __P((int));
int keyword(char *);
void usage(char *);
void show(int argc, char **argv);
/*
* Print routing tables.