diff options
author | Mats O Jansson <maja@cvs.openbsd.org> | 2006-04-20 08:52:53 +0000 |
---|---|---|
committer | Mats O Jansson <maja@cvs.openbsd.org> | 2006-04-20 08:52:53 +0000 |
commit | d1031c77c409b1d95764b5579f80b83b0e6c3b44 (patch) | |
tree | b535e68ab39477b888cd9e9c94fd7371df58b5ed /usr.sbin/mopd/common | |
parent | b99c2cd280dfc61157e546b5ea73363b379e4d57 (diff) |
More delint. -moj
Diffstat (limited to 'usr.sbin/mopd/common')
-rw-r--r-- | usr.sbin/mopd/common/file.c | 31 | ||||
-rw-r--r-- | usr.sbin/mopd/common/pf.c | 23 | ||||
-rw-r--r-- | usr.sbin/mopd/common/print.c | 95 |
3 files changed, 74 insertions, 75 deletions
diff --git a/usr.sbin/mopd/common/file.c b/usr.sbin/mopd/common/file.c index 7bef16a604d..6fd8336a895 100644 --- a/usr.sbin/mopd/common/file.c +++ b/usr.sbin/mopd/common/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.9 2006/04/17 16:23:01 deraadt Exp $ */ +/* $OpenBSD: file.c,v 1.10 2006/04/20 08:52:52 maja Exp $ */ /* * Copyright (c) 1995-96 Mats O Jansson. All rights reserved. @@ -26,7 +26,7 @@ #ifndef lint static const char rcsid[] = - "$OpenBSD: file.c,v 1.9 2006/04/17 16:23:01 deraadt Exp $"; + "$OpenBSD: file.c,v 1.10 2006/04/20 08:52:52 maja Exp $"; #endif #include "os.h" @@ -55,62 +55,62 @@ static const char rcsid[] = #endif void -mopFilePutLX(u_char *buf, int index, u_long value, int cnt) +mopFilePutLX(u_char *buf, int idx, u_long value, int cnt) { int i; for (i = 0; i < cnt; i++) { - buf[index + i] = value % 256; + buf[idx+i] = value % 256; value = value / 256; } } void -mopFilePutBX(u_char *buf, int index, u_long value, int cnt) +mopFilePutBX(u_char *buf, int idx, u_long value, int cnt) { int i; for (i = 0; i < cnt; i++) { - buf[index + cnt - 1 - i] = value % 256; + buf[idx+cnt-1-i] = value % 256; value = value / 256; } } u_long -mopFileGetLX(void *buffer, int index, int cnt) +mopFileGetLX(void *buffer, int idx, int cnt) { u_long ret = 0; int i; u_char *buf = (u_char *)buffer; for (i = 0; i < cnt; i++) - ret = ret*256 + buf[index+cnt - 1 - i]; + ret = ret*256 + buf[idx+cnt-1-i]; return (ret); } u_long -mopFileGetBX(void *buffer, int index, int cnt) +mopFileGetBX(void *buffer, int idx, int cnt) { u_long ret = 0; int i; u_char *buf = (u_char *)buffer; for (i = 0; i < cnt; i++) - ret = ret*256 + buf[index + i]; + ret = ret*256 + buf[idx+i]; return (ret); } void -mopFileSwapX(void *buffer, int index, int cnt) +mopFileSwapX(void *buffer, int idx, int cnt) { int i; u_char c; u_char *buf = (u_char *)buffer; for (i = 0; i < (cnt / 2); i++) { - c = buf[index + i]; - buf[index + i] = buf[index + cnt - 1 - i]; - buf[index + cnt - 1 - i] = c; + c = buf[idx+i]; + buf[idx+i] = buf[idx+cnt-1-i]; + buf[idx+cnt-1-i] = c; } } @@ -197,19 +197,16 @@ GetMopFileInfo(int fd, u_long *load, u_long *xfr) printf("BASIC-Plus Image, not supported\n"); #endif return (-1); - break; case IHD_C_ALIAS: /* Alias */ #ifdef INFO printf("Alias, not supported\n"); #endif return (-1); - break; case IHD_C_CLI: /* Image is CLI */ #ifdef INFO printf("CLI, not supported\n"); #endif return (-1); - break; case IHD_C_PMAX: /* PMAX system image */ isd = header[IHD_W_SIZE+1] * 256 + header[IHD_W_SIZE]; iha = header[IHD_W_ACTIVOFF+1] * 256 + diff --git a/usr.sbin/mopd/common/pf.c b/usr.sbin/mopd/common/pf.c index 4cf27a9ac57..7a1be9ca41a 100644 --- a/usr.sbin/mopd/common/pf.c +++ b/usr.sbin/mopd/common/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.13 2006/04/17 16:23:01 deraadt Exp $ */ +/* $OpenBSD: pf.c,v 1.14 2006/04/20 08:52:52 maja Exp $ */ /* * Copyright (c) 1993-95 Mats O Jansson. All rights reserved. @@ -30,7 +30,7 @@ #ifndef lint static const char rcsid[] = - "$OpenBSD: pf.c,v 1.13 2006/04/17 16:23:01 deraadt Exp $"; + "$OpenBSD: pf.c,v 1.14 2006/04/20 08:52:52 maja Exp $"; #endif #include <stdio.h> @@ -69,7 +69,7 @@ extern int promisc; * In this case the driver can handle both Ethernet type II and * IEEE 802.3 frames (SNAP) in a single pfOpen. */ - +/* ARGSUSED */ int pfTrans(char *interface) { @@ -79,6 +79,7 @@ pfTrans(char *interface) /* * Open and initialize packet filter. */ +/* ARGSUSED */ int pfInit(char *interface, int mode, u_short protocol, int typ) { @@ -122,13 +123,13 @@ pfInit(char *interface, int mode, u_short protocol, int typ) return (-1); } strncpy(ifr.ifr_name, interface, sizeof ifr.ifr_name); - if (ioctl(fd, BIOCSETIF, (caddr_t) & ifr) < 0) { + if (ioctl(fd, BIOCSETIF, &ifr) < 0) { syslog(LOG_ERR,"pfInit: BIOCSETIF: %m"); return (-1); } /* Check that the data link layer is an Ethernet; this code won't work * with anything else. */ - if (ioctl(fd, BIOCGDLT, (caddr_t)&dlt) < 0) { + if (ioctl(fd, BIOCGDLT, &dlt) < 0) { syslog(LOG_ERR,"pfInit: BIOCGDLT: %m"); return (-1); } @@ -138,7 +139,7 @@ pfInit(char *interface, int mode, u_short protocol, int typ) } if (promisc) /* Set promiscuous mode. */ - if (ioctl(fd, BIOCPROMISC, (caddr_t)0) < 0) { + if (ioctl(fd, BIOCPROMISC, 0) < 0) { syslog(LOG_ERR,"pfInit: BIOCPROMISC: %m"); return (-1); } @@ -147,13 +148,13 @@ pfInit(char *interface, int mode, u_short protocol, int typ) insns[1].k = protocol; insns[3].k = protocol; - if (ioctl(fd, BIOCSETF, (caddr_t) & filter) < 0) { + if (ioctl(fd, BIOCSETF, &filter) < 0) { syslog(LOG_ERR,"pfInit: BIOCSETF: %m"); return (-1); } /* XXX set the same write filter (for protocol only) */ - if (ioctl(fd, BIOCSETWF, (caddr_t) & filter) < 0) { + if (ioctl(fd, BIOCSETWF, &filter) < 0) { syslog(LOG_ERR,"pfInit: BIOCSETWF: %m"); return (-1); } @@ -170,6 +171,7 @@ pfInit(char *interface, int mode, u_short protocol, int typ) /* * Add a Multicast address to the interface */ +/* ARGSUSED */ int pfAddMulti(int s, char *interface, char *addr) { @@ -189,7 +191,7 @@ pfAddMulti(int s, char *interface, char *addr) syslog(LOG_ERR, "pfAddMulti: socket: %m"); return (-1); } - if (ioctl(fd, SIOCADDMULTI, (caddr_t)&ifr) < 0) { + if (ioctl(fd, SIOCADDMULTI, &ifr) < 0) { syslog(LOG_ERR, "pfAddMulti: SIOCADDMULTI: %m"); close(fd); return (-1); @@ -202,6 +204,7 @@ pfAddMulti(int s, char *interface, char *addr) /* * Delete a Multicast address from the interface */ +/* ARGSUSED */ int pfDelMulti(int s, char *interface, char *addr) { @@ -222,7 +225,7 @@ pfDelMulti(int s, char *interface, char *addr) syslog(LOG_ERR, "pfDelMulti: socket: %m"); return (-1); } - if (ioctl(fd, SIOCDELMULTI, (caddr_t)&ifr) < 0) { + if (ioctl(fd, SIOCDELMULTI, &ifr) < 0) { syslog(LOG_ERR, "pfAddMulti: SIOCDELMULTI: %m"); close(fd); return (-1); diff --git a/usr.sbin/mopd/common/print.c b/usr.sbin/mopd/common/print.c index be8d8a1518b..f6d0cf13dcd 100644 --- a/usr.sbin/mopd/common/print.c +++ b/usr.sbin/mopd/common/print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print.c,v 1.10 2006/04/17 16:23:01 deraadt Exp $ */ +/* $OpenBSD: print.c,v 1.11 2006/04/20 08:52:52 maja Exp $ */ /* * Copyright (c) 1993-96 Mats O Jansson. All rights reserved. @@ -26,7 +26,7 @@ #ifndef lint static const char rcsid[] = - "$OpenBSD: print.c,v 1.10 2006/04/17 16:23:01 deraadt Exp $"; + "$OpenBSD: print.c,v 1.11 2006/04/20 08:52:52 maja Exp $"; #endif #include <sys/types.h> @@ -95,14 +95,14 @@ mopPrintPGTY(FILE *fd, u_char pgty) void mopPrintOneline(FILE *fd, u_char *pkt, int trans) { - int index = 0; + int idx = 0; u_char *dst, *src, code; u_short proto; int len; trans = mopGetTrans(pkt, trans); - mopGetHeader(pkt, &index, &dst, &src, &proto, &len, trans); - code = mopGetChar(pkt, &index); + mopGetHeader(pkt, &idx, &dst, &src, &proto, &len, trans); + code = mopGetChar(pkt, &idx); switch (proto) { case MOP_K_PROTO_DL: @@ -242,10 +242,10 @@ mopPrintHeader(FILE *fd, u_char *pkt, int trans) { u_char *dst, *src; u_short proto; - int len, index = 0; + int len, idx = 0; trans = mopGetTrans(pkt, trans); - mopGetHeader(pkt, &index, &dst, &src, &proto, &len, trans); + mopGetHeader(pkt, &idx, &dst, &src, &proto, &len, trans); fprintf(fd, "\nDst : "); mopPrintHWA(fd, dst); @@ -301,13 +301,13 @@ mopPrintMopHeader(FILE *fd, u_char *pkt, int trans) { u_char *dst, *src; u_short proto; - int len, index = 0; + int len, idx = 0; u_char code; trans = mopGetTrans(pkt, trans); - mopGetHeader(pkt, &index, &dst, &src, &proto, &len, trans); + mopGetHeader(pkt, &idx, &dst, &src, &proto, &len, trans); - code = mopGetChar(pkt, &index); + code = mopGetChar(pkt, &idx); fprintf(fd, "Code : %02x ", code); @@ -422,7 +422,7 @@ mopPrintTime(FILE *fd, u_char *ap) } void -mopPrintInfo(FILE *fd, u_char *pkt, int *index, u_short moplen, u_char mopcode, +mopPrintInfo(FILE *fd, u_char *pkt, int *idx, u_short moplen, u_char mopcode, int trans) { u_short itype, tmps; @@ -441,23 +441,23 @@ mopPrintInfo(FILE *fd, u_char *pkt, int *index, u_short moplen, u_char mopcode, break; } - itype = mopGetShort(pkt, index); + itype = mopGetShort(pkt, idx); - while (*index < (moplen + 2)) { - ilen = mopGetChar(pkt, index); + while (*idx < (moplen + 2)) { + ilen = mopGetChar(pkt, idx); switch (itype) { case 0: - tmpc = mopGetChar(pkt, index); - *index = *index + tmpc; + tmpc = mopGetChar(pkt, idx); + *idx = *idx + tmpc; break; case MOP_K_INFO_VER: - uc1 = mopGetChar(pkt, index); - uc2 = mopGetChar(pkt, index); - uc3 = mopGetChar(pkt, index); + uc1 = mopGetChar(pkt, idx); + uc2 = mopGetChar(pkt, idx); + uc3 = mopGetChar(pkt, idx); fprintf(fd, "Maint Version: %d.%d.%d\n", uc1, uc2, uc3); break; case MOP_K_INFO_MFCT: - tmps = mopGetShort(pkt, index); + tmps = mopGetShort(pkt, idx); fprintf(fd, "Maint Funcion: %04x ( ", tmps); if (tmps & 1) fprintf(fd, "Loop "); if (tmps & 2) fprintf(fd, "Dump "); @@ -470,46 +470,46 @@ mopPrintInfo(FILE *fd, u_char *pkt, int *index, u_short moplen, u_char mopcode, fprintf(fd, ")\n"); break; case MOP_K_INFO_CNU: - ucp = pkt + *index; - *index = *index + 6; + ucp = pkt + *idx; + *idx = *idx + 6; fprintf(fd, "Console User : "); mopPrintHWA(fd, ucp); fprintf(fd, "\n"); break; case MOP_K_INFO_RTM: - tmps = mopGetShort(pkt, index); + tmps = mopGetShort(pkt, idx); fprintf(fd, "Reserv Timer : %04x (%d)\n", tmps, tmps); break; case MOP_K_INFO_CSZ: - tmps = mopGetShort(pkt, index); + tmps = mopGetShort(pkt, idx); fprintf(fd, "Cons Cmd Size: %04x (%d)\n", tmps, tmps); break; case MOP_K_INFO_RSZ: - tmps = mopGetShort(pkt, index); + tmps = mopGetShort(pkt, idx); fprintf(fd, "Cons Res Size: %04x (%d)\n", tmps, tmps); break; case MOP_K_INFO_HWA: - ucp = pkt + *index; - *index = *index + 6; + ucp = pkt + *idx; + *idx = *idx + 6; fprintf(fd, "Hardware Addr: "); mopPrintHWA(fd, ucp); fprintf(fd, "\n"); break; case MOP_K_INFO_TIME: - ucp = pkt + *index; - *index = *index + 10; + ucp = pkt + *idx; + *idx = *idx + 10; fprintf(fd, "System Time: "); mopPrintTime(fd, ucp); fprintf(fd, "\n"); break; case MOP_K_INFO_SOFD: - device = mopGetChar(pkt, index); + device = mopGetChar(pkt, idx); fprintf(fd, "Comm Device : %02x ", device); mopPrintDevice(fd, device); fprintf(fd, "\n"); break; case MOP_K_INFO_SFID: - tmpc = mopGetChar(pkt, index); + tmpc = mopGetChar(pkt, idx); fprintf(fd, "Software ID : %02x ", tmpc); if ((tmpc == 0)) fprintf(fd, "No software id"); @@ -525,13 +525,13 @@ mopPrintInfo(FILE *fd, u_char *pkt, int *index, u_short moplen, u_char mopcode, fprintf(fd, "'"); for (i = 0; i < ((int) tmpc); i++) fprintf(fd, "%c", - mopGetChar(pkt, index)); + mopGetChar(pkt, idx)); fprintf(fd, "'"); } fprintf(fd, "\n"); break; case MOP_K_INFO_PRTY: - tmpc = mopGetChar(pkt, index); + tmpc = mopGetChar(pkt, idx); fprintf(fd, "System Proc : %02x ", tmpc); switch (tmpc) { case MOP_K_PRTY_11: @@ -558,7 +558,7 @@ mopPrintInfo(FILE *fd, u_char *pkt, int *index, u_short moplen, u_char mopcode, }; break; case MOP_K_INFO_DLTY: - tmpc = mopGetChar(pkt, index); + tmpc = mopGetChar(pkt, idx); fprintf(fd, "DLnk Type : %02x ", tmpc); switch (tmpc) { case MOP_K_DLTY_NI: @@ -576,7 +576,7 @@ mopPrintInfo(FILE *fd, u_char *pkt, int *index, u_short moplen, u_char mopcode, }; break; case MOP_K_INFO_DLBSZ: - tmps = mopGetShort(pkt, index); + tmps = mopGetShort(pkt, idx); fprintf(fd, "DLnk Buf Size: %04x (%d)\n", tmps, tmps); break; default: @@ -588,8 +588,8 @@ mopPrintInfo(FILE *fd, u_char *pkt, int *index, u_short moplen, u_char mopcode, { switch (itype) { case 102: - ucp = pkt + *index; - *index = *index + ilen; + ucp = pkt + *idx; + *idx = *idx + ilen; fprintf(fd, "ROM SW Ver : %02x '", ilen); for (i = 0; i < ilen; i++) @@ -597,8 +597,8 @@ mopPrintInfo(FILE *fd, u_char *pkt, int *index, u_short moplen, u_char mopcode, fprintf(fd, "'\n"); break; case 103: - ucp = pkt + *index; - *index = *index + ilen; + ucp = pkt + *idx; + *idx = *idx + ilen; fprintf(fd, "Loaded SW Ver: %02x '", ilen); for (i = 0; i < ilen; i++) @@ -606,14 +606,14 @@ mopPrintInfo(FILE *fd, u_char *pkt, int *index, u_short moplen, u_char mopcode, fprintf(fd, "'\n"); break; case 104: - tmps = mopGetShort(pkt, index); + tmps = mopGetShort(pkt, idx); fprintf(fd, "DECnet Addr : %d.%d (%d)\n", tmps / 1024, tmps % 1024, tmps); break; case 105: - ucp = pkt + *index; - *index = *index + ilen; + ucp = pkt + *idx; + *idx = *idx + ilen; fprintf(fd, "Node Name : %02x '", ilen); for (i = 0; i < ilen; i++) @@ -621,8 +621,8 @@ mopPrintInfo(FILE *fd, u_char *pkt, int *index, u_short moplen, u_char mopcode, fprintf(fd, "'\n"); break; case 106: - ucp = pkt + *index; - *index = *index + ilen; + ucp = pkt + *idx; + *idx = *idx + ilen; fprintf(fd, "Node Ident : %02x '", ilen); for (i = 0; i < ilen; i++) @@ -631,8 +631,8 @@ mopPrintInfo(FILE *fd, u_char *pkt, int *index, u_short moplen, u_char mopcode, break; } } else { - ucp = pkt + *index; - *index = *index + ilen; + ucp = pkt + *idx; + *idx = *idx + ilen; fprintf(fd, "Info Type : %04x (%d)\n", itype, itype); fprintf(fd, "Info Data : %02x ", ilen); @@ -646,7 +646,6 @@ mopPrintInfo(FILE *fd, u_char *pkt, int *index, u_short moplen, u_char mopcode, fprintf(fd, "\n"); } } - itype = mopGetShort(pkt, index); + itype = mopGetShort(pkt, idx); } } - |