From 770ac800567bebb75689d0b04d55798efadbf6c0 Mon Sep 17 00:00:00 2001 From: lukem Date: Thu, 16 Oct 1997 23:24:18 +0000 Subject: [PATCH] - WARNsify - KNFify (a bit) - use int32_t & u_int32_t instead of long and u_long - clean up man pages a bit --- Makefile.inc | 5 +- common/cmp.c | 12 +++-- common/cmp.h | 10 ++-- common/common.h | 50 ++++++++++---------- common/device.c | 30 +++++------- common/device.h | 21 ++++----- common/dl.c | 30 ++++++------ common/dl.h | 8 +--- common/file.c | 116 ++++++++++++++++++---------------------------- common/file.h | 49 +++++++------------- common/get.c | 32 +++++++------ common/get.h | 33 +++++-------- common/loop-bsd.c | 14 +++--- common/mopdef.c | 11 +++-- common/nma.c | 13 +++--- 15 files changed, 192 insertions(+), 242 deletions(-) diff --git a/Makefile.inc b/Makefile.inc index 8419e51..fcf9126 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -1,9 +1,10 @@ -# $NetBSD: Makefile.inc,v 1.4 1997/10/16 07:36:19 lukem Exp $ +# $NetBSD: Makefile.inc,v 1.5 1997/10/16 23:24:18 lukem Exp $ LIBCOMMON != cd ${.CURDIR}/../common;\ printf "xxx: .MAKE\n\t@echo \$${.OBJDIR}\n" | ${MAKE} -s -f- -CFLAGS+=-I${.CURDIR}/../common -I${.CURDIR}/.. +CFLAGS+=-I${.CURDIR}/../common DPADD+= ${LIBKVM} ${LIBCOMMON}/libcommon.a LDADD+= -lkvm -L${LIBCOMMON} -lcommon BINDIR?= /usr/sbin +WARNS?= 1 diff --git a/common/cmp.c b/common/cmp.c index 20f9b03..9189465 100644 --- a/common/cmp.c +++ b/common/cmp.c @@ -1,4 +1,4 @@ -/* $NetBSD: cmp.c,v 1.2 1997/03/25 03:07:02 thorpej Exp $ */ +/* $NetBSD: cmp.c,v 1.3 1997/10/16 23:24:21 lukem Exp $ */ /* * Copyright (c) 1993-95 Mats O Jansson. All rights reserved. @@ -29,15 +29,17 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef LINT -static char rcsid[] = "$NetBSD: cmp.c,v 1.2 1997/03/25 03:07:02 thorpej Exp $"; +#include +#ifndef lint +__RCSID("$NetBSD: cmp.c,v 1.3 1997/10/16 23:24:21 lukem Exp $"); #endif #include "os.h" +#include "cmp.h" int mopCmpEAddr(addr1, addr2) - register u_char *addr1, *addr2; + u_char *addr1, *addr2; { - return(bcmp((char *)addr1, (char *)addr2, 6)); + return(memcmp((char *)addr1, (char *)addr2, 6)); } diff --git a/common/cmp.h b/common/cmp.h index bebcd2a..18a24ea 100644 --- a/common/cmp.h +++ b/common/cmp.h @@ -1,4 +1,4 @@ -/* $NetBSD: cmp.h,v 1.2 1997/03/25 03:07:04 thorpej Exp $ */ +/* $NetBSD: cmp.h,v 1.3 1997/10/16 23:24:24 lukem Exp $ */ /* * Copyright (c) 1993-95 Mats O Jansson. All rights reserved. @@ -28,19 +28,15 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $NetBSD: cmp.h,v 1.2 1997/03/25 03:07:04 thorpej Exp $ + * $NetBSD: cmp.h,v 1.3 1997/10/16 23:24:24 lukem Exp $ * */ #ifndef _CMP_H_ #define _CMP_H_ -#ifdef NO__P -int mopCmpEAddr (/* u_char *,u_char * */); -#else __BEGIN_DECLS -int mopCmpEAddr __P((u_char *,u_char *)); +int mopCmpEAddr __P((u_char *, u_char *)); __END_DECLS -#endif #endif _CMP_H_ diff --git a/common/common.h b/common/common.h index 4ad52d8..aa32388 100644 --- a/common/common.h +++ b/common/common.h @@ -1,4 +1,4 @@ -/* $NetBSD: common.h,v 1.2 1997/03/25 03:07:05 thorpej Exp $ */ +/* $NetBSD: common.h,v 1.3 1997/10/16 23:24:26 lukem Exp $ */ /* * Copyright (c) 1993-95 Mats O Jansson. All rights reserved. @@ -28,7 +28,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $NetBSD: common.h,v 1.2 1997/03/25 03:07:05 thorpej Exp $ + * $NetBSD: common.h,v 1.3 1997/10/16 23:24:26 lukem Exp $ * */ @@ -58,9 +58,11 @@ struct if_info { int trans; /* Transport type Ethernet/802.3 */ u_char eaddr[6]; /* Ethernet addr of this interface */ char if_name[IFNAME_SIZE]; /* Interface Name */ - int (*iopen)(); /* Interface Open Routine */ - int (*write)(); /* Interface Write Routine */ - void (*read)(); /* Interface Read Routine */ + int (*iopen) __P((char *, int, u_short, int)); + /* Interface Open Routine */ + int (*write) __P((int, u_char *, int, int));; + /* Interface Write Routine */ + void (*read) __P((void)); /* Interface Read Routine */ struct if_info *next; /* Next Interface */ }; @@ -70,25 +72,25 @@ struct if_info { #define DL_STATUS_SENT_PLT 3 struct dllist { - u_char status; /* Status byte */ + u_char status; /* Status byte */ struct if_info *ii; /* interface pointer */ - u_char eaddr[6]; /* targets ethernet addres */ - int ldfd; /* filedescriptor for loadfile */ - u_short dl_bsz; /* Data Link Buffer Size */ - int timeout; /* Timeout counter */ - u_char count; /* Packet Counter */ - u_long loadaddr; /* Load Address */ - u_long xferaddr; /* Transfer Address */ - u_long nloadaddr; /* Next Load Address */ - long lseek; /* Seek before last read */ - int aout; /* Is it an a.out file */ - u_long a_text; /* Size of text segment */ - u_long a_text_fill; /* Size of text segment fill */ - u_long a_data; /* Size of data segment */ - u_long a_data_fill; /* Size of data segment fill */ - u_long a_bss; /* Size of bss segment */ - u_long a_bss_fill; /* Size of bss segment fill */ - long a_lseek; /* Keep track of pos in newfile */ + u_char eaddr[6]; /* targets ethernet addres */ + int ldfd; /* filedescriptor for loadfile */ + u_short dl_bsz; /* Data Link Buffer Size */ + int timeout; /* Timeout counter */ + u_char count; /* Packet Counter */ + u_int32_t loadaddr; /* Load Address */ + u_int32_t xferaddr; /* Transfer Address */ + u_int32_t nloadaddr; /* Next Load Address */ + off_t lseek; /* Seek before last read */ + int aout; /* Is it an a.out file */ + u_int32_t a_text; /* Size of text segment */ + u_int32_t a_text_fill; /* Size of text segment fill */ + u_int32_t a_data; /* Size of data segment */ + u_int32_t a_data_fill; /* Size of data segment fill */ + u_int32_t a_bss; /* Size of bss segment */ + u_int32_t a_bss_fill; /* Size of bss segment fill */ + off_t a_lseek; /* Keep track of pos in newfile */ }; -#endif _COMMON_H_ +#endif /* _COMMON_H_ */ diff --git a/common/device.c b/common/device.c index 6db4994..0f72ce6 100644 --- a/common/device.c +++ b/common/device.c @@ -1,4 +1,4 @@ -/* $NetBSD: device.c,v 1.2 1997/03/25 03:07:06 thorpej Exp $ */ +/* $NetBSD: device.c,v 1.3 1997/10/16 23:24:28 lukem Exp $ */ /* * Copyright (c) 1993-95 Mats O Jansson. All rights reserved. @@ -29,28 +29,20 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef LINT -static char rcsid[] = "$NetBSD: device.c,v 1.2 1997/03/25 03:07:06 thorpej Exp $"; +#include +#ifndef lint +__RCSID("$NetBSD: device.c,v 1.3 1997/10/16 23:24:28 lukem Exp $"); #endif #include "os.h" -#include "common/common.h" -#include "common/mopdef.h" +#include "common.h" +#include "device.h" +#include "mopdef.h" +#include "pf.h" struct if_info *iflist; /* Interface List */ -void mopReadDL(); -void mopReadRC(); -#ifdef NO__P -int mopOpenDL(/* struct if_info *, int */); -int mopOpenRC(/* struct if_info *, int */); -#else -int mopOpenDL(struct if_info *, int); -int mopOpenRC(struct if_info *, int); -#endif -int pfTrans(); -int pfInit(); -int pfWrite(); +void deviceOpen __P((char *, u_short, int)); #ifdef DEV_NEW_CONF /* @@ -95,7 +87,7 @@ deviceEthAddr(ifname, eaddr) sdl->sdl_alen != 6) continue; if (!strncmp(ifr->ifr_name, ifname, sizeof(ifr->ifr_name))) { - bcopy((caddr_t)LLADDR(sdl), (caddr_t)eaddr, 6); + memmove((caddr_t)eaddr, (caddr_t)LLADDR(sdl), 6); return; } } @@ -144,7 +136,7 @@ deviceOpen(ifname, proto, trans) p->iopen = tmp.iopen; p->write = pfWrite; p->read = tmp.read; - bzero((char *)p->eaddr,sizeof(p->eaddr)); + memset((char *)p->eaddr, 0, sizeof(p->eaddr)); p->fd = tmp.fd; #ifdef DEV_NEW_CONF diff --git a/common/device.h b/common/device.h index 80dc52a..c6808da 100644 --- a/common/device.h +++ b/common/device.h @@ -1,4 +1,4 @@ -/* $NetBSD: device.h,v 1.2 1997/03/25 03:07:07 thorpej Exp $ */ +/* $NetBSD: device.h,v 1.3 1997/10/16 23:24:29 lukem Exp $ */ /* * Copyright (c) 1993-95 Mats O Jansson. All rights reserved. @@ -28,27 +28,26 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $NetBSD: device.h,v 1.2 1997/03/25 03:07:07 thorpej Exp $ + * $NetBSD: device.h,v 1.3 1997/10/16 23:24:29 lukem Exp $ * */ #ifndef _DEVICE_H_ #define _DEVICE_H_ -#ifdef NO__P -#ifdef DEV_NEW_CONF -void deviceEthAddr (/* char *,u_char * */); -#endif -void deviceInitOne (/* char * */); -void deviceInitAll (/* void */); -#else __BEGIN_DECLS #ifdef DEV_NEW_CONF -void deviceEthAddr __P((char *,u_char *)); +void deviceEthAddr __P((char *, u_char *)); #endif void deviceInitOne __P((char *)); void deviceInitAll __P((void)); + +/* from loop-bsd.c */ +void Loop __P((void)); +int mopOpenDL __P((struct if_info *, int)); +int mopOpenRC __P((struct if_info *, int)); +void mopReadDL __P((void)); +void mopReadRC __P((void)); __END_DECLS -#endif #endif _DEVICE_H_ diff --git a/common/dl.c b/common/dl.c index 4b489cd..fe1a80a 100644 --- a/common/dl.c +++ b/common/dl.c @@ -1,4 +1,4 @@ -/* $NetBSD: dl.c,v 1.2 1997/03/25 03:07:09 thorpej Exp $ */ +/* $NetBSD: dl.c,v 1.3 1997/10/16 23:24:31 lukem Exp $ */ /* * Copyright (c) 1993-95 Mats O Jansson. All rights reserved. @@ -29,14 +29,16 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef LINT -static char rcsid[] = "$NetBSD: dl.c,v 1.2 1997/03/25 03:07:09 thorpej Exp $"; +#include +#ifndef lint +__RCSID("$NetBSD: dl.c,v 1.3 1997/10/16 23:24:31 lukem Exp $"); #endif #include "os.h" -#include "common/get.h" -#include "common/print.h" -#include "common/mopdef.h" +#include "dl.h" +#include "get.h" +#include "mopdef.h" +#include "print.h" void mopDumpDL(fd, pkt, trans) @@ -45,7 +47,7 @@ mopDumpDL(fd, pkt, trans) int trans; { int i,index = 0; - long tmpl; + u_int32_t tmpl; u_char tmpc,c,program[17],code,*ucp; u_short len,tmps,moplen; @@ -70,7 +72,7 @@ mopDumpDL(fd, pkt, trans) if (moplen > 6) { tmpl = mopGetLong(pkt,&index);/* Load Address */ - (void)fprintf(fd,"Load Address : %08x\n",tmpl); + (void)fprintf(fd,"Load Address : %08x\n", tmpl); } if (moplen > 10) { @@ -101,7 +103,7 @@ mopDumpDL(fd, pkt, trans) } tmpl = mopGetLong(pkt,&index); /* Load Address */ - (void)fprintf(fd,"Xfer Address : %08x\n",tmpl); + (void)fprintf(fd,"Xfer Address : %08x\n", tmpl); break; case MOP_K_CODE_DCM: @@ -115,7 +117,7 @@ mopDumpDL(fd, pkt, trans) (void)fprintf(fd,"Load Number : %02x\n",tmpc); tmpl = mopGetLong(pkt,&index); /* Load Address */ - (void)fprintf(fd,"Load Address : %08x\n",tmpl); + (void)fprintf(fd,"Load Address : %08x\n", tmpl); if (moplen > 6) { #ifndef SHORT_PRINT @@ -152,7 +154,7 @@ mopDumpDL(fd, pkt, trans) case MOP_K_CODE_RMD: tmpl = mopGetLong(pkt,&index); /* Memory Address */ - (void)fprintf(fd,"Mem Address : %08x\n",tmpl); + (void)fprintf(fd,"Mem Address : %08x\n", tmpl); tmps = mopGetShort(pkt,&index); /* Count */ (void)fprintf(fd,"Count : %04x (%d)\n",tmps,tmps); @@ -211,7 +213,7 @@ mopDumpDL(fd, pkt, trans) (void)fprintf(fd,"Format : %02x\n",tmpc); tmpl = mopGetLong(pkt,&index); /* Memory Size */ - (void)fprintf(fd,"Memory Size : %08x\n",tmpl); + (void)fprintf(fd,"Memory Size : %08x\n", tmpl); tmpc = mopGetChar(pkt,&index); /* Bits */ (void)fprintf(fd,"Bits : %02x\n",tmpc); @@ -222,7 +224,7 @@ mopDumpDL(fd, pkt, trans) case MOP_K_CODE_MDD: tmpl = mopGetLong(pkt,&index); /* Memory Address */ - (void)fprintf(fd,"Mem Address : %08x\n",tmpl); + (void)fprintf(fd,"Mem Address : %08x\n", tmpl); if (moplen > 5) { #ifndef SHORT_PRINT @@ -306,7 +308,7 @@ mopDumpDL(fd, pkt, trans) } tmpl = mopGetLong(pkt,&index); /* Transfer Address */ - (void)fprintf(fd,"Transfer Addr: %08x\n",tmpl); + (void)fprintf(fd,"Transfer Addr: %08x\n", tmpl); break; default: diff --git a/common/dl.h b/common/dl.h index 7434478..0ce9638 100644 --- a/common/dl.h +++ b/common/dl.h @@ -1,4 +1,4 @@ -/* $NetBSD: dl.h,v 1.2 1997/03/25 03:07:10 thorpej Exp $ */ +/* $NetBSD: dl.h,v 1.3 1997/10/16 23:24:33 lukem Exp $ */ /* * Copyright (c) 1993-95 Mats O Jansson. All rights reserved. @@ -28,19 +28,15 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $NetBSD: dl.h,v 1.2 1997/03/25 03:07:10 thorpej Exp $ + * $NetBSD: dl.h,v 1.3 1997/10/16 23:24:33 lukem Exp $ * */ #ifndef _DL_H_ #define _DL_H_ -#ifdef NO__P -void mopDumpDL (/* FILE *, u_char *, int */); -#else __BEGIN_DECLS void mopDumpDL __P((FILE *, u_char *, int)); __END_DECLS -#endif #endif _DL_H_ diff --git a/common/file.c b/common/file.c index 5105425..5483f96 100644 --- a/common/file.c +++ b/common/file.c @@ -1,4 +1,4 @@ -/* $NetBSD: file.c,v 1.3 1997/10/16 07:36:31 lukem Exp $ */ +/* $NetBSD: file.c,v 1.4 1997/10/16 23:24:35 lukem Exp $ */ /* * Copyright (c) 1995-96 Mats O Jansson. All rights reserved. @@ -29,13 +29,15 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef LINT -static char rcsid[] = "$NetBSD: file.c,v 1.3 1997/10/16 07:36:31 lukem Exp $"; +#include +#ifndef lint +__RCSID("$NetBSD: file.c,v 1.4 1997/10/16 23:24:35 lukem Exp $"); #endif #include "os.h" -#include "common/common.h" -#include "common/mopdef.h" +#include "common.h" +#include "file.h" +#include "mopdef.h" #ifndef NOAOUT #if defined(__NetBSD__) || defined(__OpenBSD__) @@ -52,11 +54,14 @@ static char rcsid[] = "$NetBSD: file.c,v 1.3 1997/10/16 07:36:31 lukem Exp $"; #endif #endif +int getCLBYTES __P((int)); +int getMID __P((int, int)); + void mopFilePutLX(buf, index, value, cnt) - u_char *buf; - int index, cnt; - u_long value; + u_char *buf; + int index, cnt; + u_int32_t value; { int i; for (i = 0; i < cnt; i++) { @@ -67,9 +72,9 @@ mopFilePutLX(buf, index, value, cnt) void mopFilePutBX(buf, index, value, cnt) - u_char *buf; - int index, cnt; - u_long value; + u_char *buf; + int index, cnt; + u_int32_t value; { int i; for (i = 0; i < cnt; i++) { @@ -78,12 +83,12 @@ mopFilePutBX(buf, index, value, cnt) } } -u_long +u_int32_t mopFileGetLX(buf, index, cnt) u_char *buf; int index, cnt; { - u_long ret = 0; + u_int32_t ret = 0; int i; for (i = 0; i < cnt; i++) { @@ -93,12 +98,12 @@ mopFileGetLX(buf, index, cnt) return(ret); } -u_long +u_int32_t mopFileGetBX(buf, index, cnt) u_char *buf; int index, cnt; { - u_long ret = 0; + u_int32_t ret = 0; int i; for (i = 0; i < cnt; i++) { @@ -157,12 +162,12 @@ CheckMopFile(fd) int GetMopFileInfo(fd, load, xfr) - int fd; - u_long *load, *xfr; + int fd; + u_int32_t *load, *xfr; { - u_char header[512]; - short image_type; - u_long load_addr, xfr_addr, isd, iha, hbcnt, isize; + u_char header[512]; + short image_type; + u_int32_t load_addr, xfr_addr, isd, iha, hbcnt, isize; if (read(fd, header, 512) != 512) return(-1); @@ -300,9 +305,6 @@ getMID(old_mid,new_mid) mid = MID_NS32532; break; #endif -/*###323 [cc] for each function it appears in.)%%%*/ -/*###323 [cc] (Each undeclared identifier is reported only once%%%*/ -/*###323 [cc] `MID_SPARC' undeclared (first use this function)%%%*/ case MID_SPARC: mid = MID_SPARC; break; @@ -332,7 +334,6 @@ getMID(old_mid,new_mid) break; #endif default: -/*###352 [cc] syntax error before `}'%%%*/ } return(mid); @@ -387,7 +388,6 @@ getCLBYTES(mid) } #endif -/*###406 [cc] syntax error before `int'%%%*/ int CheckAOutFile(fd) int fd; @@ -398,7 +398,6 @@ CheckAOutFile(fd) struct exec ex, ex_swap; int mid = -1; -/*###416 [cc] `fd' undeclared (first use this function)%%%*/ if (read(fd, (char *)&ex, sizeof(ex)) != sizeof(ex)) return(-1); @@ -423,20 +422,20 @@ CheckAOutFile(fd) #endif NOAOUT } -/*###440 [cc] syntax error before `int'%%%*/ int GetAOutFileInfo(fd, load, xfr, a_text, a_text_fill, a_data, a_data_fill, a_bss, a_bss_fill, aout) - int fd, *aout; - u_long *load, *xfr, *a_text, *a_text_fill; - u_long *a_data, *a_data_fill, *a_bss, *a_bss_fill; + int fd; + u_int32_t *load, *xfr, *a_text, *a_text_fill; + u_int32_t *a_data, *a_data_fill, *a_bss, *a_bss_fill; + int *aout; { #ifdef NOAOUT return(-1); #else struct exec ex, ex_swap; - int mid = -1; - u_long magic, clbytes, clofset; + u_int32_t mid = -1; + u_int32_t magic, clbytes, clofset; if (read(fd, (char *)&ex, sizeof(ex)) != sizeof(ex)) return(-1); @@ -509,7 +508,6 @@ GetAOutFileInfo(fd, load, xfr, a_text, a_text_fill, ex.a_drsize= mopFileGetBX((u_char *)&ex_swap, 28, 4); break; default: -/*###525 [cc] syntax error before `}'%%%*/ } printf("a.out image ("); @@ -577,37 +575,33 @@ GetAOutFileInfo(fd, load, xfr, a_text, a_text_fill, printf("QMAGIC"); break; default: - printf("Unknown %d",N_GETMAGIC (ex)); + printf("Unknown %ld", (long) N_GETMAGIC (ex)); } printf("\n"); - printf("Size of text: %08x\n",ex.a_text); - printf("Size of data: %08x\n",ex.a_data); - printf("Size of bss: %08x\n",ex.a_bss); - printf("Size of symbol tab: %08x\n",ex.a_syms); - printf("Transfer Address: %08x\n",ex.a_entry); - printf("Size of reloc text: %08x\n",ex.a_trsize); - printf("Size of reloc data: %08x\n",ex.a_drsize); + printf("Size of text: %08lx\n", (long)ex.a_text); + printf("Size of data: %08lx\n", (long)ex.a_data); + printf("Size of bss: %08lx\n", (long)ex.a_bss); + printf("Size of symbol tab: %08lx\n", (long)ex.a_syms); + printf("Transfer Address: %08lx\n", (long)ex.a_entry); + printf("Size of reloc text: %08lx\n", (long)ex.a_trsize); + printf("Size of reloc data: %08lx\n", (long)ex.a_drsize); magic = N_GETMAGIC (ex); clbytes = getCLBYTES(mid); clofset = clbytes - 1; -/*###608 [cc] `load' undeclared (first use this function)%%%*/ if (load != NULL) { *load = 0; } -/*###612 [cc] `xfr' undeclared (first use this function)%%%*/ if (xfr != NULL) { *xfr = ex.a_entry; } -/*###616 [cc] `a_text' undeclared (first use this function)%%%*/ if (a_text != NULL) { *a_text = ex.a_text; } -/*###620 [cc] `a_text_fill' undeclared (first use this function)%%%*/ if (a_text_fill != NULL) { if (magic == ZMAGIC || magic == NMAGIC) { *a_text_fill = clbytes - (ex.a_text & clofset); @@ -619,12 +613,10 @@ GetAOutFileInfo(fd, load, xfr, a_text, a_text_fill, } } -/*###631 [cc] `a_data' undeclared (first use this function)%%%*/ if (a_data != NULL) { *a_data = ex.a_data; } -/*###635 [cc] `a_data_fill' undeclared (first use this function)%%%*/ if (a_data_fill != NULL) { if (magic == ZMAGIC || magic == NMAGIC) { *a_data_fill = clbytes - (ex.a_data & clofset); @@ -636,12 +628,10 @@ GetAOutFileInfo(fd, load, xfr, a_text, a_text_fill, } } -/*###646 [cc] `a_bss' undeclared (first use this function)%%%*/ if (a_bss != NULL) { *a_bss = ex.a_bss; } -/*###650 [cc] `a_bss_fill' undeclared (first use this function)%%%*/ if (a_bss_fill != NULL) { if (magic == ZMAGIC || magic == NMAGIC) { *a_bss_fill = clbytes - (ex.a_bss & clofset); @@ -657,7 +647,6 @@ GetAOutFileInfo(fd, load, xfr, a_text, a_text_fill, } } -/*###665 [cc] `aout' undeclared (first use this function)%%%*/ if (aout != NULL) { *aout = mid; } @@ -666,13 +655,12 @@ GetAOutFileInfo(fd, load, xfr, a_text, a_text_fill, #endif NOAOUT } -/*###673 [cc] syntax error before `int'%%%*/ int GetFileInfo(fd, load, xfr, aout, a_text, a_text_fill, a_data, a_data_fill, a_bss, a_bss_fill) int fd, *aout; - u_long *load, *xfr, *a_text, *a_text_fill; - u_long *a_data, *a_data_fill, *a_bss, *a_bss_fill; + u_int32_t *load, *xfr, *a_text, *a_text_fill; + u_int32_t *a_data, *a_data_fill, *a_bss, *a_bss_fill; { int err; @@ -705,18 +693,15 @@ GetFileInfo(fd, load, xfr, aout, } ssize_t -/*###711 [cc] syntax error before `mopFileRead'%%%*/ mopFileRead(dlslot, buf) struct dllist *dlslot; u_char *buf; { ssize_t len, outlen; int bsz; - long pos, notdone, total; + int32_t pos, notdone, total; -/*###719 [cc] `dlslot' undeclared (first use this function)%%%*/ if (dlslot->aout == -1) { -/*###720 [cc] `buf' undeclared (first use this function)%%%*/ len = read(dlslot->ldfd,buf,dlslot->dl_bsz); } else { bsz = dlslot->dl_bsz; @@ -728,10 +713,8 @@ mopFileRead(dlslot, buf) if (pos < total) { notdone = total - pos; if (notdone <= bsz) { -/*###731 [cc] subscripted value is neither array nor pointer%%%*/ outlen = read(dlslot->ldfd,&buf[len],notdone); } else { -/*###733 [cc] subscripted value is neither array nor pointer%%%*/ outlen = read(dlslot->ldfd,&buf[len],bsz); } len = len + outlen; @@ -748,8 +731,7 @@ mopFileRead(dlslot, buf) } else { outlen = bsz; } -/*###749 [cc] subscripted value is neither array nor pointer%%%*/ - bzero(&buf[len],outlen); + memset(&buf[len], 0, outlen); len = len + outlen; pos = pos + outlen; bsz = bsz - outlen; @@ -760,10 +742,8 @@ mopFileRead(dlslot, buf) if ((bsz > 0) && (pos < total)) { notdone = total - pos; if (notdone <= bsz) { -/*###760 [cc] subscripted value is neither array nor pointer%%%*/ outlen = read(dlslot->ldfd,&buf[len],notdone); } else { -/*###762 [cc] subscripted value is neither array nor pointer%%%*/ outlen = read(dlslot->ldfd,&buf[len],bsz); } len = len + outlen; @@ -780,8 +760,7 @@ mopFileRead(dlslot, buf) } else { outlen = bsz; } -/*###778 [cc] subscripted value is neither array nor pointer%%%*/ - bzero(&buf[len],outlen); + memset(&buf[len], 0, outlen); len = len + outlen; pos = pos + outlen; bsz = bsz - outlen; @@ -796,8 +775,7 @@ mopFileRead(dlslot, buf) } else { outlen = bsz; } -/*###793 [cc] subscripted value is neither array nor pointer%%%*/ - bzero(&buf[len],outlen); + memset(&buf[len], 0, outlen); len = len + outlen; pos = pos + outlen; bsz = bsz - outlen; @@ -812,8 +790,7 @@ mopFileRead(dlslot, buf) } else { outlen = bsz; } -/*###808 [cc] subscripted value is neither array nor pointer%%%*/ - bzero(&buf[len],outlen); + memset(&buf[len], 0, outlen); len = len + outlen; pos = pos + outlen; bsz = bsz - outlen; @@ -825,4 +802,3 @@ mopFileRead(dlslot, buf) return(len); } -/*###820 [cc] syntax error at end of input%%%*/ diff --git a/common/file.h b/common/file.h index 2e684be..7a9b1db 100644 --- a/common/file.h +++ b/common/file.h @@ -1,4 +1,4 @@ -/* $NetBSD: file.h,v 1.2 1997/03/25 03:07:13 thorpej Exp $ */ +/* $NetBSD: file.h,v 1.3 1997/10/16 23:24:37 lukem Exp $ */ /* * Copyright (c) 1993-95 Mats O Jansson. All rights reserved. @@ -28,42 +28,29 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $NetBSD: file.h,v 1.2 1997/03/25 03:07:13 thorpej Exp $ + * $NetBSD: file.h,v 1.3 1997/10/16 23:24:37 lukem Exp $ * */ #ifndef _FILE_H_ #define _FILE_H_ -#ifdef NO__P -void mopFilePutLX (/* u_char *, int, u_long, int */); -void mopFilePutBX (/* u_char *, int, u_long, int */); -u_long mopFileGetLX (/* u_char *, int, int */); -u_long mopFileGetBX (/* u_char *, int, int */); -void mopFileSwapX (/* u_char *, int, int */); -int CheckMopFile (/* int */); -int GetMopFileInfo (/* int, u_long *, u_long * */); -int CheckAOutFile (/* int */); -int GetAOutFileInfo(/* int, u_long *, u_long *, u_long *, u_long *, - u_long *, u_long *, u_long *, u_long * */); -int GetFileInfo (/* int, u_long *, u_long *, int *, u_long *, u_long *, - u_long *, u_long *, u_long *, u_long * */); -#else __BEGIN_DECLS -void mopFilePutLX __P((u_char *, int, u_long, int)); -void mopFilePutBX __P((u_char *, int, u_long, int)); -u_long mopFileGetLX __P((u_char *, int, int)); -u_long mopFileGetBX __P((u_char *, int, int)); -void mopFileSwapX __P((u_char *, int, int)); -int CheckMopFile __P((int)); -int GetMopFileInfo __P((int, u_long *, u_long *)); -int CheckAOutFile __P((int)); -int GetAOutFileInfo __P((int, u_long *, u_long *, u_long *, u_long *, - u_long *, u_long *, u_long *, u_long *, int *)); -int GetFileInfo __P((int, u_long *, u_long *, int *, - u_long *, u_long *, u_long *, u_long *, - u_long *, u_long *)); +void mopFilePutLX __P((u_char *, int, u_int32_t, int)); +void mopFilePutBX __P((u_char *, int, u_int32_t, int)); +u_int32_t mopFileGetLX __P((u_char *, int, int)); +u_int32_t mopFileGetBX __P((u_char *, int, int)); +ssize_t mopFileRead __P((struct dllist *, u_char *)); +void mopFileSwapX __P((u_char *, int, int)); +int CheckMopFile __P((int)); +int GetMopFileInfo __P((int, u_int32_t *, u_int32_t *)); +int CheckAOutFile __P((int)); +int GetAOutFileInfo __P((int, u_int32_t *, u_int32_t *, + u_int32_t *, u_int32_t *, u_int32_t *, u_int32_t *, + u_int32_t *, u_int32_t *, int *)); +int GetFileInfo __P((int, u_int32_t *, u_int32_t *, int *, + u_int32_t *, u_int32_t *, u_int32_t *, u_int32_t *, + u_int32_t *, u_int32_t *)); __END_DECLS -#endif -#endif _FILE_H_ +#endif /* _FILE_H_ */ diff --git a/common/get.c b/common/get.c index 2536e44..cee4661 100644 --- a/common/get.c +++ b/common/get.c @@ -1,4 +1,4 @@ -/* $NetBSD: get.c,v 1.2 1997/03/25 03:07:15 thorpej Exp $ */ +/* $NetBSD: get.c,v 1.3 1997/10/16 23:24:38 lukem Exp $ */ /* * Copyright (c) 1993-95 Mats O Jansson. All rights reserved. @@ -29,17 +29,19 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef LINT -static char rcsid[] = "$NetBSD: get.c,v 1.2 1997/03/25 03:07:15 thorpej Exp $"; +#include +#ifndef lint +__RCSID("$NetBSD: get.c,v 1.3 1997/10/16 23:24:38 lukem Exp $"); #endif -#include -#include "common/mopdef.h" +#include "os.h" +#include "get.h" +#include "mopdef.h" u_char mopGetChar(pkt, index) - register u_char *pkt; - register int *index; + u_char *pkt; + int *index; { u_char ret; @@ -50,8 +52,8 @@ mopGetChar(pkt, index) u_short mopGetShort(pkt, index) - register u_char *pkt; - register int *index; + u_char *pkt; + int *index; { u_short ret; @@ -60,12 +62,12 @@ mopGetShort(pkt, index) return(ret); } -u_long +u_int32_t mopGetLong(pkt, index) - register u_char *pkt; - register int *index; + u_char *pkt; + int *index; { - u_long ret; + u_int32_t ret; ret = pkt[*index] + pkt[*index+1]*0x100 + @@ -77,8 +79,8 @@ mopGetLong(pkt, index) void mopGetMulti(pkt, index, dest, size) - register u_char *pkt,*dest; - register int *index,size; + u_char *pkt,*dest; + int *index,size; { int i; diff --git a/common/get.h b/common/get.h index eb6f187..2ca3d11 100644 --- a/common/get.h +++ b/common/get.h @@ -1,4 +1,4 @@ -/* $NetBSD: get.h,v 1.2 1997/03/25 03:07:16 thorpej Exp $ */ +/* $NetBSD: get.h,v 1.3 1997/10/16 23:24:40 lukem Exp $ */ /* * Copyright (c) 1993-95 Mats O Jansson. All rights reserved. @@ -28,33 +28,22 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $NetBSD: get.h,v 1.2 1997/03/25 03:07:16 thorpej Exp $ + * $NetBSD: get.h,v 1.3 1997/10/16 23:24:40 lukem Exp $ * */ #ifndef _GET_H_ #define _GET_H_ -#ifdef NO__P -u_char mopGetChar (/* u_char *, int * */); -u_short mopGetShort (/* u_char *, int * */); -u_long mopGetLong (/* u_char *, int * */); -void mopGetMulti (/* u_char *, int *,u_char *,int */); -int mopGetTrans (/* u_char *, int */); -void mopGetHeader (/* u_char *, int *, u_char **, u_char **, u_short *, - int *, int */); -u_short mopGetLength (/* u_char *, int */); -#else __BEGIN_DECLS -u_char mopGetChar __P((u_char *,int *)); -u_short mopGetShort __P((u_char *,int *)); -u_long mopGetLong __P((u_char *,int *)); -void mopGetMulti __P((u_char *,int *,u_char *,int)); -int mopGetTrans __P((u_char *, int)); -void mopGetHeader __P((u_char *, int *, u_char **, u_char **, u_short *, - int *, int)); -u_short mopGetLength __P((u_char *, int)); +u_char mopGetChar __P((u_char *, int *)); +u_short mopGetShort __P((u_char *, int *)); +u_int32_t mopGetLong __P((u_char *, int *)); +void mopGetMulti __P((u_char *, int *, u_char *, int)); +int mopGetTrans __P((u_char *, int)); +void mopGetHeader __P((u_char *, int *, u_char **, u_char **, + u_short *, int *, int)); +u_short mopGetLength __P((u_char *, int)); __END_DECLS -#endif -#endif _GET_H_ +#endif /* _GET_H_ */ diff --git a/common/loop-bsd.c b/common/loop-bsd.c index 05e517d..2f60df0 100644 --- a/common/loop-bsd.c +++ b/common/loop-bsd.c @@ -1,4 +1,4 @@ -/* $NetBSD: loop-bsd.c,v 1.2 1997/03/25 03:07:17 thorpej Exp $ */ +/* $NetBSD: loop-bsd.c,v 1.3 1997/10/16 23:24:42 lukem Exp $ */ /* * Copyright (c) 1993-95 Mats O Jansson. All rights reserved. @@ -29,8 +29,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef LINT -static char rcsid[] = "$NetBSD: loop-bsd.c,v 1.2 1997/03/25 03:07:17 thorpej Exp $"; +#include +#ifndef lint +__RCSID("$NetBSD: loop-bsd.c,v 1.3 1997/10/16 23:24:42 lukem Exp $"); #endif #include @@ -44,8 +45,9 @@ static char rcsid[] = "$NetBSD: loop-bsd.c,v 1.2 1997/03/25 03:07:17 thorpej Exp #include #include "os.h" -#include "common/common.h" -#include "common/mopdef.h" +#include "common.h" +#include "device.h" +#include "mopdef.h" int mopOpenRC(p, trans) @@ -169,7 +171,7 @@ Loop() bp = buf; ep = bp + cc; while (bp < ep) { - register int caplen, hdrlen; + int caplen, hdrlen; caplen = bhp->bh_caplen; hdrlen = bhp->bh_hdrlen; diff --git a/common/mopdef.c b/common/mopdef.c index f96530e..ee12aff 100644 --- a/common/mopdef.c +++ b/common/mopdef.c @@ -1,4 +1,4 @@ -/* $NetBSD: mopdef.c,v 1.2 1997/03/25 03:07:19 thorpej Exp $ */ +/* $NetBSD: mopdef.c,v 1.3 1997/10/16 23:24:46 lukem Exp $ */ /* * Copyright (c) 1995 Mats O Jansson. All rights reserved. @@ -29,12 +29,13 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef LINT -static char rcsid[] = "$NetBSD: mopdef.c,v 1.2 1997/03/25 03:07:19 thorpej Exp $"; +#include +#ifndef lint +__RCSID("$NetBSD: mopdef.c,v 1.3 1997/10/16 23:24:46 lukem Exp $"); #endif #define MOPDEF_SURPESS_EXTERN -#include "common/mopdef.h" +#include "mopdef.h" char dl_mcst[6] = MOP_DL_MULTICAST; /* Dump/Load Multicast */ char rc_mcst[6] = MOP_RC_MULTICAST; /* Remote Console Multicast */ @@ -42,6 +43,7 @@ char dl_802_proto[5] = MOP_K_PROTO_802_DL; /* MOP Dump/Load 802.2 */ char rc_802_proto[5] = MOP_K_PROTO_802_RC; /* MOP Remote Console 802.2 */ char lp_802_proto[5] = MOP_K_PROTO_802_LP; /* Loopback 802.2 */ +#if 0 int mopdef_dummy() { @@ -49,3 +51,4 @@ mopdef_dummy() return(dl_mcst[0]-rc_mcst[0]- lp_802_proto[1]-rc_802_proto[1]-lp_802_proto[1]); } +#endif diff --git a/common/nma.c b/common/nma.c index efe89ac..70b65fa 100644 --- a/common/nma.c +++ b/common/nma.c @@ -1,4 +1,4 @@ -/* $NetBSD: nma.c,v 1.2 1997/03/25 03:07:22 thorpej Exp $ */ +/* $NetBSD: nma.c,v 1.3 1997/10/16 23:24:48 lukem Exp $ */ /* * Copyright (c) 1995 Mats O Jansson. All rights reserved. @@ -29,12 +29,14 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef LINT -static char rcsid[] = "$NetBSD: nma.c,v 1.2 1997/03/25 03:07:22 thorpej Exp $"; +#include +#ifndef lint +__RCSID("$NetBSD: nma.c,v 1.3 1997/10/16 23:24:48 lukem Exp $"); #endif -#include -#include "common/nmadef.h" +#include "os.h" +#include "nma.h" +#include "nmadef.h" struct commDev { int val; @@ -223,4 +225,3 @@ nmaGetDevice(devno) return(current->name); } -