- WARNsify

- KNFify (a bit)
- use int32_t & u_int32_t instead of long and u_long
- clean up man pages a bit
This commit is contained in:
lukem 1997-10-16 23:24:50 +00:00
parent 410b3b428a
commit 07ed891089
22 changed files with 293 additions and 424 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: nma.h,v 1.2 1997/03/25 03:07:23 thorpej Exp $ */
/* $NetBSD: nma.h,v 1.3 1997/10/16 23:24:50 lukem Exp $ */
/*
* Copyright (c) 1995 Mats O Jansson. All rights reserved.
@ -28,21 +28,16 @@
* (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: nma.h,v 1.2 1997/03/25 03:07:23 thorpej Exp $
* $NetBSD: nma.h,v 1.3 1997/10/16 23:24:50 lukem Exp $
*
*/
#ifndef _NMA_H_
#define _NMA_H_
#ifdef NO__P
char *nmaGetShort (/* int */);
char *nmaGetDevice (/* int */);
#else
__BEGIN_DECLS
char *nmaGetShort __P((int));
char *nmaGetDevice __P((int));
__END_DECLS
#endif
#endif _NMA_H_

View File

@ -1,4 +1,4 @@
/* $NetBSD: os.h,v 1.2 1997/03/25 03:07:26 thorpej Exp $ */
/* $NetBSD: os.h,v 1.3 1997/10/16 23:24:53 lukem Exp $ */
/*
* Copyright (c) 1994-95 Mats O Jansson. All rights reserved.
@ -28,30 +28,32 @@
* (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: os.h,v 1.2 1997/03/25 03:07:26 thorpej Exp $
* $NetBSD: os.h,v 1.3 1997/10/16 23:24:53 lukem Exp $
*
*/
#ifndef _OS_H_
#define _OS_H_
#include <stdio.h>
#include <syslog.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <net/if.h>
#include <net/if_dl.h>
#include <net/if_types.h>
#include <sys/ioctl.h>
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <strings.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <time.h>
#include <unistd.h>
#define DEV_NEW_CONF

View File

@ -1,4 +1,4 @@
/* $NetBSD: pf.c,v 1.3 1997/03/25 03:07:27 thorpej Exp $ */
/* $NetBSD: pf.c,v 1.4 1997/10/16 23:24:55 lukem Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -33,40 +33,23 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LINT
static char rcsid[] = "$NetBSD: pf.c,v 1.3 1997/03/25 03:07:27 thorpej Exp $";
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: pf.c,v 1.4 1997/10/16 23:24:55 lukem Exp $");
#endif
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/file.h>
#include <sys/socket.h>
#include "os.h"
#include <sys/uio.h>
#include <net/if.h>
#include <net/bpf.h>
#include <sys/errno.h>
#include <netinet/in.h>
#include <netinet/if_inarp.h>
#include <netdb.h>
#include <ctype.h>
#include <strings.h>
#include <syslog.h>
#include <varargs.h>
#include "common/mopdef.h"
#include "mopdef.h"
#include "pf.h"
/*
* Variables
*/
extern int errno;
extern int promisc;
/*
@ -179,7 +162,7 @@ pfAddMulti(s, interface, addr)
strcpy(ifr.ifr_name, interface);
ifr.ifr_addr.sa_family = AF_UNSPEC;
bcopy(addr, ifr.ifr_addr.sa_data, 6);
memmove(ifr.ifr_addr.sa_data, addr, 6);
/*
* open a socket, temporarily, to use for SIOC* ioctls
@ -214,7 +197,7 @@ pfDelMulti(s, interface, addr)
strcpy(ifr.ifr_name, interface);
ifr.ifr_addr.sa_family = AF_UNSPEC;
bcopy(addr, ifr.ifr_addr.sa_data, 6);
memmove(ifr.ifr_addr.sa_data, addr, 6);
/*
* open a socket, temporarily, to use for SIOC* ioctls

View File

@ -1,4 +1,4 @@
/* $NetBSD: pf.h,v 1.2 1997/03/25 03:07:29 thorpej Exp $ */
/* $NetBSD: pf.h,v 1.3 1997/10/16 23:24:56 lukem Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -28,22 +28,13 @@
* (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.2 1997/03/25 03:07:29 thorpej Exp $
* $NetBSD: pf.h,v 1.3 1997/10/16 23:24:56 lukem Exp $
*
*/
#ifndef _PF_H_
#define _PF_H_
#ifdef NO__P
int pfTrans (/* char * */);
int pfInit (/* char *, int, u_short, int */);
int pfEthAddr (/* int, u_char * */);
int pfAddMulti (/* int, char *, char * */);
int pfDelMulti (/* int, char *, char * */);
int pfRead (/* int, u_char *, int */);
int pfWrite (/* int, u_char *, int, int */);
#else
__BEGIN_DECLS
int pfTrans __P((char *));
int pfInit __P((char *, int, u_short, int));
@ -53,6 +44,5 @@ int pfDelMulti __P((int, char *, char *));
int pfRead __P((int, u_char *, int));
int pfWrite __P((int, u_char *, int, int));
__END_DECLS
#endif
#endif _PF_H_

View File

@ -1,4 +1,4 @@
/* $NetBSD: print.c,v 1.2 1997/03/25 03:07:30 thorpej Exp $ */
/* $NetBSD: print.c,v 1.3 1997/10/16 23:24:58 lukem Exp $ */
/*
* Copyright (c) 1993-96 Mats O Jansson. All rights reserved.
@ -29,19 +29,21 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LINT
static char rcsid[] = "$NetBSD: print.c,v 1.2 1997/03/25 03:07:30 thorpej Exp $";
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: print.c,v 1.3 1997/10/16 23:24:58 lukem Exp $");
#endif
#include <sys/types.h>
#include <stdio.h>
#include "os.h"
#include "common/mopdef.h"
#include "common/nmadef.h"
#include "common/nma.h"
#include "common/cmp.h"
#include "common/get.h"
#include "cmp.h"
#include "get.h"
#include "mopdef.h"
#include "nma.h"
#include "nmadef.h"
#include "print.h"
#define SHORT_PRINT

View File

@ -1,4 +1,4 @@
/* $NetBSD: print.h,v 1.2 1997/03/25 03:07:31 thorpej Exp $ */
/* $NetBSD: print.h,v 1.3 1997/10/16 23:25:00 lukem Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -28,25 +28,13 @@
* (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.2 1997/03/25 03:07:31 thorpej Exp $
* $NetBSD: print.h,v 1.3 1997/10/16 23:25:00 lukem Exp $
*
*/
#ifndef _PRINT_H_
#define _PRINT_H_
#ifdef NO__P
void mopPrintHWA (/* FILE *, u_char * */);
void mopPrintBPTY (/* FILE *, u_char */);
void mopPrintPGTY (/* FILE *, u_char */);
void mopPrintOneline (/* FILE *, u_char *, int */);
void mopPrintHeader (/* FILE *, u_char *, int */);
void mopPrintMopHeader (/* FILE *, u_char *, int */);
void mopPrintDevice (/* FILE *, u_char */);
void mopPrintTime (/* FILE *, u_char * */);
void mopPrintInfo (/* FILE *, u_char *, int *, u_short,
u_char, int */);
#else
__BEGIN_DECLS
void mopPrintHWA __P((FILE *, u_char *));
void mopPrintBPTY __P((FILE *, u_char));
@ -59,6 +47,5 @@ void mopPrintTime __P((FILE *, u_char *));
void mopPrintInfo __P((FILE *, u_char *, int *, u_short,
u_char, int));
__END_DECLS
#endif
#endif _PRINT_H_

View File

@ -1,4 +1,4 @@
/* $NetBSD: put.c,v 1.2 1997/03/25 03:07:33 thorpej Exp $ */
/* $NetBSD: put.c,v 1.3 1997/10/16 23:25:01 lukem Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -29,19 +29,19 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LINT
static char rcsid[] = "$NetBSD: put.c,v 1.2 1997/03/25 03:07:33 thorpej Exp $";
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: put.c,v 1.3 1997/10/16 23:25:01 lukem Exp $");
#endif
#include <stddef.h>
#include <sys/types.h>
#include <time.h>
#include "common/mopdef.h"
#include "os.h"
#include "mopdef.h"
#include "put.h"
void
mopPutChar(pkt, index, value)
register u_char *pkt;
register int *index;
u_char *pkt;
int *index;
u_char value;
{
pkt[*index] = value;
@ -50,8 +50,8 @@ mopPutChar(pkt, index, value)
void
mopPutShort(pkt, index, value)
register u_char *pkt;
register int *index;
u_char *pkt;
int *index;
u_short value;
{
int i;
@ -64,9 +64,9 @@ mopPutShort(pkt, index, value)
void
mopPutLong(pkt, index, value)
register u_char *pkt;
register int *index;
u_long value;
u_char *pkt;
int *index;
u_int32_t value;
{
int i;
for (i = 0; i < 4; i++) {
@ -78,8 +78,8 @@ mopPutLong(pkt, index, value)
void
mopPutMulti(pkt, index, value, size)
register u_char *pkt,*value;
register int *index,size;
u_char *pkt,*value;
int *index,size;
{
int i;
@ -91,9 +91,9 @@ mopPutMulti(pkt, index, value, size)
void
mopPutTime(pkt, index, value)
register u_char *pkt;
register int *index;
time_t value;
u_char *pkt;
int *index;
time_t value;
{
time_t tnow;
struct tm *timenow;
@ -121,9 +121,9 @@ mopPutTime(pkt, index, value)
void
mopPutHeader(pkt, index, dst, src, proto, trans)
register u_char *pkt;
register int *index;
char dst[], src[];
u_char *pkt;
int *index;
u_char dst[], src[];
u_short proto;
int trans;
{
@ -158,7 +158,7 @@ mopPutHeader(pkt, index, dst, src, proto, trans)
void
mopPutLength(pkt, trans, len)
register u_char *pkt;
u_char *pkt;
int trans;
u_short len;
{
@ -183,6 +183,3 @@ mopPutLength(pkt, trans, len)
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: put.h,v 1.2 1997/03/25 03:07:34 thorpej Exp $ */
/* $NetBSD: put.h,v 1.3 1997/10/16 23:25:03 lukem Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -28,31 +28,21 @@
* (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.2 1997/03/25 03:07:34 thorpej Exp $
* $NetBSD: put.h,v 1.3 1997/10/16 23:25:03 lukem Exp $
*
*/
#ifndef _PUT_H_
#define _PUT_H_
#ifdef NO__P
void mopPutChar (/* u_char *, int *, u_char */);
void mopPutShort (/* u_char *, int *, u_short */);
void mopPutLong (/* u_char *, int *, u_long */);
void mopPutMulti (/* u_char *, int *, u_char *, int */);
void mopPutTime (/* u_char *, int *, time_t */);
void mopPutHeader (/* u_char *, int *, u_char *, u_char *, u_short, int */);
void mopPutLength (/* u_char *, int, u_short */);
#else
__BEGIN_DECLS
void mopPutChar __P((u_char *, int *, u_char));
void mopPutShort __P((u_char *, int *, u_short));
void mopPutLong __P((u_char *, int *, u_long));
void mopPutMulti __P((u_char *, int *, u_char *, int));
void mopPutTime __P((u_char *, int *, time_t));
void mopPutChar __P((u_char *, int *, u_char));
void mopPutShort __P((u_char *, int *, u_short));
void mopPutLong __P((u_char *, int *, u_int32_t));
void mopPutMulti __P((u_char *, int *, 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 mopPutLength __P((u_char *, int, u_short));
__END_DECLS
#endif
#endif _PUT_H_
#endif /* _PUT_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: rc.c,v 1.2 1997/03/25 03:07:35 thorpej Exp $ */
/* $NetBSD: rc.c,v 1.3 1997/10/16 23:25:04 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: rc.c,v 1.2 1997/03/25 03:07:35 thorpej Exp $";
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: rc.c,v 1.3 1997/10/16 23:25:04 lukem Exp $");
#endif
#include "os.h"
#include "common/get.h"
#include "common/print.h"
#include "common/mopdef.h"
#include "get.h"
#include "mopdef.h"
#include "print.h"
#include "rc.h"
void
mopDumpRC(fd, pkt, trans)
@ -45,7 +47,7 @@ mopDumpRC(fd, pkt, trans)
int trans;
{
int i,index = 0;
long tmpl;
int32_t tmpl;
u_char tmpc,code,control;
u_short len,tmps,moplen;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rc.h,v 1.2 1997/03/25 03:07:36 thorpej Exp $ */
/* $NetBSD: rc.h,v 1.3 1997/10/16 23:25:05 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: rc.h,v 1.2 1997/03/25 03:07:36 thorpej Exp $
* $NetBSD: rc.h,v 1.3 1997/10/16 23:25:05 lukem Exp $
*
*/
#ifndef _RC_H_
#define _RC_H_
#ifdef NO__P
void mopDumpRC (/* FILE *, u_char *, int */);
#else
__BEGIN_DECLS
void mopDumpRC __P((FILE *, u_char *, int));
__END_DECLS
#endif
#endif _RC_H_

View File

@ -1,4 +1,4 @@
.\" $NetBSD: mopa.out.1,v 1.2 1997/03/25 03:07:39 thorpej Exp $
.\" $NetBSD: mopa.out.1,v 1.3 1997/10/16 23:25:08 lukem Exp $
.\"
.\" Copyright (c) 1996 Mats O Jansson. All rights reserved.
.\"
@ -33,11 +33,11 @@
.Nm mopa.out
.Nd Create MOP image from a a.out file
.Sh SYNOPSIS
.Nm mopa.out
.Nm
.Ar infile
.Ar outfile
.Sh DESCRIPTION
.Nm mopa.out
.Nm
is used to convert an a.out file to a MOP-image.
.Pp
This program will check if
@ -46,7 +46,7 @@ machine-id is recognized. If not it will try to swap the
.Xr a.out 5
header, and try again.
.Sh BUGS
This program just supports the VAX machine-id for now.
This program only supports the VAX machine-id for now.
.Sh SEE ALSO
.Xr a.out 5 ,
.Xr mopchk 1 ,

View File

@ -1,4 +1,4 @@
/* $NetBSD: mopa.out.c,v 1.4 1997/04/17 21:09:05 christos Exp $ */
/* $NetBSD: mopa.out.c,v 1.5 1997/10/16 23:25:09 lukem Exp $ */
/* mopa.out - Convert a Unix format kernel into something that
* can be transfered via MOP.
@ -47,14 +47,15 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LINT
static char rcsid[] = "$NetBSD: mopa.out.c,v 1.4 1997/04/17 21:09:05 christos Exp $";
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: mopa.out.c,v 1.5 1997/10/16 23:25:09 lukem Exp $");
#endif
#include "os.h"
#include "common/common.h"
#include "common/mopdef.h"
#include "common/file.h"
#include "common.h"
#include "mopdef.h"
#include "file.h"
#if defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/exec_aout.h>
#endif
@ -78,22 +79,21 @@ main (int argc, char **argv)
FILE *out; /* A FILE because that is easier. */
int i;
struct dllist dl;
extern char *__progname; /* from crt0.o */
#ifdef NOAOUT
fprintf(stderr, "%s: has no function in OS/BSD\n", argv[0]);
return(1);
errx(1, "has no function in NetBSD");
#endif
if (argc != 3) {
fprintf (stderr, "usage: %s kernel-in sys-out\n", argv[0]);
fprintf (stderr, "usage: %s kernel-in sys-out\n", __progname);
return (1);
}
dl.ldfd = open (argv[1], O_RDONLY);
if (dl.ldfd == -1) {
perror (argv[1]);
return (2);
}
if (dl.ldfd == -1)
err(2, "open `%s'", argv[1]);
GetFileInfo(dl.ldfd,
&dl.loadaddr,
@ -103,16 +103,11 @@ main (int argc, char **argv)
&dl.a_data,&dl.a_data_fill,
&dl.a_bss ,&dl.a_bss_fill );
if (dl.aout == -1) {
fprintf(stderr,"s%: not an a.out file\n",argv[1]);
return (3);
}
if (dl.aout == -1)
errx(3, "`%s' is not an a.out file", argv[1]);
if (dl.aout != MID_VAX) {
fprintf(stderr,"%s: file is not a VAX image (mid=%d)\n",
argv[1],dl.aout);
return (4);
}
if (dl.aout != MID_VAX)
errx(4, "`%s' is not a VAX image (mid=%d)", argv[1], dl.aout);
i = dl.a_text + dl.a_text_fill + dl.a_data + dl.a_data_fill +
dl.a_bss + dl.a_bss_fill;
@ -132,24 +127,20 @@ main (int argc, char **argv)
mopFilePutLX(header,0xd4+ISD_W_PAGCNT,i,2);/* Imagesize in blks.*/
out = fopen (argv[2], "w");
if (!out) {
perror (argv[2]);
return (2);
}
if (!out)
err(2, "writing `%s'", argv[2]);
/* Now we do the actual work. Write VAX MOP-image header */
fwrite (header, sizeof (header), 1, out);
fprintf (stderr, "copying %lu", dl.a_text);
fprintf (stderr, "+%lu", dl.a_data);
fprintf (stderr, "+%lu", dl.a_bss);
fprintf (stderr, "->%lu", dl.xferaddr);
fprintf (stderr, "\n");
fprintf(stderr, "copying %u+%u+%u->%u\n", dl.a_text,
dl.a_data, dl.a_bss, dl.xferaddr);
while ((i = mopFileRead(&dl,header)) > 0) {
(void)fwrite(header, i, 1, out);
}
fclose (out);
return (0);
}

View File

@ -1,4 +1,4 @@
.\" $NetBSD: mopchk.1,v 1.2 1997/03/25 03:07:43 thorpej Exp $
.\" $NetBSD: mopchk.1,v 1.3 1997/10/16 23:25:11 lukem Exp $
.\"
.\" Copyright (c) 1996 Mats O Jansson. All rights reserved.
.\"
@ -33,12 +33,12 @@
.Nm mopchk
.Nd MOP Check Utility
.Sh SYNOPSIS
.Nm mopchk
.Nm
.Op Fl a
.Op Fl v
.Op Ar filename
.Sh DESCRIPTION
.Nm Mopchk
.Nm
shows information about which devices are known, version of mopd suite or
information about a MOP-image.
.Pp
@ -54,7 +54,7 @@ Show all the Ethernets attached to the system.
Show version of mopprobe.
.El
.Sh BUGS
In some implementation the same interface can occure more than once.
In some implementations the same interface can occur more than once.
.Sh SEE ALSO
.Xr mopa.out 1 ,
.Xr mopprobe 1 ,

View File

@ -1,4 +1,4 @@
/* $NetBSD: mopchk.c,v 1.5 1997/10/16 07:36:50 lukem Exp $ */
/* $NetBSD: mopchk.c,v 1.6 1997/10/16 23:25:12 lukem Exp $ */
/*
* Copyright (c) 1995-96 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: mopchk.c,v 1.5 1997/10/16 07:36:50 lukem Exp $";
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: mopchk.c,v 1.6 1997/10/16 23:25:12 lukem Exp $");
#endif
/*
@ -40,11 +41,11 @@ static char rcsid[] = "$NetBSD: mopchk.c,v 1.5 1997/10/16 07:36:50 lukem Exp $";
*/
#include "os.h"
#include "common/common.h"
#include "common/mopdef.h"
#include "common/device.h"
#include "common/pf.h"
#include "common/file.h"
#include "common.h"
#include "device.h"
#include "file.h"
#include "mopdef.h"
#include "pf.h"
/*
* The list of all interfaces that are being listened to. rarp_loop()
@ -52,21 +53,18 @@ static char rcsid[] = "$NetBSD: mopchk.c,v 1.5 1997/10/16 07:36:50 lukem Exp $";
*/
struct if_info *iflist;
#ifdef NO__P
void Usage (/* void */);
void mopProcess (/* struct if_info *, u_char * */);
#else
void Usage __P((void));
void mopProcess __P((struct if_info *, u_char *));
#endif
void Usage __P((void));
int main __P((int, char **));
void mopProcess __P((struct if_info *, u_char *));
int AllFlag = 0; /* listen on "all" interfaces */
int VersionFlag = 0; /* Show version */
int promisc = 0; /* promisc mode not needed */
char *Program;
extern char *__progname; /* from crt0.o */
extern char version[];
void
int
main(argc, argv)
int argc;
char **argv;
@ -76,18 +74,11 @@ main(argc, argv)
struct if_info *ii;
int err, aout;
if ((Program = strrchr(argv[0], '/')))
Program++;
else
Program = argv[0];
if (*Program == '-')
Program++;
/* All error reporting is done through syslogs. */
openlog(Program, LOG_PID | LOG_CONS, LOG_DAEMON);
openlog(__progname, LOG_PID | LOG_CONS, LOG_DAEMON);
opterr = 0;
while ((op = getopt(argc, argv, "av")) != EOF) {
while ((op = getopt(argc, argv, "av")) != -1) {
switch (op) {
case 'a':
AllFlag++;
@ -102,23 +93,22 @@ main(argc, argv)
}
if (VersionFlag)
printf("%s: Version %s\n",Program,version);
printf("%s: Version %s\n", __progname, version);
if (AllFlag) {
if (VersionFlag)
printf("\n");
iflist = NULL;
deviceInitAll();
if (iflist == NULL) {
if (iflist == NULL)
printf("No interface\n");
} else {
else {
printf("Interface Address\n");
for (ii = iflist; ii; ii = ii->next) {
for (ii = iflist; ii; ii = ii->next)
printf("%-9s %x:%x:%x:%x:%x:%x\n",
ii->if_name,
ii->eaddr[0],ii->eaddr[1],ii->eaddr[2],
ii->eaddr[3],ii->eaddr[4],ii->eaddr[5]);
}
ii->if_name, ii->eaddr[0], ii->eaddr[1],
ii->eaddr[2], ii->eaddr[3], ii->eaddr[4],
ii->eaddr[5]);
}
}
@ -131,42 +121,43 @@ main(argc, argv)
if (i) printf("\n");
i++;
filename = argv[optind++];
printf("Checking: %s\n",filename);
printf("Checking: %s\n", filename);
fd = open(filename, O_RDONLY, 0);
if (fd == -1) {
if (fd == -1)
printf("Unknown file.\n");
} else {
else {
err = CheckAOutFile(fd);
if (err == 0) {
if (GetAOutFileInfo(fd, 0, 0, 0, 0,
0, 0, 0, 0, &aout) < 0) {
printf("Some failure in GetAOutFileInfo\n");
printf(
"Some failure in GetAOutFileInfo\n");
aout = -1;
}
} else {
} else
aout = -1;
}
if (aout == -1)
err = CheckMopFile(fd);
if (aout == -1 && err == 0) {
if (GetMopFileInfo(fd, 0, 0) < 0) {
printf("Some failure in GetMopFileInfo\n");
}
};
if (aout == -1 && err == 0)
if (GetMopFileInfo(fd, 0, 0) < 0)
printf(
"Some failure in GetMopFileInfo\n");
}
}
return (0);
}
void
Usage()
{
(void) fprintf(stderr, "usage: %d [-a] [-v] [filename...]\n",Program);
(void) fprintf(stderr, "usage: %s [-a] [-v] [filename...]\n",
__progname);
exit(1);
}
/*
* Process incomming packages, NOT.
* Process incomming packages.
* Doesn't actually do anything for mopchk(1)
*/
void
mopProcess(ii, pkt)
@ -174,4 +165,3 @@ mopProcess(ii, pkt)
u_char *pkt;
{
}

View File

@ -1,4 +1,4 @@
.\" $NetBSD: mopd.8,v 1.2 1997/03/25 03:07:48 thorpej Exp $
.\" $NetBSD: mopd.8,v 1.3 1997/10/16 23:25:16 lukem Exp $
.\"
.\" Copyright (c) 1993-96 Mats O Jansson. All rights reserved.
.\"
@ -33,25 +33,25 @@
.Nm mopd
.Nd MOP Loader Daemon
.Sh SYNOPSIS
.Nm mopd
.Nm
.Op Fl adf
.Op Ar interface
.Sh DESCRIPTION
.Nm Mopd
.Nm
services MOP Load requests on the Ethernet connected to
.Ar interface
or all interfaces if
.Sq Fl a
is given.
In a load request received by
.Nm mopd
.Nm
a filename can be given. This is the normal case for e.g. terminal servers.
If a filename isn't given
.Nm mopd
.Nm
must know what image to load.
.Pp
Upon receiving a request,
.Nm mopd
.Nm
checks if the requested file exists in
.Pa /tftpboot/mop ,
the filename is normaly uppercase and with an extension of
@ -61,14 +61,14 @@ filename, e.g.
.Pa 08002b09f4de.SYS
and it might be a soft link to another file.
.Pp
.Nm Mopd
.Nm
supports two kinds of files. The first type that is check is if the file is
in
.Xr a.out 5
format. If not, a couple of Digital's formats are checked.
.Pp
In normal operation,
.Nm mopd
.Nm
forks a copy of itself and runs in
the background. Anomalies and errors are reported via
.Xr syslog 3 .
@ -85,9 +85,6 @@ the foreground.
.It Fl f
Run in the foreground.
.El
.Sh BUGS
.Xr a.out 5
isn't supported yet non bsd implementations (otherOS).
.Sh FILES
.Bl -tag -width Pa -compact
.It Pa /tftpboot/mop

View File

@ -1,4 +1,4 @@
/* $NetBSD: mopd.c,v 1.4 1997/04/17 21:09:19 christos Exp $ */
/* $NetBSD: mopd.c,v 1.5 1997/10/16 23:25:17 lukem Exp $ */
/*
* Copyright (c) 1993-96 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: mopd.c,v 1.4 1997/04/17 21:09:19 christos Exp $";
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: mopd.c,v 1.5 1997/10/16 23:25:17 lukem Exp $");
#endif
/*
@ -41,16 +42,16 @@ static char rcsid[] = "$NetBSD: mopd.c,v 1.4 1997/04/17 21:09:19 christos Exp $"
*/
#include "os.h"
#include "common/common.h"
#include "common/mopdef.h"
#include "common/device.h"
#include "common/print.h"
#include "common/pf.h"
#include "common/cmp.h"
#include "common/get.h"
#include "common/dl.h"
#include "common/rc.h"
#include "cmp.h"
#include "common.h"
#include "device.h"
#include "dl.h"
#include "get.h"
#include "mopdef.h"
#include "pf.h"
#include "print.h"
#include "process.h"
#include "rc.h"
/*
* The list of all interfaces that are being listened to.
@ -58,15 +59,9 @@ static char rcsid[] = "$NetBSD: mopd.c,v 1.4 1997/04/17 21:09:19 christos Exp $"
*/
struct if_info *iflist;
#ifdef NO__P
void Loop (/* void */);
void Usage (/* void */);
void mopProcess (/* struct if_info *, u_char * */);
#else
void Loop __P((void));
void Usage __P((void));
void mopProcess __P((struct if_info *, u_char *));
#endif
void Usage __P((void));
int main __P((int, char **));
void mopProcess __P((struct if_info *, u_char *));
int AllFlag = 0; /* listen on "all" interfaces */
int DebugFlag = 0; /* print debugging messages */
@ -75,28 +70,20 @@ int VersionFlag = 0; /* print version */
int Not3Flag = 0; /* Not MOP V3 messages. */
int Not4Flag = 0; /* Not MOP V4 messages. */
int promisc = 1; /* Need promisc mode */
char *Program;
void
extern char *__progname; /* from crt0.o */
int
main(argc, argv)
int argc;
char **argv;
{
int c, pid, devnull, f;
int c, pid;
char *interface;
extern int optind;
extern char version[];
if ((Program = strrchr(argv[0], '/')))
Program++;
else
Program = argv[0];
if (*Program == '-')
Program++;
while ((c = getopt(argc, argv, "34adfv")) != EOF)
while ((c = getopt(argc, argv, "34adfv")) != -1)
switch (c) {
case '3':
Not3Flag++;
@ -122,7 +109,7 @@ main(argc, argv)
}
if (VersionFlag) {
fprintf(stdout,"%s: version %s\n", Program, version);
fprintf(stdout,"%s: version %s\n", __progname, version);
exit(0);
}
@ -135,16 +122,13 @@ main(argc, argv)
Usage();
/* All error reporting is done through syslogs. */
openlog(Program, LOG_PID | LOG_CONS, LOG_DAEMON);
openlog(__progname, LOG_PID | LOG_CONS, LOG_DAEMON);
if ((!ForegroundFlag) && DebugFlag) {
if ((!ForegroundFlag) && DebugFlag)
fprintf(stdout,
"%s: not running as daemon, -d given.\n",
Program);
}
"%s: not running as daemon, -d given.\n", __progname);
if ((!ForegroundFlag) && (!DebugFlag)) {
pid = fork();
if (pid > 0)
/* Parent exits, leaving child in background. */
@ -156,32 +140,10 @@ main(argc, argv)
}
/* Fade into the background */
f = open("/dev/tty", O_RDWR);
if (f >= 0) {
if (ioctl(f, TIOCNOTTY, 0) < 0) {
syslog(LOG_ERR, "TIOCNOTTY: %m");
exit(0);
}
(void) close(f);
}
(void) chdir("/");
#ifdef SETPGRP_NOPARAM
(void) setpgrp();
#else
(void) setpgrp(0, getpid());
#endif
devnull = open("/dev/null", O_RDWR);
if (devnull >= 0) {
(void) dup2(devnull, 0);
(void) dup2(devnull, 1);
(void) dup2(devnull, 2);
if (devnull > 2)
(void) close(devnull);
}
daemon(0, 0);
}
syslog(LOG_INFO, "%s %s started.", Program, version);
syslog(LOG_INFO, "%s %s started.", __progname, version);
if (AllFlag)
deviceInitAll();
@ -189,13 +151,17 @@ main(argc, argv)
deviceInitOne(interface);
Loop();
/* NOTREACHED */
return (0);
}
void
Usage()
{
(void) fprintf(stderr, "usage: %s -a [ -d -f -v ] [ -3 | -4 ]\n",Program);
(void) fprintf(stderr, " %s [ -d -f -v ] [ -3 | -4 ] interface\n",Program);
(void) fprintf(stderr, "usage: %s -a [ -d -f -v ] [ -3 | -4 ]\n",
__progname);
(void) fprintf(stderr, " %s [ -d -f -v ] [ -3 | -4 ] interface\n",
__progname);
exit(1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: process.c,v 1.4 1997/04/17 21:09:21 christos Exp $ */
/* $NetBSD: process.c,v 1.5 1997/10/16 23:25:19 lukem Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -29,22 +29,23 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LINT
static char rcsid[] = "$NetBSD: process.c,v 1.4 1997/04/17 21:09:21 christos Exp $";
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: process.c,v 1.5 1997/10/16 23:25:19 lukem Exp $");
#endif
#include "os.h"
#include "common/common.h"
#include "common/mopdef.h"
#include "common/nmadef.h"
#include "common/get.h"
#include "common/put.h"
#include "common/print.h"
#include "common/pf.h"
#include "common/cmp.h"
#include "common/dl.h"
#include "common/rc.h"
#include "common/file.h"
#include "cmp.h"
#include "common.h"
#include "dl.h"
#include "file.h"
#include "get.h"
#include "mopdef.h"
#include "nmadef.h"
#include "pf.h"
#include "print.h"
#include "put.h"
#include "rc.h"
extern u_char buf[];
extern int DebugFlag;
@ -53,12 +54,22 @@ struct dllist dllist[MAXDL]; /* dump/load list */
extern char dl_mcst[]; /* Dump/Load Multicast */
extern char rc_mcst[]; /* Remote Console Multicast */
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
mopProcessInfo(pkt,index,moplen,dl_rpr,trans)
mopProcessInfo(pkt, index, moplen, dl_rpr, trans)
u_char *pkt;
int *index, trans;
int *index;
u_short moplen;
struct dllist *dl_rpr;
int trans;
{
u_short itype,tmps;
u_char ilen ,tmpc,device;
@ -235,8 +246,8 @@ mopStartLoad(dst, src, dl_rpr, trans)
if (dllist[i].status == DL_STATUS_FREE) {
if (slot == -1) {
slot = i;
bcopy((char *)dst,
(char *)dllist[i].eaddr, 6);
memmove((char *)dst,
(char *)dllist[i].eaddr, 6);
}
}
}
@ -432,8 +443,10 @@ void
mopProcessDL(fd, ii, pkt, index, dst, src, trans, len)
FILE *fd;
struct if_info *ii;
u_char *pkt, *dst, *src;
int *index, trans;
u_char *pkt;
int *index;
u_char *dst, *src;
int trans;
u_short len;
{
u_char tmpc;
@ -508,9 +521,9 @@ mopProcessDL(fd, ii, pkt, index, dst, src, trans, len)
iindex = *index;
dl_rpr = &dl;
bzero(dl_rpr,sizeof(*dl_rpr));
memset(dl_rpr, 0, sizeof(*dl_rpr));
dl_rpr->ii = ii;
bcopy((char *)src, (char *)(dl_rpr->eaddr), 6);
memmove((char *)(dl_rpr->eaddr), (char *)src, 6);
mopProcessInfo(pkt,index,moplen,dl_rpr,trans);
sprintf(filename,"%s/%s.SYS", MOP_FILE_PATH, pfile);
@ -570,8 +583,10 @@ void
mopProcessRC(fd, ii, pkt, index, dst, src, trans, len)
FILE *fd;
struct if_info *ii;
u_char *pkt, *dst, *src;
int *index, trans;
u_char *pkt;
int *index;
u_char *dst, *src;
int trans;
u_short len;
{
u_char tmpc;
@ -614,9 +629,9 @@ mopProcessRC(fd, ii, pkt, index, dst, src, trans, len)
}
dl_rpr = &dl;
bzero(dl_rpr,sizeof(*dl_rpr));
memset(dl_rpr, 0, sizeof(*dl_rpr));
dl_rpr->ii = ii;
bcopy((char *)src, (char *)(dl_rpr->eaddr), 6);
memmove((char *)(dl_rpr->eaddr), (char *)src, 6);
mopProcessInfo(pkt,index,moplen,dl_rpr,trans);
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: process.h,v 1.2 1997/03/25 03:07:52 thorpej Exp $ */
/* $NetBSD: process.h,v 1.3 1997/10/16 23:25:21 lukem Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -28,25 +28,18 @@
* (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.2 1997/03/25 03:07:52 thorpej Exp $
* $NetBSD: process.h,v 1.3 1997/10/16 23:25:21 lukem Exp $
*
*/
#ifndef _PROCESS_H_
#define _PROCESS_H_
#ifdef NO__P
void mopProcessDL (/* FILE *, struct if_info *, u_char *, int *,
u_char *, u_char *, int, u_short */);
void mopProcessRC (/* FILE *, struct if_info *, u_char *, int *,
u_char *, u_char *, int, u_short */);
#else
__BEGIN_DECLS
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));
__END_DECLS
#endif
#endif _PROCESS_H_

View File

@ -1,4 +1,4 @@
.\" $NetBSD: mopprobe.1,v 1.2 1997/03/25 03:07:56 thorpej Exp $
.\" $NetBSD: mopprobe.1,v 1.3 1997/10/16 23:25:23 lukem Exp $
.\"
.\" Copyright (c) 1996 Mats O Jansson. All rights reserved.
.\"
@ -33,15 +33,14 @@
.Nm mopprobe
.Nd MOP Probe Utility
.Sh SYNOPSIS
.Nm mopprobe
.Nm
.Fl a
.Op Fl 3 | 4
.Pp
.Nm mopprobe
.Nm ""
.Op Fl 3 | 4
.Ar interface
.Sh DESCRIPTION
.Nm Mopprobe
.Nm
prints the ethernet address and nodename of MOP SID message on the Ethernet
connected to
.Ar interface

View File

@ -1,4 +1,4 @@
/* $NetBSD: mopprobe.c,v 1.4 1997/04/17 21:09:27 christos Exp $ */
/* $NetBSD: mopprobe.c,v 1.5 1997/10/16 23:25:24 lukem Exp $ */
/*
* Copyright (c) 1993-96 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: mopprobe.c,v 1.4 1997/04/17 21:09:27 christos Exp $";
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: mopprobe.c,v 1.5 1997/10/16 23:25:24 lukem Exp $");
#endif
/*
@ -41,14 +42,14 @@ static char rcsid[] = "$NetBSD: mopprobe.c,v 1.4 1997/04/17 21:09:27 christos Ex
*/
#include "os.h"
#include "common/common.h"
#include "common/mopdef.h"
#include "common/device.h"
#include "common/print.h"
#include "common/get.h"
#include "common/cmp.h"
#include "common/pf.h"
#include "common/nmadef.h"
#include "cmp.h"
#include "common.h"
#include "device.h"
#include "get.h"
#include "mopdef.h"
#include "nmadef.h"
#include "pf.h"
#include "print.h"
/*
* The list of all interfaces that are being listened to. rarp_loop()
@ -56,15 +57,9 @@ static char rcsid[] = "$NetBSD: mopprobe.c,v 1.4 1997/04/17 21:09:27 christos Ex
*/
struct if_info *iflist;
#ifdef NO__P
void Loop (/* void */);
void Usage (/* void */);
void mopProcess (/* struct if_info *, u_char * */);
#else
void Loop __P((void));
void Usage __P((void));
void mopProcess __P((struct if_info *, u_char *));
#endif
void Usage __P((void));
int main __P((int, char **));
void mopProcess __P((struct if_info *, u_char *));
int AllFlag = 0; /* listen on "all" interfaces */
int DebugFlag = 0; /* print debugging messages */
@ -72,9 +67,10 @@ int Not3Flag = 0; /* Not MOP V3 messages */
int Not4Flag = 0; /* Not MOP V4 messages */
int oflag = 0; /* print only once */
int promisc = 1; /* Need promisc mode */
char *Program;
void
extern char *__progname; /* from crt0.o */
int
main(argc, argv)
int argc;
char **argv;
@ -82,20 +78,11 @@ main(argc, argv)
int op;
char *interface;
extern int optind, opterr;
if ((Program = strrchr(argv[0], '/')))
Program++;
else
Program = argv[0];
if (*Program == '-')
Program++;
/* All error reporting is done through syslogs. */
openlog(Program, LOG_PID | LOG_CONS, LOG_DAEMON);
openlog(__progname, LOG_PID | LOG_CONS, LOG_DAEMON);
opterr = 0;
while ((op = getopt(argc, argv, "ado")) != EOF) {
while ((op = getopt(argc, argv, "ado")) != -1) {
switch (op) {
case '3':
Not3Flag++;
@ -131,13 +118,15 @@ main(argc, argv)
deviceInitOne(interface);
Loop();
/* NOTREACHED */
return (0);
}
void
Usage()
{
(void) fprintf(stderr, "usage: %s -a [ -3 | -4 ]\n",Program);
(void) fprintf(stderr, " %s [ -3 | -4 ] interface\n",Program);
(void) fprintf(stderr, "usage: %s -a [ -3 | -4 ]\n", __progname);
(void) fprintf(stderr, " %s [ -3 | -4 ] interface\n", __progname);
exit(1);
}

View File

@ -1,4 +1,4 @@
.\" $NetBSD: moptrace.1,v 1.2 1997/03/25 03:08:00 thorpej Exp $
.\" $NetBSD: moptrace.1,v 1.3 1997/10/16 23:25:26 lukem Exp $
.\"
.\" Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
.\"
@ -27,7 +27,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.
.\"
.\" @(#) $Id: moptrace.1,v 1.2 1997/03/25 03:08:00 thorpej Exp $
.\" @(#) $Id: moptrace.1,v 1.3 1997/10/16 23:25:26 lukem Exp $
.\"
.Dd October 2, 1995
.Dt MOPTRACE 1
@ -35,17 +35,16 @@
.Nm moptrace
.Nd MOP Trace Utility
.Sh SYNOPSIS
.Nm moptrace
.Nm
.Op Fl a
.Op Fl d
.Op Fl 3 | 4
.Pp
.Nm moptrace
.Nm ""
.Op Fl d
.Op Fl 3 | 4
.Op Ar interface
.Sh DESCRIPTION
.Nm Moptrace
.Nm
prints the contence of MOP packages on the Ethernet connected to
.Ar interface
or all known interfaces if

View File

@ -1,4 +1,4 @@
/* $NetBSD: moptrace.c,v 1.4 1997/04/17 21:09:33 christos Exp $ */
/* $NetBSD: moptrace.c,v 1.5 1997/10/16 23:25:28 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: moptrace.c,v 1.4 1997/04/17 21:09:33 christos Exp $";
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: moptrace.c,v 1.5 1997/10/16 23:25:28 lukem Exp $");
#endif
/*
@ -41,14 +42,14 @@ static char rcsid[] = "$NetBSD: moptrace.c,v 1.4 1997/04/17 21:09:33 christos Ex
*/
#include "os.h"
#include "common/common.h"
#include "common/mopdef.h"
#include "common/device.h"
#include "common/print.h"
#include "common/pf.h"
#include "common/dl.h"
#include "common/rc.h"
#include "common/get.h"
#include "common.h"
#include "device.h"
#include "dl.h"
#include "get.h"
#include "mopdef.h"
#include "pf.h"
#include "print.h"
#include "rc.h"
/*
* The list of all interfaces that are being listened to.
@ -56,24 +57,19 @@ static char rcsid[] = "$NetBSD: moptrace.c,v 1.4 1997/04/17 21:09:33 christos Ex
*/
struct if_info *iflist;
#ifdef NO__P
void Loop (/* void */);
void Usage (/* void */);
void mopProcess (/* struct if_info *, u_char * */);
#else
void Loop __P((void));
void Usage __P((void));
void mopProcess __P((struct if_info *, u_char *));
#endif
void Usage __P((void));
int main __P((int, char **));
void mopProcess __P((struct if_info *, u_char *));
int AllFlag = 0; /* listen on "all" interfaces */
int DebugFlag = 0; /* print debugging messages */
int Not3Flag = 0; /* Ignore MOP V3 messages */
int Not4Flag = 0; /* Ignore MOP V4 messages */
int promisc = 1; /* Need promisc mode */
char *Program;
void
extern char *__progname; /* from crt0.o */
int
main(argc, argv)
int argc;
char **argv;
@ -81,21 +77,11 @@ main(argc, argv)
int op;
char *interface;
extern int optind, opterr;
if ((Program = strrchr(argv[0], '/')))
Program++;
else
Program = argv[0];
if (*Program == '-')
Program++;
/* All error reporting is done through syslogs. */
openlog(Program, LOG_PID | LOG_CONS, LOG_DAEMON);
openlog(__progname, LOG_PID | LOG_CONS, LOG_DAEMON);
opterr = 0;
while ((op = getopt(argc, argv, "34ad")) != EOF) {
while ((op = getopt(argc, argv, "34ad")) != -1) {
switch (op) {
case '3':
Not3Flag++;
@ -128,14 +114,16 @@ main(argc, argv)
deviceInitOne(interface);
Loop();
/* NOTREACHED */
return (0);
}
void
Usage()
{
(void) fprintf(stderr, "usage: %s -a [ -d ] [ -3 | -4 ]\n",Program);
(void) fprintf(stderr, "usage: %s -a [ -d ] [ -3 | -4 ]\n", __progname);
(void) fprintf(stderr, " %s [ -d ] [ -3 | -4 ] interface\n",
Program);
__progname);
exit(1);
}
@ -167,5 +155,3 @@ mopProcess(ii, pkt)
fprintf(stdout, "\n");
fflush(stdout);
}