Module Name: src
Committed By: drochner
Date: Tue Nov 17 18:58:07 UTC 2009
Modified Files:
src/usr.sbin/mopd/common: cmp.c cmp.h common.h device.c device.h dl.c
dl.h get.c get.h pf.c pf.h print.c print.h put.c put.h rc.c rc.h
src/usr.sbin/mopd/mopd: mopd.c process.c process.h
Log Message:
ANSIfy, sprinkle "const"
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/mopd/common/cmp.c \
src/usr.sbin/mopd/common/get.h
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/mopd/common/cmp.h \
src/usr.sbin/mopd/common/device.h src/usr.sbin/mopd/common/dl.h \
src/usr.sbin/mopd/common/get.c src/usr.sbin/mopd/common/pf.h \
src/usr.sbin/mopd/common/print.c src/usr.sbin/mopd/common/print.h \
src/usr.sbin/mopd/common/put.c src/usr.sbin/mopd/common/put.h \
src/usr.sbin/mopd/common/rc.c src/usr.sbin/mopd/common/rc.h
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/mopd/common/common.h
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/mopd/common/device.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/mopd/common/dl.c
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/mopd/common/pf.c
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/mopd/mopd/mopd.c
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/mopd/mopd/process.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/mopd/mopd/process.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/mopd/common/cmp.c
diff -u src/usr.sbin/mopd/common/cmp.c:1.4 src/usr.sbin/mopd/common/cmp.c:1.5
--- src/usr.sbin/mopd/common/cmp.c:1.4 Tue Oct 20 00:51:13 2009
+++ src/usr.sbin/mopd/common/cmp.c Tue Nov 17 18:58:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: cmp.c,v 1.4 2009/10/20 00:51:13 snj Exp $ */
+/* $NetBSD: cmp.c,v 1.5 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -26,15 +26,14 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: cmp.c,v 1.4 2009/10/20 00:51:13 snj Exp $");
+__RCSID("$NetBSD: cmp.c,v 1.5 2009/11/17 18:58:07 drochner Exp $");
#endif
#include "os.h"
#include "cmp.h"
int
-mopCmpEAddr(addr1, addr2)
- u_char *addr1, *addr2;
+mopCmpEAddr(const u_char *addr1, const u_char *addr2)
{
- return(memcmp((char *)addr1, (char *)addr2, 6));
+ return(memcmp(addr1, addr2, 6));
}
Index: src/usr.sbin/mopd/common/get.h
diff -u src/usr.sbin/mopd/common/get.h:1.4 src/usr.sbin/mopd/common/get.h:1.5
--- src/usr.sbin/mopd/common/get.h:1.4 Tue Oct 20 00:51:13 2009
+++ src/usr.sbin/mopd/common/get.h Tue Nov 17 18:58:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: get.h,v 1.4 2009/10/20 00:51:13 snj Exp $ */
+/* $NetBSD: get.h,v 1.5 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -23,7 +23,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: get.h,v 1.4 2009/10/20 00:51:13 snj Exp $
+ * $NetBSD: get.h,v 1.5 2009/11/17 18:58:07 drochner Exp $
*
*/
@@ -31,14 +31,14 @@
#define _GET_H_
__BEGIN_DECLS
-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_char mopGetChar __P((const u_char *, int *));
+u_short mopGetShort __P((const u_char *, int *));
+u_int32_t mopGetLong __P((const u_char *, int *));
+void mopGetMulti __P((const u_char *, int *, u_char *, int));
+int mopGetTrans __P((const u_char *, int));
+void mopGetHeader __P((const u_char *, int *, const u_char **, const u_char **,
u_short *, int *, int));
-u_short mopGetLength __P((u_char *, int));
+u_short mopGetLength __P((const u_char *, int));
__END_DECLS
#endif /* _GET_H_ */
Index: src/usr.sbin/mopd/common/cmp.h
diff -u src/usr.sbin/mopd/common/cmp.h:1.5 src/usr.sbin/mopd/common/cmp.h:1.6
--- src/usr.sbin/mopd/common/cmp.h:1.5 Tue Oct 20 00:51:13 2009
+++ src/usr.sbin/mopd/common/cmp.h Tue Nov 17 18:58:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: cmp.h,v 1.5 2009/10/20 00:51:13 snj Exp $ */
+/* $NetBSD: cmp.h,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -23,7 +23,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: cmp.h,v 1.5 2009/10/20 00:51:13 snj Exp $
+ * $NetBSD: cmp.h,v 1.6 2009/11/17 18:58:07 drochner Exp $
*
*/
@@ -31,7 +31,7 @@
#define _CMP_H_
__BEGIN_DECLS
-int mopCmpEAddr __P((u_char *, u_char *));
+int mopCmpEAddr __P((const u_char *, const u_char *));
__END_DECLS
#endif /* _CMP_H_ */
Index: src/usr.sbin/mopd/common/device.h
diff -u src/usr.sbin/mopd/common/device.h:1.5 src/usr.sbin/mopd/common/device.h:1.6
--- src/usr.sbin/mopd/common/device.h:1.5 Tue Oct 20 00:51:13 2009
+++ src/usr.sbin/mopd/common/device.h Tue Nov 17 18:58:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: device.h,v 1.5 2009/10/20 00:51:13 snj Exp $ */
+/* $NetBSD: device.h,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -23,7 +23,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: device.h,v 1.5 2009/10/20 00:51:13 snj Exp $
+ * $NetBSD: device.h,v 1.6 2009/11/17 18:58:07 drochner Exp $
*
*/
@@ -32,9 +32,9 @@
__BEGIN_DECLS
#ifdef DEV_NEW_CONF
-void deviceEthAddr __P((char *, u_char *));
+void deviceEthAddr __P((const char *, u_char *));
#endif
-void deviceInitOne __P((char *));
+void deviceInitOne __P((const char *));
void deviceInitAll __P((void));
/* from loop-bsd.c */
Index: src/usr.sbin/mopd/common/dl.h
diff -u src/usr.sbin/mopd/common/dl.h:1.5 src/usr.sbin/mopd/common/dl.h:1.6
--- src/usr.sbin/mopd/common/dl.h:1.5 Tue Oct 20 00:51:13 2009
+++ src/usr.sbin/mopd/common/dl.h Tue Nov 17 18:58:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: dl.h,v 1.5 2009/10/20 00:51:13 snj Exp $ */
+/* $NetBSD: dl.h,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -23,7 +23,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: dl.h,v 1.5 2009/10/20 00:51:13 snj Exp $
+ * $NetBSD: dl.h,v 1.6 2009/11/17 18:58:07 drochner Exp $
*
*/
@@ -31,7 +31,7 @@
#define _DL_H_
__BEGIN_DECLS
-void mopDumpDL __P((FILE *, u_char *, int));
+void mopDumpDL __P((FILE *, const u_char *, int));
__END_DECLS
#endif /* _DL_H_ */
Index: src/usr.sbin/mopd/common/get.c
diff -u src/usr.sbin/mopd/common/get.c:1.5 src/usr.sbin/mopd/common/get.c:1.6
--- src/usr.sbin/mopd/common/get.c:1.5 Tue Oct 20 00:51:13 2009
+++ src/usr.sbin/mopd/common/get.c Tue Nov 17 18:58:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: get.c,v 1.5 2009/10/20 00:51:13 snj Exp $ */
+/* $NetBSD: get.c,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -26,7 +26,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: get.c,v 1.5 2009/10/20 00:51:13 snj Exp $");
+__RCSID("$NetBSD: get.c,v 1.6 2009/11/17 18:58:07 drochner Exp $");
#endif
#include "os.h"
@@ -34,9 +34,7 @@
#include "mopdef.h"
u_char
-mopGetChar(pkt, idx)
- u_char *pkt;
- int *idx;
+mopGetChar(const u_char *pkt, int *idx)
{
u_char ret;
@@ -46,9 +44,7 @@
}
u_short
-mopGetShort(pkt, idx)
- u_char *pkt;
- int *idx;
+mopGetShort(const u_char *pkt, int *idx)
{
u_short ret;
@@ -58,9 +54,7 @@
}
u_int32_t
-mopGetLong(pkt, idx)
- u_char *pkt;
- int *idx;
+mopGetLong(const u_char *pkt, int *idx)
{
u_int32_t ret;
@@ -73,9 +67,7 @@
}
void
-mopGetMulti(pkt, idx, dest, size)
- u_char *pkt,*dest;
- int *idx,size;
+mopGetMulti(const u_char *pkt, int *idx, u_char *dest, int size)
{
int i;
@@ -87,14 +79,12 @@
}
int
-mopGetTrans(pkt, trans)
- u_char *pkt;
- int trans;
+mopGetTrans(const u_char *pkt, int trans)
{
- u_short *ptype;
+ const u_short *ptype;
if (trans == 0) {
- ptype = (u_short *)(pkt+12);
+ ptype = (const u_short *)(pkt+12);
if (ntohs(*ptype) < 1600) {
trans = TRANS_8023;
} else {
@@ -105,10 +95,8 @@
}
void
-mopGetHeader(pkt, idx, dst, src, proto, len, trans)
- u_char *pkt, **dst, **src;
- int *idx, *len, trans;
- u_short *proto;
+mopGetHeader(const u_char *pkt, int *idx, const u_char **dst, const u_char **src,
+ u_short *proto, int *len, int trans)
{
*dst = pkt;
*src = pkt + 6;
@@ -131,9 +119,7 @@
}
u_short
-mopGetLength(pkt, trans)
- u_char *pkt;
- int trans;
+mopGetLength(const u_char *pkt, int trans)
{
switch(trans) {
case TRANS_ETHER:
Index: src/usr.sbin/mopd/common/pf.h
diff -u src/usr.sbin/mopd/common/pf.h:1.5 src/usr.sbin/mopd/common/pf.h:1.6
--- src/usr.sbin/mopd/common/pf.h:1.5 Tue Oct 20 00:51:13 2009
+++ src/usr.sbin/mopd/common/pf.h Tue Nov 17 18:58:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: pf.h,v 1.5 2009/10/20 00:51:13 snj Exp $ */
+/* $NetBSD: pf.h,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -23,7 +23,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: pf.h,v 1.5 2009/10/20 00:51:13 snj Exp $
+ * $NetBSD: pf.h,v 1.6 2009/11/17 18:58:07 drochner Exp $
*
*/
@@ -31,13 +31,13 @@
#define _PF_H_
__BEGIN_DECLS
-int pfTrans __P((char *));
-int pfInit __P((char *, int, u_short, int));
+int pfTrans __P((const char *));
+int pfInit __P((const char *, int, u_short, int));
int pfEthAddr __P((int, u_char *));
-int pfAddMulti __P((int, char *, char *));
-int pfDelMulti __P((int, char *, char *));
+int pfAddMulti __P((int, const char *, const char *));
+int pfDelMulti __P((int, const char *, const char *));
int pfRead __P((int, u_char *, int));
-int pfWrite __P((int, u_char *, int, int));
+int pfWrite __P((int, const u_char *, int, int));
__END_DECLS
#endif /* _PF_H_ */
Index: src/usr.sbin/mopd/common/print.c
diff -u src/usr.sbin/mopd/common/print.c:1.5 src/usr.sbin/mopd/common/print.c:1.6
--- src/usr.sbin/mopd/common/print.c:1.5 Tue Oct 20 00:51:13 2009
+++ src/usr.sbin/mopd/common/print.c Tue Nov 17 18:58:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: print.c,v 1.5 2009/10/20 00:51:13 snj Exp $ */
+/* $NetBSD: print.c,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-96 Mats O Jansson. All rights reserved.
@@ -26,7 +26,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: print.c,v 1.5 2009/10/20 00:51:13 snj Exp $");
+__RCSID("$NetBSD: print.c,v 1.6 2009/11/17 18:58:07 drochner Exp $");
#endif
#include <sys/types.h>
@@ -43,9 +43,7 @@
#define SHORT_PRINT
void
-mopPrintHWA(fd, ap)
- FILE *fd;
- u_char *ap;
+mopPrintHWA(FILE *fd, const u_char *ap)
{
(void)fprintf(fd, "%x:%x:%x:%x:%x:%x",
ap[0],ap[1],ap[2],ap[3],ap[4],ap[5]);
@@ -58,9 +56,7 @@
}
void
-mopPrintBPTY(fd, bpty)
- FILE *fd;
- u_char bpty;
+mopPrintBPTY(FILE *fd, u_char bpty)
{
switch(bpty) {
case MOP_K_BPTY_SYS:
@@ -76,9 +72,7 @@
};
void
-mopPrintPGTY(fd, pgty)
- FILE *fd;
- u_char pgty;
+mopPrintPGTY(FILE *fd, u_char pgty)
{
switch(pgty) {
case MOP_K_PGTY_SECLDR:
@@ -100,13 +94,11 @@
}
void
-mopPrintOneline(fd, pkt, trans)
- FILE *fd;
- u_char *pkt;
- int trans;
+mopPrintOneline(FILE *fd, const u_char *pkt, int trans)
{
int idx = 0;
- u_char *dst, *src, code;
+ const u_char *dst, *src;
+ u_char code;
u_short proto;
int len;
@@ -250,12 +242,9 @@
}
void
-mopPrintHeader(fd, pkt, trans)
- FILE *fd;
- u_char *pkt;
- int trans;
+mopPrintHeader(FILE *fd, const u_char *pkt, int trans)
{
- u_char *dst, *src;
+ const u_char *dst, *src;
u_short proto;
int len, idx = 0;
@@ -314,12 +303,9 @@
}
void
-mopPrintMopHeader(fd, pkt, trans)
- FILE *fd;
- u_char *pkt;
- int trans;
+mopPrintMopHeader(FILE *fd, const u_char *pkt, int trans)
{
- u_char *dst, *src;
+ const u_char *dst, *src;
u_short proto;
int len, idx = 0;
u_char code;
@@ -426,9 +412,7 @@
}
void
-mopPrintDevice(fd, device)
- FILE *fd;
- u_char device;
+mopPrintDevice(FILE *fd, u_char device)
{
const char *sname, *name;
@@ -439,9 +423,7 @@
}
void
-mopPrintTime(fd, ap)
- FILE *fd;
- u_char *ap;
+mopPrintTime(FILE *fd, const u_char *ap)
{
(void)fprintf(fd,
"%04d-%02d-%02d %02d:%02d:%02d.%02d %d:%02d",
@@ -450,15 +432,13 @@
}
void
-mopPrintInfo(fd, pkt, idx, moplen, mopcode, trans)
- FILE *fd;
- u_char *pkt, mopcode;
- int *idx, trans;
- u_short moplen;
+mopPrintInfo(FILE *fd, const u_char *pkt, int *idx,
+ u_short moplen, u_char mopcode, int trans)
{
u_short itype,tmps;
u_char ilen ,tmpc,device;
- u_char uc1,uc2,uc3,*ucp;
+ u_char uc1,uc2,uc3;
+ const u_char *ucp;
int i;
device = 0;
Index: src/usr.sbin/mopd/common/print.h
diff -u src/usr.sbin/mopd/common/print.h:1.5 src/usr.sbin/mopd/common/print.h:1.6
--- src/usr.sbin/mopd/common/print.h:1.5 Tue Oct 20 00:51:13 2009
+++ src/usr.sbin/mopd/common/print.h Tue Nov 17 18:58:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: print.h,v 1.5 2009/10/20 00:51:13 snj Exp $ */
+/* $NetBSD: print.h,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -23,7 +23,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: print.h,v 1.5 2009/10/20 00:51:13 snj Exp $
+ * $NetBSD: print.h,v 1.6 2009/11/17 18:58:07 drochner Exp $
*
*/
@@ -31,15 +31,15 @@
#define _PRINT_H_
__BEGIN_DECLS
-void mopPrintHWA __P((FILE *, u_char *));
+void mopPrintHWA __P((FILE *, const u_char *));
void mopPrintBPTY __P((FILE *, u_char));
void mopPrintPGTY __P((FILE *, u_char));
-void mopPrintOneline __P((FILE *, u_char *, int));
-void mopPrintHeader __P((FILE *, u_char *, int));
-void mopPrintMopHeader __P((FILE *, u_char *, int));
+void mopPrintOneline __P((FILE *, const u_char *, int));
+void mopPrintHeader __P((FILE *, const u_char *, int));
+void mopPrintMopHeader __P((FILE *, const u_char *, int));
void mopPrintDevice __P((FILE *, u_char));
-void mopPrintTime __P((FILE *, u_char *));
-void mopPrintInfo __P((FILE *, u_char *, int *, u_short,
+void mopPrintTime __P((FILE *, const u_char *));
+void mopPrintInfo __P((FILE *, const u_char *, int *, u_short,
u_char, int));
__END_DECLS
Index: src/usr.sbin/mopd/common/put.c
diff -u src/usr.sbin/mopd/common/put.c:1.5 src/usr.sbin/mopd/common/put.c:1.6
--- src/usr.sbin/mopd/common/put.c:1.5 Tue Oct 20 00:51:13 2009
+++ src/usr.sbin/mopd/common/put.c Tue Nov 17 18:58:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: put.c,v 1.5 2009/10/20 00:51:13 snj Exp $ */
+/* $NetBSD: put.c,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -26,7 +26,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: put.c,v 1.5 2009/10/20 00:51:13 snj Exp $");
+__RCSID("$NetBSD: put.c,v 1.6 2009/11/17 18:58:07 drochner Exp $");
#endif
#include "os.h"
@@ -34,20 +34,14 @@
#include "put.h"
void
-mopPutChar(pkt, idx, value)
- u_char *pkt;
- int *idx;
- u_char value;
+mopPutChar(u_char *pkt, int *idx, u_char value)
{
pkt[*idx] = value;
*idx = *idx + 1;
}
void
-mopPutShort(pkt, idx, value)
- u_char *pkt;
- int *idx;
- u_short value;
+mopPutShort(u_char *pkt, int *idx, u_short value)
{
int i;
for (i = 0; i < 2; i++) {
@@ -58,10 +52,7 @@
}
void
-mopPutLong(pkt, idx, value)
- u_char *pkt;
- int *idx;
- u_int32_t value;
+mopPutLong(u_char *pkt, int *idx, u_int32_t value)
{
int i;
for (i = 0; i < 4; i++) {
@@ -72,10 +63,7 @@
}
void
-mopPutMulti(pkt, idx, value, size)
- u_char *pkt;
- int *idx,size;
- const u_char *value;
+mopPutMulti(u_char *pkt, int *idx, const u_char *value, int size)
{
int i;
@@ -86,10 +74,7 @@
}
void
-mopPutTime(pkt, idx, value)
- u_char *pkt;
- int *idx;
- time_t value;
+mopPutTime(u_char *pkt, int *idx, time_t value)
{
time_t tnow;
struct tm *timenow;
@@ -116,12 +101,8 @@
}
void
-mopPutHeader(pkt, idx, dst, src, proto, trans)
- u_char *pkt;
- int *idx;
- u_char dst[], src[];
- u_short proto;
- int trans;
+mopPutHeader(u_char *pkt, int *idx, const u_char *dst, const u_char *src,
+ u_short proto, int trans)
{
mopPutMulti(pkt, idx, dst, 6);
@@ -153,10 +134,7 @@
}
void
-mopPutLength(pkt, trans, len)
- u_char *pkt;
- int trans;
- u_short len;
+mopPutLength(u_char *pkt, int trans, u_short len)
{
int idx = 0;
Index: src/usr.sbin/mopd/common/put.h
diff -u src/usr.sbin/mopd/common/put.h:1.5 src/usr.sbin/mopd/common/put.h:1.6
--- src/usr.sbin/mopd/common/put.h:1.5 Tue Oct 20 00:51:13 2009
+++ src/usr.sbin/mopd/common/put.h Tue Nov 17 18:58:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: put.h,v 1.5 2009/10/20 00:51:13 snj Exp $ */
+/* $NetBSD: put.h,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -23,7 +23,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: put.h,v 1.5 2009/10/20 00:51:13 snj Exp $
+ * $NetBSD: put.h,v 1.6 2009/11/17 18:58:07 drochner Exp $
*
*/
@@ -36,7 +36,7 @@
void mopPutLong __P((u_char *, int *, u_int32_t));
void mopPutMulti __P((u_char *, int *, const u_char *, int));
void mopPutTime __P((u_char *, int *, time_t));
-void mopPutHeader __P((u_char *, int *, u_char *, u_char *, u_short, int));
+void mopPutHeader __P((u_char *, int *, const u_char *, const u_char *, u_short, int));
void mopPutLength __P((u_char *, int, u_short));
__END_DECLS
Index: src/usr.sbin/mopd/common/rc.c
diff -u src/usr.sbin/mopd/common/rc.c:1.5 src/usr.sbin/mopd/common/rc.c:1.6
--- src/usr.sbin/mopd/common/rc.c:1.5 Tue Oct 20 00:51:13 2009
+++ src/usr.sbin/mopd/common/rc.c Tue Nov 17 18:58:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: rc.c,v 1.5 2009/10/20 00:51:13 snj Exp $ */
+/* $NetBSD: rc.c,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -26,7 +26,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: rc.c,v 1.5 2009/10/20 00:51:13 snj Exp $");
+__RCSID("$NetBSD: rc.c,v 1.6 2009/11/17 18:58:07 drochner Exp $");
#endif
#include "os.h"
@@ -36,10 +36,7 @@
#include "rc.h"
void
-mopDumpRC(fd, pkt, trans)
- FILE *fd;
- u_char *pkt;
- int trans;
+mopDumpRC(FILE *fd, const u_char *pkt, int trans)
{
int i,idx = 0;
int32_t tmpl;
Index: src/usr.sbin/mopd/common/rc.h
diff -u src/usr.sbin/mopd/common/rc.h:1.5 src/usr.sbin/mopd/common/rc.h:1.6
--- src/usr.sbin/mopd/common/rc.h:1.5 Tue Oct 20 00:51:13 2009
+++ src/usr.sbin/mopd/common/rc.h Tue Nov 17 18:58:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: rc.h,v 1.5 2009/10/20 00:51:13 snj Exp $ */
+/* $NetBSD: rc.h,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -23,7 +23,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: rc.h,v 1.5 2009/10/20 00:51:13 snj Exp $
+ * $NetBSD: rc.h,v 1.6 2009/11/17 18:58:07 drochner Exp $
*
*/
@@ -31,7 +31,7 @@
#define _RC_H_
__BEGIN_DECLS
-void mopDumpRC __P((FILE *, u_char *, int));
+void mopDumpRC __P((FILE *, const u_char *, int));
__END_DECLS
#endif /* _RC_H_ */
Index: src/usr.sbin/mopd/common/common.h
diff -u src/usr.sbin/mopd/common/common.h:1.7 src/usr.sbin/mopd/common/common.h:1.8
--- src/usr.sbin/mopd/common/common.h:1.7 Tue Oct 20 00:51:13 2009
+++ src/usr.sbin/mopd/common/common.h Tue Nov 17 18:58:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: common.h,v 1.7 2009/10/20 00:51:13 snj Exp $ */
+/* $NetBSD: common.h,v 1.8 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -23,7 +23,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.7 2009/10/20 00:51:13 snj Exp $
+ * $NetBSD: common.h,v 1.8 2009/11/17 18:58:07 drochner Exp $
*
*/
@@ -53,9 +53,9 @@
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) __P((char *, int, u_short, int));
+ int (*iopen) __P((const char *, int, u_short, int));
/* Interface Open Routine */
- int (*write) __P((int, u_char *, int, int));
+ int (*write) __P((int, const u_char *, int, int));
/* Interface Write Routine */
void (*read) __P((void)); /* Interface Read Routine */
struct if_info *next; /* Next Interface */
Index: src/usr.sbin/mopd/common/device.c
diff -u src/usr.sbin/mopd/common/device.c:1.10 src/usr.sbin/mopd/common/device.c:1.11
--- src/usr.sbin/mopd/common/device.c:1.10 Tue Oct 20 00:51:13 2009
+++ src/usr.sbin/mopd/common/device.c Tue Nov 17 18:58:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: device.c,v 1.10 2009/10/20 00:51:13 snj Exp $ */
+/* $NetBSD: device.c,v 1.11 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -26,7 +26,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: device.c,v 1.10 2009/10/20 00:51:13 snj Exp $");
+__RCSID("$NetBSD: device.c,v 1.11 2009/11/17 18:58:07 drochner Exp $");
#endif
#include "os.h"
@@ -38,7 +38,7 @@
struct if_info *iflist; /* Interface List */
-void deviceOpen __P((char *, u_short, int));
+void deviceOpen(const char *, u_short, int);
#ifdef DEV_NEW_CONF
/*
@@ -46,9 +46,7 @@
*/
void
-deviceEthAddr(ifname, eaddr)
- char *ifname;
- u_char *eaddr;
+deviceEthAddr(const char *ifname, u_char *eaddr)
{
struct sockaddr_dl *sdl;
struct ifaddrs *ifap, *ifa;
@@ -74,10 +72,7 @@
#endif /* DEV_NEW_CONF */
void
-deviceOpen(ifname, proto, trans)
- char *ifname;
- u_short proto;
- int trans;
+deviceOpen(const char *ifname, u_short proto, int trans)
{
struct if_info *p, tmp;
@@ -127,8 +122,7 @@
}
void
-deviceInitOne(ifname)
- char *ifname;
+deviceInitOne(const char *ifname)
{
char interface[IFNAME_SIZE];
struct if_info *p;
Index: src/usr.sbin/mopd/common/dl.c
diff -u src/usr.sbin/mopd/common/dl.c:1.6 src/usr.sbin/mopd/common/dl.c:1.7
--- src/usr.sbin/mopd/common/dl.c:1.6 Tue Oct 20 00:51:13 2009
+++ src/usr.sbin/mopd/common/dl.c Tue Nov 17 18:58:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: dl.c,v 1.6 2009/10/20 00:51:13 snj Exp $ */
+/* $NetBSD: dl.c,v 1.7 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -26,7 +26,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: dl.c,v 1.6 2009/10/20 00:51:13 snj Exp $");
+__RCSID("$NetBSD: dl.c,v 1.7 2009/11/17 18:58:07 drochner Exp $");
#endif
#include "os.h"
@@ -36,14 +36,12 @@
#include "print.h"
void
-mopDumpDL(fd, pkt, trans)
- FILE *fd;
- u_char *pkt;
- int trans;
+mopDumpDL(FILE *fd, const u_char *pkt, int trans)
{
int i,idx = 0;
u_int32_t tmpl;
- u_char tmpc,c,program[257],code,*ucp;
+ u_char tmpc,c,program[257],code;
+ const u_char *ucp;
u_short len,tmps,moplen;
len = mopGetLength(pkt, trans);
Index: src/usr.sbin/mopd/common/pf.c
diff -u src/usr.sbin/mopd/common/pf.c:1.11 src/usr.sbin/mopd/common/pf.c:1.12
--- src/usr.sbin/mopd/common/pf.c:1.11 Tue Oct 20 00:51:13 2009
+++ src/usr.sbin/mopd/common/pf.c Tue Nov 17 18:58:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: pf.c,v 1.11 2009/10/20 00:51:13 snj Exp $ */
+/* $NetBSD: pf.c,v 1.12 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: pf.c,v 1.11 2009/10/20 00:51:13 snj Exp $");
+__RCSID("$NetBSD: pf.c,v 1.12 2009/11/17 18:58:07 drochner Exp $");
#endif
#include "os.h"
@@ -58,8 +58,7 @@
*/
int
-pfTrans(interface)
- char *interface;
+pfTrans(const char *interface)
{
return TRANS_ETHER+TRANS_8023+TRANS_AND;
}
@@ -69,10 +68,7 @@
*/
int
-pfInit(interface, mode, protocol, typ)
- char *interface;
- u_short protocol;
- int typ, mode;
+pfInit(const char *interface, int mode, u_short protocol, int typ)
{
int fd;
struct ifreq ifr;
@@ -150,9 +146,7 @@
*/
int
-pfAddMulti(s, interface, addr)
- int s;
- char *interface, *addr;
+pfAddMulti(int s, const char *interface, const char *addr)
{
struct ifreq ifr;
int fd;
@@ -185,9 +179,7 @@
*/
int
-pfDelMulti(s, interface, addr)
- int s;
- char *interface, *addr;
+pfDelMulti(int s, const char *interface, const char *addr)
{
struct ifreq ifr;
int fd;
@@ -220,9 +212,7 @@
*/
int
-pfRead(fd, buf, len)
- int fd, len;
- u_char *buf;
+pfRead(int fd, u_char *buf, int len)
{
return(read(fd, buf, len));
}
@@ -232,24 +222,22 @@
*/
int
-pfWrite(fd, buf, len, trans)
- int fd, len, trans;
- u_char *buf;
+pfWrite(int fd, const u_char *buf, int len, int trans)
{
struct iovec iov[2];
switch (trans) {
case TRANS_8023:
- iov[0].iov_base = (caddr_t)buf;
+ iov[0].iov_base = (caddr_t)__UNCONST(buf);
iov[0].iov_len = 22;
- iov[1].iov_base = (caddr_t)buf+22;
+ iov[1].iov_base = (caddr_t)__UNCONST(buf+22);
iov[1].iov_len = len-22;
break;
default:
- iov[0].iov_base = (caddr_t)buf;
+ iov[0].iov_base = (caddr_t)__UNCONST(buf);
iov[0].iov_len = 14;
- iov[1].iov_base = (caddr_t)buf+14;
+ iov[1].iov_base = (caddr_t)__UNCONST(buf+14);
iov[1].iov_len = len-14;
break;
}
Index: src/usr.sbin/mopd/mopd/mopd.c
diff -u src/usr.sbin/mopd/mopd/mopd.c:1.12 src/usr.sbin/mopd/mopd/mopd.c:1.13
--- src/usr.sbin/mopd/mopd/mopd.c:1.12 Tue Oct 20 00:51:13 2009
+++ src/usr.sbin/mopd/mopd/mopd.c Tue Nov 17 18:58:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: mopd.c,v 1.12 2009/10/20 00:51:13 snj Exp $ */
+/* $NetBSD: mopd.c,v 1.13 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-96 Mats O Jansson. All rights reserved.
@@ -26,7 +26,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: mopd.c,v 1.12 2009/10/20 00:51:13 snj Exp $");
+__RCSID("$NetBSD: mopd.c,v 1.13 2009/11/17 18:58:07 drochner Exp $");
#endif
/*
@@ -174,7 +174,7 @@
struct if_info *ii;
u_char *pkt;
{
- u_char *dst, *src;
+ const u_char *dst, *src;
u_short ptype;
int idx, trans, len;
Index: src/usr.sbin/mopd/mopd/process.c
diff -u src/usr.sbin/mopd/mopd/process.c:1.16 src/usr.sbin/mopd/mopd/process.c:1.17
--- src/usr.sbin/mopd/mopd/process.c:1.16 Tue Oct 20 00:51:13 2009
+++ src/usr.sbin/mopd/mopd/process.c Tue Nov 17 18:58:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: process.c,v 1.16 2009/10/20 00:51:13 snj Exp $ */
+/* $NetBSD: process.c,v 1.17 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -26,7 +26,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: process.c,v 1.16 2009/10/20 00:51:13 snj Exp $");
+__RCSID("$NetBSD: process.c,v 1.17 2009/11/17 18:58:07 drochner Exp $");
#endif
#include "os.h"
@@ -48,26 +48,23 @@
struct dllist dllist[MAXDL]; /* dump/load list */
-void mopNextLoad __P((u_char *, u_char *, u_char, int));
-void mopProcessDL __P((FILE *, struct if_info *, u_char *, int *,
- u_char *, u_char *, int, u_short));
-void mopProcessRC __P((FILE *, struct if_info *, u_char *, int *,
- u_char *, u_char *, int, u_short));
-void mopProcessInfo __P((u_char *, int *, u_short, struct dllist *, int));
-void mopSendASV __P((u_char *, u_char *, struct if_info *, int));
-void mopStartLoad __P((u_char *, u_char *, struct dllist *, int));
+void mopNextLoad(const u_char *, const u_char *, u_char, int);
+void mopProcessDL(FILE *, struct if_info *, const u_char *, int *,
+ const u_char *, const u_char *, int, u_short);
+void mopProcessRC(FILE *, struct if_info *, const u_char *, int *,
+ const u_char *, const u_char *, int, u_short);
+void mopProcessInfo(const u_char *, int *, u_short, struct dllist *, int);
+void mopSendASV(const u_char *, const u_char *, struct if_info *, int);
+void mopStartLoad(const u_char *, const u_char *, struct dllist *, int);
void
-mopProcessInfo(pkt, idx, moplen, dl_rpr, trans)
- u_char *pkt;
- int *idx;
- u_short moplen;
- struct dllist *dl_rpr;
- int trans;
+mopProcessInfo(const u_char *pkt, int *idx, u_short moplen, struct dllist *dl_rpr,
+ int trans)
{
u_short itype,tmps;
u_char ilen ,tmpc,device;
- u_char uc1,uc2,uc3,*ucp;
+ u_char uc1,uc2,uc3;
+ const u_char *ucp;
device = 0;
@@ -169,10 +166,7 @@
}
void
-mopSendASV(dst, src, ii, trans)
- u_char *dst,*src;
- struct if_info *ii;
- int trans;
+mopSendASV(const u_char *dst, const u_char *src, struct if_info *ii, int trans)
{
u_char pkt[200], *p;
int idx;
@@ -211,10 +205,8 @@
#define MAX_ETH_PAYLOAD 1492
void
-mopStartLoad(dst, src, dl_rpr, trans)
- u_char *dst,*src;
- struct dllist *dl_rpr;
- int trans;
+mopStartLoad(const u_char *dst, const u_char *src, struct dllist *dl_rpr,
+ int trans)
{
int len;
int i, slot;
@@ -244,7 +236,7 @@
if (slot == -1) {
slot = i;
memmove((char *)dle->eaddr,
- (char *)dst, 6);
+ (const char *)dst, 6);
}
}
}
@@ -318,9 +310,7 @@
}
void
-mopNextLoad(dst, src, new_count, trans)
- u_char *dst, *src, new_count;
- int trans;
+mopNextLoad(const u_char *dst, const u_char *src, u_char new_count, int trans)
{
int len;
int i, slot;
@@ -437,14 +427,8 @@
}
void
-mopProcessDL(fd, ii, pkt, idx, dst, src, trans, len)
- FILE *fd;
- struct if_info *ii;
- u_char *pkt;
- int *idx;
- u_char *dst, *src;
- int trans;
- u_short len;
+mopProcessDL(FILE *fd, struct if_info *ii, const u_char *pkt, int *idx,
+ const u_char *dst, const u_char *src, int trans, u_short len)
{
u_char tmpc;
u_short moplen;
@@ -523,7 +507,7 @@
dl_rpr = &dl;
memset(dl_rpr, 0, sizeof(*dl_rpr));
dl_rpr->ii = ii;
- memmove((char *)(dl_rpr->eaddr), (char *)src, 6);
+ memmove((char *)(dl_rpr->eaddr), (const char *)src, 6);
mopProcessInfo(pkt,idx,moplen,dl_rpr,trans);
snprintf(filename, sizeof(filename), "%s/%s.SYS",
@@ -581,14 +565,8 @@
}
void
-mopProcessRC(fd, ii, pkt, idx, dst, src, trans, len)
- FILE *fd;
- struct if_info *ii;
- u_char *pkt;
- int *idx;
- u_char *dst, *src;
- int trans;
- u_short len;
+mopProcessRC(FILE *fd, struct if_info *ii, const u_char *pkt, int *idx,
+ const u_char *dst, const u_char *src, int trans, u_short len)
{
u_char tmpc;
u_short tmps, moplen = 0;
@@ -632,7 +610,7 @@
dl_rpr = &dl;
memset(dl_rpr, 0, sizeof(*dl_rpr));
dl_rpr->ii = ii;
- memmove((char *)(dl_rpr->eaddr), (char *)src, 6);
+ memmove((char *)(dl_rpr->eaddr), (const char *)src, 6);
mopProcessInfo(pkt,idx,moplen,dl_rpr,trans);
break;
Index: src/usr.sbin/mopd/mopd/process.h
diff -u src/usr.sbin/mopd/mopd/process.h:1.5 src/usr.sbin/mopd/mopd/process.h:1.6
--- src/usr.sbin/mopd/mopd/process.h:1.5 Tue Oct 20 00:51:13 2009
+++ src/usr.sbin/mopd/mopd/process.h Tue Nov 17 18:58:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: process.h,v 1.5 2009/10/20 00:51:13 snj Exp $ */
+/* $NetBSD: process.h,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -23,7 +23,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: process.h,v 1.5 2009/10/20 00:51:13 snj Exp $
+ * $NetBSD: process.h,v 1.6 2009/11/17 18:58:07 drochner Exp $
*
*/
@@ -32,9 +32,9 @@
__BEGIN_DECLS
void mopProcessDL __P((FILE *, struct if_info *, u_char *, int *,
- u_char *, u_char *, int, u_short));
+ const u_char *, const u_char *, int, u_short));
void mopProcessRC __P((FILE *, struct if_info *, u_char *, int *,
- u_char *, u_char *, int, u_short));
+ const u_char *, const u_char *, int, u_short));
__END_DECLS
#endif /* _PROCESS_H_ */