Commit 540839dd authored by Ben Avison's avatar Ben Avison
Browse files

ANSIized.

Version 5.43. Tagged as 'Internet-5_43'
parent 0a8a985e
......@@ -170,7 +170,6 @@ install_: ${DISCFILES} dirs
SetType ${INSTAPP}.!Run Obey
${CP} ${RDIR}.!Sprites ${INSTAPP}.!Sprites ${CPFLAGS}
${CP} ${RDIR}.!Sprites22 ${INSTAPP}.!Sprites22 ${CPFLAGS}
${CP} ${RDIR}.bin ${INSTAPP}.bin ${CPFLAGS}
${CP} ${RDIR}.files ${INSTAPP}.files ${CPFLAGS}
${CP} ${RDIR}.utils ${INSTAPP}.utils ${CPFLAGS}
|
......
......@@ -22,7 +22,7 @@ RM= remove
WFLAGS= fr~c~v
WIPE= -wipe
CFLAGS= -pcc -I$(INCLUDES) -c ${THROWBACK} -depend !Depend
CFLAGS= -wp -I$(INCLUDES) -c ${THROWBACK} -depend !Depend
OBJS= o.${TARGET}
......
......@@ -71,13 +71,27 @@ static char sccsid[] = "@(#)arp.c 8.2 (Berkeley) 1/2/94";
#include <sys/errno.h>
#include <unixlib.h>
#include <riscos.h>
#include <socklib.h>
#endif
#include <nlist.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef __unix
#include <paths.h>
#endif
void dump(u_long addr);
void usage(void);
int delete(char *host, char *info);
int set(int argc, char **argv);
int file(char *name);
void get(char *host);
int my_ether_aton(char *a, u_char *n);
int rtmsg(int cmd);
void quit(char *msg);
void ether_print(u_char *cp);
extern int errno;
static int pid;
static int kflag;
......@@ -87,16 +101,14 @@ static int s = -1;
char *__progname = "ARP";
void
close_sock()
close_sock(void)
{
if (s >= 0)
socketclose(s);
}
#endif
main(argc, argv)
int argc;
char **argv;
int main(int argc, char **argv)
{
int ch;
......@@ -140,8 +152,7 @@ main(argc, argv)
/*
* Process a file to set standard arp entries
*/
file(name)
char *name;
int file(char *name)
{
FILE *fp;
int i, retval;
......@@ -172,7 +183,8 @@ file(name)
return (retval);
}
getsocket() {
void getsocket(void)
{
if (s < 0) {
s = socket(PF_ROUTE, SOCK_RAW, 0);
if (s < 0) {
......@@ -194,9 +206,7 @@ struct {
/*
* Set an individual arp entry
*/
set(argc, argv)
int argc;
char **argv;
int set(int argc, char **argv)
{
struct hostent *hp;
register struct sockaddr_inarp *sin = &sin_m;
......@@ -279,8 +289,7 @@ overwrite:
/*
* Display an individual arp entry
*/
get(host)
char *host;
void get(char *host)
{
struct hostent *hp;
struct sockaddr_inarp *sin = &sin_m;
......@@ -308,9 +317,7 @@ get(host)
/*
* Delete an arp entry
*/
delete(host, info)
char *host;
char *info;
int delete(char *host, char *info)
{
struct hostent *hp;
register struct sockaddr_inarp *sin = &sin_m;
......@@ -368,8 +375,7 @@ delete:
/*
* Dump the entire arp table
*/
dump(addr)
u_long addr;
void dump(u_long addr)
{
int mib[6];
size_t needed;
......@@ -418,7 +424,7 @@ u_long addr;
}
printf("%s (%s) at ", host, inet_ntoa(sin->sin_addr));
if (sdl->sdl_alen)
ether_print(LLADDR(sdl));
ether_print((u_char *) LLADDR(sdl));
else
printf("(incomplete)");
if (rtm->rtm_rmx.rmx_expire == 0)
......@@ -437,8 +443,7 @@ u_long addr;
}
}
ether_print(cp)
u_char *cp;
void ether_print(u_char *cp)
{
printf("%x:%x:%x:%x:%x:%x", cp[0], cp[1], cp[2], cp[3], cp[4], cp[5]);
}
......@@ -459,7 +464,7 @@ my_ether_aton(char *a, u_char *n)
return (0);
}
usage()
void usage(void)
{
printf("Usage: arp -a [kernel] [kernel_memory]\n");
printf(" arp -d <hostname>\n");
......@@ -470,10 +475,10 @@ usage()
printf(" -d deletes the given hostname\n");
printf(" -s create an entry for the host with the given ethernet address\n");
printf(" -f read and add multiple entries from the given filename\n");
exit(1);
exit(1);
}
rtmsg(cmd)
int rtmsg(int cmd)
{
static int seq;
int rlen;
......@@ -542,8 +547,7 @@ doit:
return (0);
}
quit(msg)
char *msg;
void quit(char *msg)
{
fprintf(stderr, "%s\n", msg);
exit(1);
......
......@@ -39,9 +39,7 @@ void showhelp(void);
float elapsed_time(struct timeval before, struct timeval after);
int main(argc, argv)
int argc;
char *argv[];
int main(int argc, char *argv[])
{
char *hostname = NULL;
int addrtype = AF_INET;
......
......@@ -22,7 +22,7 @@ RM= remove
WFLAGS= fr~c~v
WIPE= -wipe
CFLAGS= -pcc -I$(INCLUDES) -c ${THROWBACK} -depend !Depend
CFLAGS= -wp -I$(INCLUDES) -c ${THROWBACK} -depend !Depend
OBJS= o.${TARGET}
......
......@@ -75,6 +75,8 @@ static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
#include <sys/fcntl.h>
#include <riscos.h>
#include "swis.h"
#include "socklib.h"
#include "unixlib.h"
const char *__progname = "ifconfig";
#else
#include <fcntl.h>
......@@ -101,9 +103,21 @@ kvm_t *kvmd;
extern int errno;
int errvarflag;
int setifflags(), setifaddr(), setifdstaddr(), setifnetmask();
int setifmetric(), setifmtu(), setifbroadaddr(), setifipdst();
int notealias(), setsnpaoffset(), setnsellength();
void setifflags();
void setifaddr();
void setifdstaddr();
void setifnetmask();
void setifmetric();
void setifmtu();
void setifbroadaddr();
void setifipdst();
void notealias();
void setsnpaoffset();
void setnsellength();
void Perror(char *cmd);
void status(void);
void adjust_nsellength(void);
void printb(char *s, register unsigned short v, register char *bits);
#ifdef __riscos
char *gstrans(const char *s);
#endif
......@@ -113,7 +127,7 @@ char *gstrans(const char *s);
struct cmd {
char *c_name;
int c_parameter; /* NEXTARG means next argv */
int (*c_func)();
void (*c_func)();
} cmds[] = {
{ "up", IFF_UP, setifflags } ,
{ "down", -IFF_UP, setifflags },
......@@ -153,16 +167,19 @@ struct cmd {
* XNS support liberally adapted from code written at the University of
* Maryland principally by James O'Toole and Chris Torek.
*/
int in_status(), in_getaddr();
int xns_status(), xns_getaddr();
int iso_status(), iso_getaddr();
int ether_status();
void in_status();
int in_getaddr();
void xns_status();
int xns_getaddr();
void iso_status();
int iso_getaddr();
void ether_status();
/* Known address families */
struct afswtch {
char *af_name;
short af_af;
int (*af_status)();
void (*af_status)();
int (*af_getaddr)();
int af_difaddr;
int af_aifaddr;
......@@ -182,9 +199,11 @@ struct afswtch {
struct afswtch *afp; /*the address family being set or asked about*/
int ifconfig(int argc, char *argv[], int af, struct afswtch *rafp, int flag);
#ifdef __riscos
static void
sock_close()
sock_close(void)
{
if (s >= 0)
socketclose(s);
......@@ -193,7 +212,7 @@ sock_close()
#endif
static void
printhelp()
printhelp(void)
{
printf("Usage: ifconfig [-ea] <interface> [address [dest_addr]] [parameters]\n");
printf(" configures network interface parameters\n");
......@@ -213,9 +232,7 @@ printhelp()
}
main(argc, argv)
int argc;
char *argv[];
int main(int argc, char *argv[])
{
int af = AF_INET;
register struct afswtch *rafp;
......@@ -298,12 +315,8 @@ main(argc, argv)
ifconfig(argc,argv,af,rafp,flag)
int argc;
char *argv[];
int af;
struct afswtch *rafp;
int flag;
int ifconfig(int argc, char *argv[], int af, struct afswtch *rafp,
int flag)
{
if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) {
Perror("ioctl (SIOCGIFFLAGS)");
......@@ -393,9 +406,7 @@ ifconfig(argc,argv,af,rafp,flag)
#define DSTADDR 3
/*ARGSUSED*/
setifaddr(addr, param)
char *addr;
short param;
void setifaddr(char *addr, short param)
{
/*
* Delay the ioctl to set the interface addr until flags are all set.
......@@ -408,8 +419,7 @@ setifaddr(addr, param)
(*afp->af_getaddr)(addr, (doalias >= 0 ? ADDR : RIDADDR));
}
setifnetmask(addr)
char *addr;
void setifnetmask(char *addr)
{
/*
* 950504 KWelton
......@@ -431,14 +441,12 @@ setifnetmask(addr)
(*afp->af_getaddr)(addr, MASK);
}
setifbroadaddr(addr)
char *addr;
void setifbroadaddr(char *addr)
{
(*afp->af_getaddr)(addr, DSTADDR);
}
setifipdst(addr)
char *addr;
void setifipdst(char *addr)
{
in_getaddr(addr, DSTADDR);
setipdst++;
......@@ -447,8 +455,7 @@ setifipdst(addr)
}
#define rqtosa(x) (&(((struct ifreq *)(afp->x))->ifr_addr))
/*ARGSUSED*/
notealias(addr, param)
char *addr;
void notealias(char *addr, int param)
{
if (setaddr && doalias == 0 && param < 0)
bcopy((caddr_t)rqtosa(af_addreq),
......@@ -463,16 +470,12 @@ notealias(addr, param)
}
/*ARGSUSED*/
setifdstaddr(addr, param)
char *addr;
int param;
void setifdstaddr(char *addr, int param)
{
(*afp->af_getaddr)(addr, DSTADDR);
}
setifflags(vname, value)
char *vname;
short value;
void setifflags(char *vname, short value)
{
if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) {
Perror("ioctl (SIOCGIFFLAGS)");
......@@ -491,8 +494,7 @@ setifflags(vname, value)
Perror(vname);
}
setifmetric(val)
char *val;
void setifmetric(char *val)
{
strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
ifr.ifr_metric = atoi(val);
......@@ -500,8 +502,7 @@ setifmetric(val)
Perror("ioctl (set metric)");
}
setifmtu(val)
char *val;
void setifmtu(char *val)
{
strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
ifr.ifr_mtu = atoi(val);
......@@ -509,8 +510,7 @@ setifmtu(val)
Perror("ioctl (set mtu)");
}
setsnpaoffset(val)
char *val;
void setsnpaoffset(char *val)
{
iso_addreq.ifra_snpaoffset = atoi(val);
}
......@@ -524,7 +524,7 @@ setsnpaoffset(val)
* Print the status of the interface. If an address family was
* specified, show it and it only; otherwise, show them all.
*/
status()
void status(void)
{
register struct afswtch *p = afp;
short af = ifr.ifr_addr.sa_family;
......@@ -544,8 +544,7 @@ status()
}
}
in_status(force)
int force;
void in_status(int force)
{
struct sockaddr_in *sin;
char *inet_ntoa();
......@@ -597,8 +596,7 @@ in_status(force)
}
xns_status(force)
int force;
void xns_status(int force)
{
struct sockaddr_ns *sns;
......@@ -634,8 +632,7 @@ xns_status(force)
putchar('\n');
}
iso_status(force)
int force;
void iso_status(int force)
{
struct sockaddr_iso *siso;
struct iso_ifreq ifr;
......@@ -681,10 +678,7 @@ iso_status(force)
putchar('\n');
}
kread(addr, buf, size)
u_long addr;
char *buf;
int size;
int kread(u_long addr, char *buf, int size)
{
if (kvm_read(kvmd, addr, buf, size) != size)
......@@ -693,7 +687,7 @@ kread(addr, buf, size)
}
/* Unashamedly stolen from netstat -- maybe someday we can us sysctl() */
ether_status()
void ether_status(void)
{
struct nlist nl[] = { { "_ifnet" } , "" };
u_long addr, addr2;
......@@ -765,8 +759,7 @@ ether_status()
kvm_close(kvmd);
}
Perror(cmd)
char *cmd;
void Perror(char *cmd)
{
extern int errno;
const char *errmess;
......@@ -802,8 +795,7 @@ struct sockaddr_in *sintab[] = {
SIN(ridreq.ifr_addr), SIN(addreq.ifra_addr),
SIN(addreq.ifra_mask), SIN(addreq.ifra_broadaddr)};
in_getaddr(s, which)
char *s;
int in_getaddr(char *s, int which)
{
register struct sockaddr_in *sin = sintab[which];
struct hostent *hp;
......@@ -830,10 +822,7 @@ in_getaddr(s, which)
/*
* Print a value a la the %b format of the kernel's printf
*/
printb(s, v, bits)
char *s;
register char *bits;
register unsigned short v;
void printb(char *s, register unsigned short v, register char *bits)
{
register int i, any = 0;
register char c;
......@@ -865,8 +854,7 @@ struct sockaddr_ns *snstab[] = {
SNS(ridreq.ifr_addr), SNS(addreq.ifra_addr),
SNS(addreq.ifra_mask), SNS(addreq.ifra_broadaddr)};
xns_getaddr(addr, which)
char *addr;
int xns_getaddr(char *addr, int which)
{
struct sockaddr_ns *sns = snstab[which];
struct ns_addr ns_addr();
......@@ -883,8 +871,7 @@ struct sockaddr_iso *sisotab[] = {
SISO(iso_ridreq.ifr_Addr), SISO(iso_addreq.ifra_addr),
SISO(iso_addreq.ifra_mask), SISO(iso_addreq.ifra_dstaddr)};
iso_getaddr(addr, which)
char *addr;
int iso_getaddr(char *addr, int which)
{
register struct sockaddr_iso *siso = sisotab[which];
struct iso_addr *iso_addr();
......@@ -899,8 +886,7 @@ char *addr;
}
}
setnsellength(val)
char *val;
void setnsellength(char *val)
{
nsellength = atoi(val);
if (nsellength < 0)
......@@ -909,15 +895,14 @@ setnsellength(val)
errx(1, "Setting NSEL length valid only for iso");
}
fixnsel(s)
register struct sockaddr_iso *s;
void fixnsel(register struct sockaddr_iso *s)
{
if (s->siso_family == 0)
return;
s->siso_tlen = nsellength;
}
adjust_nsellength()
void adjust_nsellength(void)
{
fixnsel(sisotab[RIDADDR]);
fixnsel(sisotab[ADDR]);
......@@ -926,8 +911,7 @@ adjust_nsellength()
#ifdef __riscos
char *
gstrans(s)
const char *s;
gstrans(const char *s)
{
static char gstbuf[256];
int len;
......
......@@ -22,7 +22,7 @@ RM= remove
WFLAGS= fr~c~v
WIPE= -wipe
CFLAGS= -pcc -I$(INCLUDES) -c ${THROWBACK} -depend !Depend
CFLAGS= -wp -I$(INCLUDES) -c ${THROWBACK} -depend !Depend
OBJS= o.${TARGET}
......
......@@ -19,7 +19,9 @@
* Copyright (c) 1995 Acorn Computers Ltd., Cambridge, England
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "sys/types.h"
......@@ -49,14 +51,14 @@ static char errbuf[128];
static const char errvar[] = "Inet$Error";
int do_whoamiaddr(), do_whoamimask();
void do_whoamiaddr(), do_whoamimask();
char *gstrans();
static struct cmd {
char *c_name;
int c_parameter;
int (*c_func)();
void (*c_func)();
} cmds[] = {
{ "revarp", SIOCGWHOIAMR, do_whoamiaddr},
{ "bootp", SIOCGWHOIAMB, do_whoamiaddr},
......@@ -64,6 +66,16 @@ static struct cmd {
{ 0, 0, 0},
};
void printhelp(void);
void Perror(char *cmd);
void status(void);
void setifflags(short value);
int gethname(void);
void sethname(void);
void printb(char *s, register unsigned short v, register char *bits);
void SetVar(const char *var, char *str);
void in_status(void);
static int identcmd = 0;
static int maskcmd = 0;
......@@ -76,9 +88,7 @@ static void tidyup(void)
}
}
main(argc, argv)
int argc;
char *argv[];
int main(int argc, char *argv[])
{
int af = AF_INET;
......@@ -197,18 +207,17 @@ main(argc, argv)
exit(0);
}
do_whoamiaddr(int cmd)
void do_whoamiaddr(int cmd)
{
identcmd = cmd;
}
do_whoamimask(int cmd)
void do_whoamimask(int cmd)
{
maskcmd = cmd;
}
setifflags(value)
short value;
void setifflags(short value)
{
if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) {
sprintf(errbuf, "cannot read flags: %s (error %d)",
......@@ -241,7 +250,7 @@ short value;
* Print the status of the interface. If an address family was
* specified, show it and it only; otherwise, show them all.
*/
status()
void status(void)
{
printf("%s: ", name);
printb("flags", flags, IFFBITS);
......@@ -251,7 +260,7 @@ status()
in_status();
}
in_status()
void in_status(void)
{
struct sockaddr_in *sin;
char *inet_ntoa();
......@@ -305,7 +314,7 @@ in_status()
#include <kernel.h>
#include <swis.h>
Perror(char *cmd)
void Perror(char *cmd)
{
char errmess[128];
......@@ -346,8 +355,7 @@ char *gstrans(char *s)
return(gstbuf);
}
SetVar(var, str)
char *var, *str;
void SetVar(const char *var, char *str)
{
_kernel_oserror *e;
_kernel_swi_regs rin, rout;
......@@ -363,10 +371,7 @@ SetVar(var, str)
/*
* Print a value a la the %b format
*/
printb(s, v, bits)
char *s;
register char *bits;
register unsigned short v;
void printb(char *s, register unsigned short v, register char *bits)
{
register int i, any = 0;
register char c;
......@@ -393,14 +398,14 @@ printb(s, v, bits)
}
}
printhelp()
void printhelp(void)
{
printf("Usage: ifrconfig [-e] <interface> [ revarp | bootp ] [ netmask ]\n");
printf(" configure network interface address and netmark via Reverse ARP\n");
printf("Options: -e write any errors to Inet$Error\n");
}
int gethname()
int gethname(void)
{
int nread;
_kernel_swi_regs rin, rout;
......@@ -420,7 +425,7 @@ int gethname()
return (nread);
}
sethname()
void sethname(void)
{
char namebuf[32];
struct sockaddr_in *sin;
......@@ -431,7 +436,7 @@ sethname()
strcpy(namebuf, "ARM_NoName");
else {
sin = (struct sockaddr_in *)&ifr.ifr_addr;
hp = gethostbyaddr(&sin->sin_addr, sizeof(u_long), AF_INET);
hp = gethostbyaddr((void *) &sin->sin_addr, sizeof(u_long), AF_INET);
if (hp != 0)
sprintf(namebuf, "%s", hp->h_name);
else
......
......@@ -23,7 +23,7 @@ RM= remove
WFLAGS= fr~c~v
WIPE= -wipe
CFLAGS= -pcc -I$(INCLUDES) -Dlint -c ${THROWBACK} -depend !Depend
CFLAGS= -wp -I$(INCLUDES) -Dlint -c ${THROWBACK} -depend !Depend
OBJS= o.main o.inet o.if o.route o.mroute
......
......@@ -74,9 +74,7 @@ static void catchalarm(int);
* Print a description of the network interfaces.
*/
void
intpr(interval, ifnetaddr)
int interval;
u_long ifnetaddr;
intpr(int interval, u_long ifnetaddr)
{
struct ifnet ifnet;
union {
......@@ -254,9 +252,7 @@ u_char signalled; /* set if alarm goes off "early" */
* First line printed at top of screen is always cumulative.
*/
static void
sidewaysintpr(interval, off)
unsigned interval;
u_long off;
sidewaysintpr(unsigned interval, u_long off)
{
struct ifnet ifnet;
u_long firstifnet;
......@@ -437,8 +433,7 @@ loop:
* Sets a flag to not wait for the alarm.
*/
static void
catchalarm(signo)
int signo;
catchalarm(int signo)
{
signalled = YES;
}
......
......@@ -87,7 +87,7 @@ struct socket sockb;
char *inetname(struct in_addr *);
void inetprint(struct in_addr *, int, char *, int);
extern void trimdomain(char *cp);
/*
* Print a summary of connections related to an Internet
* protocol. For TCP, also give state of connection.
......@@ -95,9 +95,7 @@ void inetprint(struct in_addr *, int, char *, int);
* -a (all) flag is specified.
*/
void
protopr(proto, name)
u_long proto; /* for sysctl version we pass proto # */
char *name;
protopr(u_long proto, char *name)
{
int istcp;
static int first = 1;
......@@ -236,9 +234,7 @@ protopr(proto, name)
* Dump TCP statistics structure.
*/
void
tcp_stats(off, name)
u_long off;
char *name;
tcp_stats(u_long off, char *name)
{
struct tcpstat tcpstat;
size_t len = sizeof tcpstat;
......@@ -329,9 +325,7 @@ tcp_stats(off, name)
* Dump UDP statistics structure.
*/
void
udp_stats(off, name)
u_long off;
char *name;
udp_stats(u_long off, char *name)
{
struct udpstat udpstat;
size_t len = sizeof udpstat;
......@@ -376,9 +370,7 @@ udp_stats(off, name)
* Dump IP statistics structure.
*/
void
ip_stats(off, name)
u_long off;
char *name;
ip_stats(u_long off, char *name)
{
struct ipstat ipstat;
size_t len = sizeof ipstat;
......@@ -457,9 +449,7 @@ static char *icmpnames[] = {
* Dump ICMP statistics.
*/
void
icmp_stats(off, name)
u_long off;
char *name;
icmp_stats(u_long off, char *name)
{
struct icmpstat icmpstat;
int i, first;
......@@ -527,9 +517,7 @@ icmp_stats(off, name)
* Dump IGMP statistics structure.
*/
void
igmp_stats(off, name)
u_long off;
char *name;
igmp_stats(u_long off, char *name)
{
struct igmpstat igmpstat;
size_t len = sizeof igmpstat;
......@@ -562,11 +550,8 @@ igmp_stats(off, name)
* Pretty print an Internet address (net address + port).
*/
void
inetprint(in, port, proto,numeric)
register struct in_addr *in;
int port;
char *proto;
int numeric;
inetprint(register struct in_addr *in, int port, char *proto,
int numeric)
{
struct servent *sp = 0;
char line[80], *cp;
......@@ -590,8 +575,7 @@ inetprint(in, port, proto,numeric)
* numeric value, otherwise try for symbolic name.
*/
char *
inetname(inp)
struct in_addr *inp;
inetname(struct in_addr *inp)
{
register char *cp;
static char line[MAXHOSTNAMELEN + 1];
......
......@@ -65,6 +65,7 @@ static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 3/1/94";
#include <riscos.h>
const char *__progname = "inetstat";
#endif
#define EXTERN /* store globals in this file */
#include "netstat.h"
struct nlist nl[] = {
......@@ -196,9 +197,7 @@ static struct protox *knownname(char *);
kvm_t *kvmd;
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
extern char *optarg;
extern int optind;
......@@ -425,9 +424,7 @@ main(argc, argv)
* is not in the namelist, ignore this one.
*/
static void
printproto(tp, name)
register struct protox *tp;
char *name;
printproto(register struct protox *tp, char *name)
{
void (*pr)();
u_long off;
......@@ -449,10 +446,7 @@ printproto(tp, name)
* Read kernel memory, return 0 on success.
*/
int
kread(addr, buf, size)
u_long addr;
char *buf;
int size;
kread(u_long addr, char *buf, int size)
{
if (kvm_read(kvmd, addr, buf, size) != size) {
......@@ -463,15 +457,13 @@ kread(addr, buf, size)
}
char *
plural(n)
int n;
plural(int n)
{
return (n != 1 ? "s" : "");
}
char *
plurales(n)
int n;
plurales(int n)
{
return (n != 1 ? "es" : "");
}
......@@ -480,8 +472,7 @@ plurales(n)
* Find the protox for the given "well-known" name.
*/
static struct protox *
knownname(name)
char *name;
knownname(char *name)
{
struct protox **tpp, *tp;
......@@ -496,8 +487,7 @@ knownname(name)
* Find the protox corresponding to name.
*/
static struct protox *
name2protox(name)
char *name;
name2protox(char *name)
{
struct protox *tp;
char **alias; /* alias from p->aliases */
......@@ -524,7 +514,7 @@ name2protox(name)
}
static void
usage()
usage(void)
{
(void)fprintf(stderr,"Usage: inetstat [-Aan] [-f <address_family>] [-M <core>] [-N <system>]\n");
(void)fprintf(stderr," inetstat [-bdghimnrs] [-f <address_family>] [-M <core>] [-N <system>]\n");
......@@ -545,15 +535,14 @@ usage()
(void)fprintf(stderr," -M extract values associated with the name list from the given core\n");
(void)fprintf(stderr," -N extract the namelist from the given system\n");
(void)fprintf(stderr," -I show information about the specified interface only\n");
(void)fprintf(stderr," -w show statistics at intervals of wait seconds\n");
(void)fprintf(stderr," -w show statistics at intervals of wait seconds\n");
(void)fprintf(stderr," -p show only statistics for the named protocol\n");
(void)fprintf(stderr," -s show per protocol statistics\n");
exit(1);
}
void
trimdomain(cp)
char *cp;
trimdomain(char *cp)
{
static char domain[MAXHOSTNAMELEN + 1];
static int first = 1;
......
......@@ -76,8 +76,7 @@ bool seen[256]; /* "have we seen this type yet?" */
* Print mbuf statistics.
*/
void
mbpr(mbaddr)
u_long mbaddr;
mbpr(u_long mbaddr)
{
register int totmem, totfree, totmbufs;
register int i;
......
......@@ -64,8 +64,7 @@
#include "riscos.h"
void
mroutepr(mrpaddr, mfcaddr, vifaddr)
u_long mrpaddr, mfcaddr, vifaddr;
mroutepr(u_long mrpaddr, u_long mfcaddr, u_long vifaddr)
{
u_int mrtproto;
struct mbuf *mfctable[MFCTBLSIZ];
......@@ -180,8 +179,7 @@ mroutepr(mrpaddr, mfcaddr, vifaddr)
void
mrt_stats(mrpaddr, mstaddr)
u_long mrpaddr, mstaddr;
mrt_stats(u_long mrpaddr, u_long mstaddr)
{
u_int mrtproto;
struct mrtstat mrtstat;
......
......@@ -81,9 +81,7 @@ static int first = 1;
*/
void
nsprotopr(off, name)
u_long off;
char *name;
nsprotopr(u_long off, char *name)
{
struct nspcb cb;
register struct nspcb *prev, *next;
......@@ -156,9 +154,7 @@ nsprotopr(off, name)
* Dump SPP statistics structure.
*/
void
spp_stats(off, name)
u_long off;
char *name;
spp_stats(u_long off, char *name)
{
struct spp_istat spp_istat;
#define sppstat spp_istat.newstats
......@@ -234,9 +230,7 @@ spp_stats(off, name)
* Dump IDP statistics structure.
*/
void
idp_stats(off, name)
u_long off;
char *name;
idp_stats(u_long off, char *name)
{
struct idpstat idpstat;
......@@ -270,9 +264,7 @@ static struct {
*/
/*ARGSUSED*/
void
nserr_stats(off, name)
u_long off;
char *name;
nserr_stats(u_long off, char *name)
{
struct ns_errstat ns_errstat;
register int j;
......@@ -313,8 +305,7 @@ nserr_stats(off, name)
}
static void
ns_erputil(z, c)
int z, c;
ns_erputil(int z, int c)
{
int j;
char codebuf[30];
......@@ -341,8 +332,7 @@ ns_erputil(z, c)
static struct sockaddr_ns ssns = {AF_NS};
static
char *ns_prpr(x)
struct ns_addr *x;
char *ns_prpr(struct ns_addr *x)
{
struct sockaddr_ns *sns = &ssns;
......
......@@ -74,6 +74,8 @@ static const char rcsid[] =
#include <riscos.h>
#include <unixlib.h>
extern void trimdomain(char *cp);
#define kget(p, d) (kread((u_long)(p), (char *)&(d), sizeof (d)))
/*
......@@ -137,8 +139,7 @@ static void domask(char *, u_long, u_long);
* Print routing tables.
*/
void
routepr(rtree)
u_long rtree;
routepr(u_long rtree)
{
struct radix_node_head *rnh, head;
int i;
......@@ -177,8 +178,7 @@ routepr(rtree)
* Print address family header before a section of the routing table.
*/
void
pr_family(af)
int af;
pr_family(int af)
{
char *afname;
......@@ -221,7 +221,7 @@ pr_family(af)
* Print header for routing table columns.
*/
void
pr_rthdr()
pr_rthdr(void)
{
if (Aflag)
printf("%-8.8s ","Address");
......@@ -232,8 +232,7 @@ pr_rthdr()
}
static struct sockaddr *
kgetsa(dst)
register struct sockaddr *dst;
kgetsa(register struct sockaddr *dst)
{
kget(dst, pt_u.u_sa);
......@@ -243,8 +242,7 @@ kgetsa(dst)
}
static void
p_tree(rn)
struct radix_node *rn;
p_tree(struct radix_node *rn)
{
again:
......@@ -282,7 +280,7 @@ again:
char nbuf[20];
static void
p_rtnode()
p_rtnode(void)
{
struct radix_mask *rm = rnode.rn_mklist;
......@@ -319,7 +317,7 @@ p_rtnode()
}
static void
ntreestuff()
ntreestuff(void)
{
size_t needed;
int mib[6];
......@@ -350,8 +348,7 @@ ntreestuff()
}
static void
np_rtentry(rtm)
register struct rt_msghdr *rtm;
np_rtentry(register struct rt_msghdr *rtm)
{
register struct sockaddr *sa = (struct sockaddr *)(rtm + 1);
#ifdef notdef
......@@ -392,9 +389,8 @@ np_rtentry(rtm)
}
static void
p_sockaddr(sa, mask, flags, width)
struct sockaddr *sa, *mask;
int flags, width;
p_sockaddr(struct sockaddr *sa, struct sockaddr *mask, int flags,
int width)
{
char workbuf[128], *cplim;
register char *cp = workbuf;
......@@ -500,9 +496,7 @@ p_sockaddr(sa, mask, flags, width)
}
static void
p_flags(f, format)
register int f;
char *format;
p_flags(register int f, char *format)
{
char name[33], *flags;
register struct bits *p = bits;
......@@ -515,8 +509,7 @@ p_flags(f, format)
}
static void
p_rtentry(rt)
register struct rtentry *rt;
p_rtentry(register struct rtentry *rt)
{
static struct ifnet ifnet, *lastif;
static char name[16];
......@@ -573,8 +566,7 @@ p_rtentry(rt)
}
char *
routename(in)
u_long in;
routename(u_long in)
{
register char *cp;
static char line[MAXHOSTNAMELEN + 1];
......@@ -602,8 +594,7 @@ routename(in)
}
static u_long
forgemask(a)
u_long a;
forgemask(u_long a)
{
u_long m;
......@@ -617,9 +608,7 @@ forgemask(a)
}
static void
domask(dst, addr, mask)
char *dst;
u_long addr, mask;
domask(char *dst, u_long addr, u_long mask)
{
register int b, i;
......@@ -651,8 +640,7 @@ domask(dst, addr, mask)
* The address is assumed to be that of a net or subnet, not a host.
*/
char *
netname(in, mask)
u_long in, mask;
netname(u_long in, u_long mask)
{
char *cp = 0;
static char line[MAXHOSTNAMELEN + 1];
......@@ -691,8 +679,7 @@ netname(in, mask)
* Print routing statistics
*/
void
rt_stats(off)
u_long off;
rt_stats(u_long off)
{
struct rtstat rtstat;
......@@ -716,8 +703,7 @@ rt_stats(off)
#if 0
char *
ipx_print(sa)
register struct sockaddr *sa;
ipx_print(register struct sockaddr *sa)
{
u_short port;
struct servent *sp = 0;
......@@ -786,8 +772,7 @@ ipx_print(sa)
}
char *
ipx_phost(sa)
struct sockaddr *sa;
ipx_phost(struct sockaddr *sa)
{
register struct sockaddr_ipx *sipx = (struct sockaddr_ipx *)sa;
struct sockaddr_ipx work;
......@@ -812,8 +797,7 @@ short ns_nullh[] = {0,0,0};
short ns_bh[] = {-1,-1,-1};
char *
ns_print(sa)
register struct sockaddr *sa;
ns_print(register struct sockaddr *sa)
{
register struct sockaddr_ns *sns = (struct sockaddr_ns*)sa;
struct ns_addr work;
......@@ -859,8 +843,7 @@ ns_print(sa)
}
char *
ns_phost(sa)
struct sockaddr *sa;
ns_phost(struct sockaddr *sa)
{
register struct sockaddr_ns *sns = (struct sockaddr_ns *)sa;
struct sockaddr_ns work;
......@@ -879,8 +862,7 @@ ns_phost(sa)
#endif
void
upHex(p0)
char *p0;
upHex(char *p0)
{
register char *p = p0;
......
......@@ -65,8 +65,7 @@ static int nfiles;
extern kvm_t *kvmd;
void
unixpr(off)
u_long off;
unixpr(u_long off)
{
register struct file *fp;
struct socket sock, *so = &sock;
......@@ -96,9 +95,7 @@ static char *socktype[] =
{ "#0", "stream", "dgram", "raw", "rdm", "seqpacket" };
static void
unixdomainpr(so, soaddr)
register struct socket *so;
caddr_t soaddr;
unixdomainpr(register struct socket *so, caddr_t soaddr)
{
struct unpcb unpcb, *unp = &unpcb;
struct mbuf mbuf, *m;
......
......@@ -35,27 +35,30 @@
#include <sys/cdefs.h>
int Aflag; /* show addresses of protocol control block */
int aflag; /* show all sockets (including servers) */
int bflag; /* show i/f total bytes in/out */
int dflag; /* show i/f dropped packets */
int gflag; /* show group (multicast) routing or stats */
int iflag; /* show interfaces */
int mflag; /* show memory stats */
int nflag; /* show addresses numerically */
int pflag; /* show given protocol */
int rflag; /* show routing tables (or routing stats) */
int sflag; /* show protocol statistics */
int tflag; /* show i/f watchdog timers */
int interval; /* repeat interval for i/f stats */
char *interface; /* desired i/f for stats, or NULL for all i/fs */
int unit; /* unit number for above */
int af; /* address family */
char *prog; /* program name */
#ifndef EXTERN
#define EXTERN extern
#endif
EXTERN int Aflag; /* show addresses of protocol control block */
EXTERN int aflag; /* show all sockets (including servers) */
EXTERN int bflag; /* show i/f total bytes in/out */
EXTERN int dflag; /* show i/f dropped packets */
EXTERN int gflag; /* show group (multicast) routing or stats */
EXTERN int iflag; /* show interfaces */
EXTERN int mflag; /* show memory stats */
EXTERN int nflag; /* show addresses numerically */
EXTERN int pflag; /* show given protocol */
EXTERN int rflag; /* show routing tables (or routing stats) */
EXTERN int sflag; /* show protocol statistics */
EXTERN int tflag; /* show i/f watchdog timers */
EXTERN int interval; /* repeat interval for i/f stats */
EXTERN char *interface; /* desired i/f for stats, or NULL for all i/fs */
EXTERN int unit; /* unit number for above */
EXTERN int af; /* address family */
EXTERN char *prog; /* program name */
int kread(u_long addr, char *buf, int size);
......
......@@ -22,7 +22,7 @@ RM= remove
WFLAGS= fr~c~v
WIPE= -wipe
CFLAGS= -pcc -I$(INCLUDES) -c ${THROWBACK} -depend !Depend
CFLAGS= -I$(INCLUDES) -c ${THROWBACK} -depend !Depend
OBJS= o.${TARGET}
......
......@@ -117,7 +117,7 @@ void startfilers(void)
_swi(OS_ServiceCall, _IN(1), Service_StartedFiler);
}
int main()
int main(void)
{
static int mlist[]={0};
int event_code;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment