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 ...@@ -170,7 +170,6 @@ install_: ${DISCFILES} dirs
SetType ${INSTAPP}.!Run Obey SetType ${INSTAPP}.!Run Obey
${CP} ${RDIR}.!Sprites ${INSTAPP}.!Sprites ${CPFLAGS} ${CP} ${RDIR}.!Sprites ${INSTAPP}.!Sprites ${CPFLAGS}
${CP} ${RDIR}.!Sprites22 ${INSTAPP}.!Sprites22 ${CPFLAGS} ${CP} ${RDIR}.!Sprites22 ${INSTAPP}.!Sprites22 ${CPFLAGS}
${CP} ${RDIR}.bin ${INSTAPP}.bin ${CPFLAGS}
${CP} ${RDIR}.files ${INSTAPP}.files ${CPFLAGS} ${CP} ${RDIR}.files ${INSTAPP}.files ${CPFLAGS}
${CP} ${RDIR}.utils ${INSTAPP}.utils ${CPFLAGS} ${CP} ${RDIR}.utils ${INSTAPP}.utils ${CPFLAGS}
| |
......
...@@ -22,7 +22,7 @@ RM= remove ...@@ -22,7 +22,7 @@ RM= remove
WFLAGS= fr~c~v WFLAGS= fr~c~v
WIPE= -wipe WIPE= -wipe
CFLAGS= -pcc -I$(INCLUDES) -c ${THROWBACK} -depend !Depend CFLAGS= -wp -I$(INCLUDES) -c ${THROWBACK} -depend !Depend
OBJS= o.${TARGET} OBJS= o.${TARGET}
......
...@@ -71,13 +71,27 @@ static char sccsid[] = "@(#)arp.c 8.2 (Berkeley) 1/2/94"; ...@@ -71,13 +71,27 @@ static char sccsid[] = "@(#)arp.c 8.2 (Berkeley) 1/2/94";
#include <sys/errno.h> #include <sys/errno.h>
#include <unixlib.h> #include <unixlib.h>
#include <riscos.h> #include <riscos.h>
#include <socklib.h>
#endif #endif
#include <nlist.h> #include <nlist.h>
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#ifdef __unix #ifdef __unix
#include <paths.h> #include <paths.h>
#endif #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; extern int errno;
static int pid; static int pid;
static int kflag; static int kflag;
...@@ -87,16 +101,14 @@ static int s = -1; ...@@ -87,16 +101,14 @@ static int s = -1;
char *__progname = "ARP"; char *__progname = "ARP";
void void
close_sock() close_sock(void)
{ {
if (s >= 0) if (s >= 0)
socketclose(s); socketclose(s);
} }
#endif #endif
main(argc, argv) int main(int argc, char **argv)
int argc;
char **argv;
{ {
int ch; int ch;
...@@ -140,8 +152,7 @@ main(argc, argv) ...@@ -140,8 +152,7 @@ main(argc, argv)
/* /*
* Process a file to set standard arp entries * Process a file to set standard arp entries
*/ */
file(name) int file(char *name)
char *name;
{ {
FILE *fp; FILE *fp;
int i, retval; int i, retval;
...@@ -172,7 +183,8 @@ file(name) ...@@ -172,7 +183,8 @@ file(name)
return (retval); return (retval);
} }
getsocket() { void getsocket(void)
{
if (s < 0) { if (s < 0) {
s = socket(PF_ROUTE, SOCK_RAW, 0); s = socket(PF_ROUTE, SOCK_RAW, 0);
if (s < 0) { if (s < 0) {
...@@ -194,9 +206,7 @@ struct { ...@@ -194,9 +206,7 @@ struct {
/* /*
* Set an individual arp entry * Set an individual arp entry
*/ */
set(argc, argv) int set(int argc, char **argv)
int argc;
char **argv;
{ {
struct hostent *hp; struct hostent *hp;
register struct sockaddr_inarp *sin = &sin_m; register struct sockaddr_inarp *sin = &sin_m;
...@@ -279,8 +289,7 @@ overwrite: ...@@ -279,8 +289,7 @@ overwrite:
/* /*
* Display an individual arp entry * Display an individual arp entry
*/ */
get(host) void get(char *host)
char *host;
{ {
struct hostent *hp; struct hostent *hp;
struct sockaddr_inarp *sin = &sin_m; struct sockaddr_inarp *sin = &sin_m;
...@@ -308,9 +317,7 @@ get(host) ...@@ -308,9 +317,7 @@ get(host)
/* /*
* Delete an arp entry * Delete an arp entry
*/ */
delete(host, info) int delete(char *host, char *info)
char *host;
char *info;
{ {
struct hostent *hp; struct hostent *hp;
register struct sockaddr_inarp *sin = &sin_m; register struct sockaddr_inarp *sin = &sin_m;
...@@ -368,8 +375,7 @@ delete: ...@@ -368,8 +375,7 @@ delete:
/* /*
* Dump the entire arp table * Dump the entire arp table
*/ */
dump(addr) void dump(u_long addr)
u_long addr;
{ {
int mib[6]; int mib[6];
size_t needed; size_t needed;
...@@ -418,7 +424,7 @@ u_long addr; ...@@ -418,7 +424,7 @@ u_long addr;
} }
printf("%s (%s) at ", host, inet_ntoa(sin->sin_addr)); printf("%s (%s) at ", host, inet_ntoa(sin->sin_addr));
if (sdl->sdl_alen) if (sdl->sdl_alen)
ether_print(LLADDR(sdl)); ether_print((u_char *) LLADDR(sdl));
else else
printf("(incomplete)"); printf("(incomplete)");
if (rtm->rtm_rmx.rmx_expire == 0) if (rtm->rtm_rmx.rmx_expire == 0)
...@@ -437,8 +443,7 @@ u_long addr; ...@@ -437,8 +443,7 @@ u_long addr;
} }
} }
ether_print(cp) void ether_print(u_char *cp)
u_char *cp;
{ {
printf("%x:%x:%x:%x:%x:%x", cp[0], cp[1], cp[2], cp[3], cp[4], cp[5]); 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) ...@@ -459,7 +464,7 @@ my_ether_aton(char *a, u_char *n)
return (0); return (0);
} }
usage() void usage(void)
{ {
printf("Usage: arp -a [kernel] [kernel_memory]\n"); printf("Usage: arp -a [kernel] [kernel_memory]\n");
printf(" arp -d <hostname>\n"); printf(" arp -d <hostname>\n");
...@@ -470,10 +475,10 @@ usage() ...@@ -470,10 +475,10 @@ usage()
printf(" -d deletes the given hostname\n"); printf(" -d deletes the given hostname\n");
printf(" -s create an entry for the host with the given ethernet address\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"); 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; static int seq;
int rlen; int rlen;
...@@ -542,8 +547,7 @@ doit: ...@@ -542,8 +547,7 @@ doit:
return (0); return (0);
} }
quit(msg) void quit(char *msg)
char *msg;
{ {
fprintf(stderr, "%s\n", msg); fprintf(stderr, "%s\n", msg);
exit(1); exit(1);
......
...@@ -39,9 +39,7 @@ void showhelp(void); ...@@ -39,9 +39,7 @@ void showhelp(void);
float elapsed_time(struct timeval before, struct timeval after); float elapsed_time(struct timeval before, struct timeval after);
int main(argc, argv) int main(int argc, char *argv[])
int argc;
char *argv[];
{ {
char *hostname = NULL; char *hostname = NULL;
int addrtype = AF_INET; int addrtype = AF_INET;
......
...@@ -22,7 +22,7 @@ RM= remove ...@@ -22,7 +22,7 @@ RM= remove
WFLAGS= fr~c~v WFLAGS= fr~c~v
WIPE= -wipe WIPE= -wipe
CFLAGS= -pcc -I$(INCLUDES) -c ${THROWBACK} -depend !Depend CFLAGS= -wp -I$(INCLUDES) -c ${THROWBACK} -depend !Depend
OBJS= o.${TARGET} OBJS= o.${TARGET}
......
...@@ -75,6 +75,8 @@ static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94"; ...@@ -75,6 +75,8 @@ static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
#include <sys/fcntl.h> #include <sys/fcntl.h>
#include <riscos.h> #include <riscos.h>
#include "swis.h" #include "swis.h"
#include "socklib.h"
#include "unixlib.h"
const char *__progname = "ifconfig"; const char *__progname = "ifconfig";
#else #else
#include <fcntl.h> #include <fcntl.h>
...@@ -101,9 +103,21 @@ kvm_t *kvmd; ...@@ -101,9 +103,21 @@ kvm_t *kvmd;
extern int errno; extern int errno;
int errvarflag; int errvarflag;
int setifflags(), setifaddr(), setifdstaddr(), setifnetmask(); void setifflags();
int setifmetric(), setifmtu(), setifbroadaddr(), setifipdst(); void setifaddr();
int notealias(), setsnpaoffset(), setnsellength(); 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 #ifdef __riscos
char *gstrans(const char *s); char *gstrans(const char *s);
#endif #endif
...@@ -113,7 +127,7 @@ char *gstrans(const char *s); ...@@ -113,7 +127,7 @@ char *gstrans(const char *s);
struct cmd { struct cmd {
char *c_name; char *c_name;
int c_parameter; /* NEXTARG means next argv */ int c_parameter; /* NEXTARG means next argv */
int (*c_func)(); void (*c_func)();
} cmds[] = { } cmds[] = {
{ "up", IFF_UP, setifflags } , { "up", IFF_UP, setifflags } ,
{ "down", -IFF_UP, setifflags }, { "down", -IFF_UP, setifflags },
...@@ -153,16 +167,19 @@ struct cmd { ...@@ -153,16 +167,19 @@ struct cmd {
* XNS support liberally adapted from code written at the University of * XNS support liberally adapted from code written at the University of
* Maryland principally by James O'Toole and Chris Torek. * Maryland principally by James O'Toole and Chris Torek.
*/ */
int in_status(), in_getaddr(); void in_status();
int xns_status(), xns_getaddr(); int in_getaddr();
int iso_status(), iso_getaddr(); void xns_status();
int ether_status(); int xns_getaddr();
void iso_status();
int iso_getaddr();
void ether_status();
/* Known address families */ /* Known address families */
struct afswtch { struct afswtch {
char *af_name; char *af_name;
short af_af; short af_af;
int (*af_status)(); void (*af_status)();
int (*af_getaddr)(); int (*af_getaddr)();
int af_difaddr; int af_difaddr;
int af_aifaddr; int af_aifaddr;
...@@ -182,9 +199,11 @@ struct afswtch { ...@@ -182,9 +199,11 @@ struct afswtch {
struct afswtch *afp; /*the address family being set or asked about*/ 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 #ifdef __riscos
static void static void
sock_close() sock_close(void)
{ {
if (s >= 0) if (s >= 0)
socketclose(s); socketclose(s);
...@@ -193,7 +212,7 @@ sock_close() ...@@ -193,7 +212,7 @@ sock_close()
#endif #endif
static void static void
printhelp() printhelp(void)
{ {
printf("Usage: ifconfig [-ea] <interface> [address [dest_addr]] [parameters]\n"); printf("Usage: ifconfig [-ea] <interface> [address [dest_addr]] [parameters]\n");
printf(" configures network interface parameters\n"); printf(" configures network interface parameters\n");
...@@ -213,9 +232,7 @@ printhelp() ...@@ -213,9 +232,7 @@ printhelp()
} }
main(argc, argv) int main(int argc, char *argv[])
int argc;
char *argv[];
{ {
int af = AF_INET; int af = AF_INET;
register struct afswtch *rafp; register struct afswtch *rafp;
...@@ -298,12 +315,8 @@ main(argc, argv) ...@@ -298,12 +315,8 @@ main(argc, argv)
ifconfig(argc,argv,af,rafp,flag) int ifconfig(int argc, char *argv[], int af, struct afswtch *rafp,
int argc; int flag)
char *argv[];
int af;
struct afswtch *rafp;
int flag;
{ {
if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) { if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) {
Perror("ioctl (SIOCGIFFLAGS)"); Perror("ioctl (SIOCGIFFLAGS)");
...@@ -393,9 +406,7 @@ ifconfig(argc,argv,af,rafp,flag) ...@@ -393,9 +406,7 @@ ifconfig(argc,argv,af,rafp,flag)
#define DSTADDR 3 #define DSTADDR 3
/*ARGSUSED*/ /*ARGSUSED*/
setifaddr(addr, param) void setifaddr(char *addr, short param)
char *addr;
short param;
{ {
/* /*
* Delay the ioctl to set the interface addr until flags are all set. * Delay the ioctl to set the interface addr until flags are all set.
...@@ -408,8 +419,7 @@ setifaddr(addr, param) ...@@ -408,8 +419,7 @@ setifaddr(addr, param)
(*afp->af_getaddr)(addr, (doalias >= 0 ? ADDR : RIDADDR)); (*afp->af_getaddr)(addr, (doalias >= 0 ? ADDR : RIDADDR));
} }
setifnetmask(addr) void setifnetmask(char *addr)
char *addr;
{ {
/* /*
* 950504 KWelton * 950504 KWelton
...@@ -431,14 +441,12 @@ setifnetmask(addr) ...@@ -431,14 +441,12 @@ setifnetmask(addr)
(*afp->af_getaddr)(addr, MASK); (*afp->af_getaddr)(addr, MASK);
} }
setifbroadaddr(addr) void setifbroadaddr(char *addr)
char *addr;
{ {
(*afp->af_getaddr)(addr, DSTADDR); (*afp->af_getaddr)(addr, DSTADDR);
} }
setifipdst(addr) void setifipdst(char *addr)
char *addr;
{ {
in_getaddr(addr, DSTADDR); in_getaddr(addr, DSTADDR);
setipdst++; setipdst++;
...@@ -447,8 +455,7 @@ setifipdst(addr) ...@@ -447,8 +455,7 @@ setifipdst(addr)
} }
#define rqtosa(x) (&(((struct ifreq *)(afp->x))->ifr_addr)) #define rqtosa(x) (&(((struct ifreq *)(afp->x))->ifr_addr))
/*ARGSUSED*/ /*ARGSUSED*/
notealias(addr, param) void notealias(char *addr, int param)
char *addr;
{ {
if (setaddr && doalias == 0 && param < 0) if (setaddr && doalias == 0 && param < 0)
bcopy((caddr_t)rqtosa(af_addreq), bcopy((caddr_t)rqtosa(af_addreq),
...@@ -463,16 +470,12 @@ notealias(addr, param) ...@@ -463,16 +470,12 @@ notealias(addr, param)
} }
/*ARGSUSED*/ /*ARGSUSED*/
setifdstaddr(addr, param) void setifdstaddr(char *addr, int param)
char *addr;
int param;
{ {
(*afp->af_getaddr)(addr, DSTADDR); (*afp->af_getaddr)(addr, DSTADDR);
} }
setifflags(vname, value) void setifflags(char *vname, short value)
char *vname;
short value;
{ {
if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) { if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) {
Perror("ioctl (SIOCGIFFLAGS)"); Perror("ioctl (SIOCGIFFLAGS)");
...@@ -491,8 +494,7 @@ setifflags(vname, value) ...@@ -491,8 +494,7 @@ setifflags(vname, value)
Perror(vname); Perror(vname);
} }
setifmetric(val) void setifmetric(char *val)
char *val;
{ {
strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name)); strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
ifr.ifr_metric = atoi(val); ifr.ifr_metric = atoi(val);
...@@ -500,8 +502,7 @@ setifmetric(val) ...@@ -500,8 +502,7 @@ setifmetric(val)
Perror("ioctl (set metric)"); Perror("ioctl (set metric)");
} }
setifmtu(val) void setifmtu(char *val)
char *val;
{ {
strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name)); strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
ifr.ifr_mtu = atoi(val); ifr.ifr_mtu = atoi(val);
...@@ -509,8 +510,7 @@ setifmtu(val) ...@@ -509,8 +510,7 @@ setifmtu(val)
Perror("ioctl (set mtu)"); Perror("ioctl (set mtu)");
} }
setsnpaoffset(val) void setsnpaoffset(char *val)
char *val;
{ {
iso_addreq.ifra_snpaoffset = atoi(val); iso_addreq.ifra_snpaoffset = atoi(val);
} }
...@@ -524,7 +524,7 @@ setsnpaoffset(val) ...@@ -524,7 +524,7 @@ setsnpaoffset(val)
* Print the status of the interface. If an address family was * Print the status of the interface. If an address family was
* specified, show it and it only; otherwise, show them all. * specified, show it and it only; otherwise, show them all.
*/ */
status() void status(void)
{ {
register struct afswtch *p = afp; register struct afswtch *p = afp;
short af = ifr.ifr_addr.sa_family; short af = ifr.ifr_addr.sa_family;
...@@ -544,8 +544,7 @@ status() ...@@ -544,8 +544,7 @@ status()
} }
} }
in_status(force) void in_status(int force)
int force;
{ {
struct sockaddr_in *sin; struct sockaddr_in *sin;
char *inet_ntoa(); char *inet_ntoa();
...@@ -597,8 +596,7 @@ in_status(force) ...@@ -597,8 +596,7 @@ in_status(force)
} }
xns_status(force) void xns_status(int force)
int force;
{ {
struct sockaddr_ns *sns; struct sockaddr_ns *sns;
...@@ -634,8 +632,7 @@ xns_status(force) ...@@ -634,8 +632,7 @@ xns_status(force)
putchar('\n'); putchar('\n');
} }
iso_status(force) void iso_status(int force)
int force;
{ {
struct sockaddr_iso *siso; struct sockaddr_iso *siso;
struct iso_ifreq ifr;