Fix warnings.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5171 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -62,6 +62,9 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/time.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 *);
|
int delete (const char *, const char *);
|
||||||
void search(in_addr_t addr, void (*action)(struct sockaddr_dl *sdl,
|
void search(in_addr_t addr, void (*action)(struct sockaddr_dl *sdl,
|
||||||
struct sockaddr_inarp *sin, struct rt_msghdr *rtm));
|
struct sockaddr_inarp *sin, struct rt_msghdr *rtm));
|
||||||
@@ -77,6 +80,7 @@ void getsocket (void);
|
|||||||
int rtmsg (int);
|
int rtmsg (int);
|
||||||
int set (int, char **);
|
int set (int, char **);
|
||||||
void usage (void);
|
void usage (void);
|
||||||
|
void err(int error, char *msg);
|
||||||
|
|
||||||
static int pid;
|
static int pid;
|
||||||
static int nflag; /* no reverse dns lookups */
|
static int nflag; /* no reverse dns lookups */
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ void in_getaddr(char *s, int which);
|
|||||||
void in_getprefix(char *plen, int which);
|
void in_getprefix(char *plen, int which);
|
||||||
void status(int link);
|
void status(int link);
|
||||||
void printif(struct ifreq *ifrm, int ifaliases);
|
void printif(struct ifreq *ifrm, int ifaliases);
|
||||||
|
void usage(void);
|
||||||
|
|
||||||
/* The commands we recognise... */
|
/* The commands we recognise... */
|
||||||
struct _cmd_ {
|
struct _cmd_ {
|
||||||
@@ -90,7 +91,7 @@ const struct afswtch {
|
|||||||
|
|
||||||
const struct afswtch *afp; /*the address family being set or asked about*/
|
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, "OpenBeOS Network Team: ifconfig: version %s\n", version);
|
||||||
fprintf(stderr, "usage: ifconfig [ -m ] [ -a ] [ -A ] [ interface ]\n"
|
fprintf(stderr, "usage: ifconfig [ -m ] [ -a ] [ -A ] [ interface ]\n"
|
||||||
@@ -305,7 +306,7 @@ void printif(struct ifreq *ifrm, int ifaliases)
|
|||||||
err(1, "malloc");
|
err(1, "malloc");
|
||||||
if (ioctl(sock, SIOCGIFCONF, &ifc) < 0)
|
if (ioctl(sock, SIOCGIFCONF, &ifc) < 0)
|
||||||
err(1, "SIOCGIFCONF");
|
err(1, "SIOCGIFCONF");
|
||||||
if (ifc.ifc_len + sizeof(ifreq) < len)
|
if ((int) (ifc.ifc_len + sizeof(ifreq)) < len)
|
||||||
break;
|
break;
|
||||||
len *= 2;
|
len *= 2;
|
||||||
}
|
}
|
||||||
@@ -315,12 +316,12 @@ void printif(struct ifreq *ifrm, int ifaliases)
|
|||||||
ifrp = (struct ifreq *)((caddr_t)ifc.ifc_req + i);
|
ifrp = (struct ifreq *)((caddr_t)ifc.ifc_req + i);
|
||||||
memcpy(ifrbuf, ifrp, sizeof(*ifrp));
|
memcpy(ifrbuf, ifrp, sizeof(*ifrp));
|
||||||
siz = ((struct ifreq *)ifrbuf)->ifr_addr.sa_len;
|
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_addr);
|
||||||
siz += sizeof(ifrp->ifr_name);
|
siz += sizeof(ifrp->ifr_name);
|
||||||
i += siz;
|
i += siz;
|
||||||
/* avoid alignment issue */
|
/* avoid alignment issue */
|
||||||
if (sizeof(ifrbuf) < siz)
|
if ((int) sizeof(ifrbuf) < siz)
|
||||||
err(1, "ifr too big");
|
err(1, "ifr too big");
|
||||||
memcpy(ifrbuf, ifrp, siz);
|
memcpy(ifrbuf, ifrp, siz);
|
||||||
ifrp = (struct ifreq *)ifrbuf;
|
ifrp = (struct ifreq *)ifrbuf;
|
||||||
|
|||||||
+22
-22
@@ -151,16 +151,20 @@ int reset_kerninfo;
|
|||||||
int bufspace = DEFAULT_BUFSPACE;
|
int bufspace = DEFAULT_BUFSPACE;
|
||||||
|
|
||||||
void fill(char *, char *);
|
void fill(char *, char *);
|
||||||
void catcher(), prtsig(), finish(), summary(int);
|
void catcher(int);
|
||||||
|
void prtsig(int);
|
||||||
|
void finish(int);
|
||||||
|
void summary(int);
|
||||||
int compute_in_cksum (u_short *, int);
|
int compute_in_cksum (u_short *, int);
|
||||||
void pinger();
|
void pinger(void);
|
||||||
char *pr_addr (in_addr_t);
|
char *pr_addr (in_addr_t);
|
||||||
int check_icmph (struct ip *);
|
int check_icmph (struct ip *);
|
||||||
void pr_icmph (struct icmp *);
|
void pr_icmph (struct icmp *);
|
||||||
void pr_pack (char *, int, struct sockaddr_in *);
|
void pr_pack (char *, int, struct sockaddr_in *);
|
||||||
void pr_retip (struct ip *);
|
void pr_retip (struct ip *);
|
||||||
|
void pr_iph(struct ip *ip);
|
||||||
uint64 qsqrt (uint64);
|
uint64 qsqrt (uint64);
|
||||||
void usage();
|
void usage(void);
|
||||||
|
|
||||||
|
|
||||||
static void err(int exitval, char *where)
|
static void err(int exitval, char *where)
|
||||||
@@ -339,7 +343,7 @@ int main(int argc, char **argv)
|
|||||||
if (options & F_FLOOD && options & F_INTERVAL)
|
if (options & F_FLOOD && options & F_INTERVAL)
|
||||||
err(1, "-f and -i options are incompatible");
|
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;
|
timing = 1;
|
||||||
packlen = datalen + MAXIPLEN + MAXICMPLEN;
|
packlen = datalen + MAXIPLEN + MAXICMPLEN;
|
||||||
if (!(packet = (u_char *)malloc((u_int)packlen)))
|
if (!(packet = (u_char *)malloc((u_int)packlen)))
|
||||||
@@ -470,7 +474,7 @@ int main(int argc, char **argv)
|
|||||||
pinger();
|
pinger();
|
||||||
|
|
||||||
if ((options & F_FLOOD) == 0)
|
if ((options & F_FLOOD) == 0)
|
||||||
catcher(); /* start things going */
|
catcher(0); /* start things going */
|
||||||
|
|
||||||
fdmasks = _howmany(s+1, NFDBITS) * sizeof(fd_mask);
|
fdmasks = _howmany(s+1, NFDBITS) * sizeof(fd_mask);
|
||||||
if ((fdmaskp = (fd_set *)malloc(fdmasks)) == NULL)
|
if ((fdmaskp = (fd_set *)malloc(fdmasks)) == NULL)
|
||||||
@@ -509,7 +513,7 @@ int main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
free(fdmaskp);
|
free(fdmaskp);
|
||||||
finish();
|
finish(0);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
exit(0); /* Make the compiler happy */
|
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
|
* launched exactly at 1-second intervals). This does not affect the
|
||||||
* quality of the delay and loss statistics.
|
* quality of the delay and loss statistics.
|
||||||
*/
|
*/
|
||||||
void catcher()
|
void catcher(int sig)
|
||||||
{
|
{
|
||||||
int waittime;
|
int waittime;
|
||||||
int save_errno = errno;
|
int save_errno = errno;
|
||||||
@@ -551,7 +555,7 @@ void catcher()
|
|||||||
* Print statistics when SIGINFO is received.
|
* Print statistics when SIGINFO is received.
|
||||||
* XXX not race safe
|
* XXX not race safe
|
||||||
*/
|
*/
|
||||||
void prtsig()
|
void prtsig(int sig)
|
||||||
{
|
{
|
||||||
int save_errno = errno;
|
int save_errno = errno;
|
||||||
|
|
||||||
@@ -567,7 +571,7 @@ void prtsig()
|
|||||||
* of the data portion are used to hold a UNIX "timeval" struct in VAX
|
* of the data portion are used to hold a UNIX "timeval" struct in VAX
|
||||||
* byte-order, to compute the round-trip time.
|
* byte-order, to compute the round-trip time.
|
||||||
*/
|
*/
|
||||||
void pinger()
|
void pinger(void)
|
||||||
{
|
{
|
||||||
struct icmp *icp;
|
struct icmp *icp;
|
||||||
int cc;
|
int cc;
|
||||||
@@ -701,13 +705,13 @@ void pr_pack(char *buf, int cc, struct sockaddr_in *from)
|
|||||||
/* check the data */
|
/* check the data */
|
||||||
cp = (u_char*)&icp->icmp_data[sizeof(bigtime_t)];
|
cp = (u_char*)&icp->icmp_data[sizeof(bigtime_t)];
|
||||||
dp = &outpack[8 + 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) {
|
++i, ++cp, ++dp) {
|
||||||
if (*cp != *dp) {
|
if (*cp != *dp) {
|
||||||
(void)printf("\nwrong data byte #%d should be 0x%x but was 0x%x",
|
(void)printf("\nwrong data byte #%d should be 0x%x but was 0x%x",
|
||||||
i, *dp, *cp);
|
i, *dp, *cp);
|
||||||
cp = (u_char*)&icp->icmp_data[0];
|
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)
|
if ((i % 32) == 8)
|
||||||
(void)printf("\n\t");
|
(void)printf("\n\t");
|
||||||
(void)printf("%x ", *cp);
|
(void)printf("%x ", *cp);
|
||||||
@@ -777,7 +781,7 @@ void pr_pack(char *buf, int cc, struct sockaddr_in *from)
|
|||||||
i -= IPOPT_MINOFF;
|
i -= IPOPT_MINOFF;
|
||||||
if (i <= 0)
|
if (i <= 0)
|
||||||
continue;
|
continue;
|
||||||
if (i == old_rrlen
|
if ((int) i == old_rrlen
|
||||||
&& cp == (u_char *) buf + sizeof(struct ip) + 2
|
&& cp == (u_char *) buf + sizeof(struct ip) + 2
|
||||||
&& !memcmp(cp, old_rr, i)
|
&& !memcmp(cp, old_rr, i)
|
||||||
&& !(options & F_FLOOD)) {
|
&& !(options & F_FLOOD)) {
|
||||||
@@ -904,7 +908,7 @@ void summary(int header)
|
|||||||
|
|
||||||
uint64 qsqrt(uint64 qdev)
|
uint64 qsqrt(uint64 qdev)
|
||||||
{
|
{
|
||||||
uint64 y, x = 1;
|
int64 y, x = 1;
|
||||||
|
|
||||||
if (!qdev)
|
if (!qdev)
|
||||||
return(0);
|
return(0);
|
||||||
@@ -916,14 +920,14 @@ uint64 qsqrt(uint64 qdev)
|
|||||||
x /= 2;
|
x /= 2;
|
||||||
} while ((x - y) > 1 || (x - y) > -1);
|
} while ((x - y) > 1 || (x - y) > -1);
|
||||||
|
|
||||||
return(x);
|
return (uint64) x;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* finish --
|
* finish --
|
||||||
* Print out statistics, and give up.
|
* Print out statistics, and give up.
|
||||||
*/
|
*/
|
||||||
void finish()
|
void finish(int sig)
|
||||||
{
|
{
|
||||||
(void)signal(SIGINT, SIG_IGN);
|
(void)signal(SIGINT, SIG_IGN);
|
||||||
(void)signal(SIGALRM, SIG_IGN);
|
(void)signal(SIGALRM, SIG_IGN);
|
||||||
@@ -1151,9 +1155,7 @@ pr_icmph(icp)
|
|||||||
* pr_iph --
|
* pr_iph --
|
||||||
* Print an IP header with options.
|
* Print an IP header with options.
|
||||||
*/
|
*/
|
||||||
void
|
void pr_iph(struct ip *ip)
|
||||||
pr_iph(ip)
|
|
||||||
struct ip *ip;
|
|
||||||
{
|
{
|
||||||
int hlen;
|
int hlen;
|
||||||
u_char *cp;
|
u_char *cp;
|
||||||
@@ -1203,9 +1205,7 @@ pr_addr(a)
|
|||||||
* pr_retip --
|
* pr_retip --
|
||||||
* Dump some info on a returned (via ICMP) IP packet.
|
* Dump some info on a returned (via ICMP) IP packet.
|
||||||
*/
|
*/
|
||||||
void
|
void pr_retip(struct ip *ip)
|
||||||
pr_retip(ip)
|
|
||||||
struct ip *ip;
|
|
||||||
{
|
{
|
||||||
int hlen;
|
int hlen;
|
||||||
u_char *cp;
|
u_char *cp;
|
||||||
@@ -1241,7 +1241,7 @@ fill(bp, patp)
|
|||||||
|
|
||||||
if (ii > 0)
|
if (ii > 0)
|
||||||
for (kk = 0;
|
for (kk = 0;
|
||||||
kk <= MAXPAYLOAD - (8 + sizeof(uint64) + ii);
|
kk <= (int) (MAXPAYLOAD - (8 + sizeof(uint64) + ii));
|
||||||
kk += ii)
|
kk += ii)
|
||||||
for (jj = 0; jj < ii; ++jj)
|
for (jj = 0; jj < ii; ++jj)
|
||||||
bp[jj + kk] = pat[jj];
|
bp[jj + kk] = pat[jj];
|
||||||
|
|||||||
+19
-14
@@ -55,7 +55,8 @@
|
|||||||
|
|
||||||
#include "keywords.h"
|
#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 {
|
union sockunion {
|
||||||
struct sockaddr sa;
|
struct sockaddr sa;
|
||||||
@@ -95,6 +96,16 @@ void mask_addr __P((void));
|
|||||||
//int getaddr __P((int, char *, struct hostent **));
|
//int getaddr __P((int, char *, struct hostent **));
|
||||||
int rtmsg __P((int, int));
|
int rtmsg __P((int, int));
|
||||||
int x25_makemask __P((void));
|
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 */
|
extern void show __P((int, char **)); /* XXX - from show.c */
|
||||||
|
|
||||||
@@ -109,6 +120,8 @@ char *optarg;
|
|||||||
#define BADARG (int)':'
|
#define BADARG (int)':'
|
||||||
#define EMSG ""
|
#define EMSG ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int _getopt(int nargc, char *const *nargv, const char *ostr)
|
int _getopt(int nargc, char *const *nargv, const char *ostr)
|
||||||
{
|
{
|
||||||
static char *place = EMSG;
|
static char *place = EMSG;
|
||||||
@@ -262,10 +275,7 @@ main(argc, argv)
|
|||||||
* Purge all entries in the routing tables not
|
* Purge all entries in the routing tables not
|
||||||
* associated with network interfaces.
|
* associated with network interfaces.
|
||||||
*/
|
*/
|
||||||
void
|
void flushroutes(int argc, char *argv[])
|
||||||
flushroutes(argc, argv)
|
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
size_t needed;
|
size_t needed;
|
||||||
int mib[6], rlen, seqno;
|
int mib[6], rlen, seqno;
|
||||||
@@ -364,9 +374,7 @@ printf("write gave %d\n", rlen);
|
|||||||
|
|
||||||
static char hexlist[] = "0123456789abcdef";
|
static char hexlist[] = "0123456789abcdef";
|
||||||
|
|
||||||
char *
|
char * any_ntoa(const struct sockaddr *sa)
|
||||||
any_ntoa(sa)
|
|
||||||
const struct sockaddr *sa;
|
|
||||||
{
|
{
|
||||||
static char obuf[240];
|
static char obuf[240];
|
||||||
const char *in = sa->sa_data;
|
const char *in = sa->sa_data;
|
||||||
@@ -571,10 +579,7 @@ netname(sa)
|
|||||||
return (line);
|
return (line);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void set_metric(char *value, int key)
|
||||||
set_metric(value, key)
|
|
||||||
char *value;
|
|
||||||
int key;
|
|
||||||
{
|
{
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
u_long noval, *valp = &noval;
|
u_long noval, *valp = &noval;
|
||||||
@@ -1048,7 +1053,7 @@ short ipx_nullh[] = {0,0,0};
|
|||||||
short ipx_bh[] = {-1,-1,-1};
|
short ipx_bh[] = {-1,-1,-1};
|
||||||
|
|
||||||
void
|
void
|
||||||
interfaces()
|
interfaces(void)
|
||||||
{
|
{
|
||||||
size_t needed;
|
size_t needed;
|
||||||
int mib[6];
|
int mib[6];
|
||||||
@@ -1077,7 +1082,7 @@ interfaces()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
monitor()
|
monitor(void)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
char msg[2048];
|
char msg[2048];
|
||||||
|
|||||||
@@ -52,6 +52,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.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 */
|
/* XXX: things from route.c */
|
||||||
extern char *routename __P((struct sockaddr *));
|
extern char *routename __P((struct sockaddr *));
|
||||||
extern char *netname __P((struct sockaddr *));
|
extern char *netname __P((struct sockaddr *));
|
||||||
@@ -95,6 +98,7 @@ static void pr_family __P((int));
|
|||||||
|
|
||||||
int keyword(char *);
|
int keyword(char *);
|
||||||
void usage(char *);
|
void usage(char *);
|
||||||
|
void show(int argc, char **argv);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Print routing tables.
|
* Print routing tables.
|
||||||
|
|||||||
Reference in New Issue
Block a user