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()