diff options
author | Mats O Jansson <maja@cvs.openbsd.org> | 2006-04-17 10:30:32 +0000 |
---|---|---|
committer | Mats O Jansson <maja@cvs.openbsd.org> | 2006-04-17 10:30:32 +0000 |
commit | 0e03d3dfb6a2be983878e46762b62fe6226a2a85 (patch) | |
tree | 8c42a4f2fc905cf4e93e26775c038239d640df6b /usr.sbin/mopd/mopchk | |
parent | c659dee1c3055661c38caf69bd302decec5f94d6 (diff) |
Only show a interface once. Some cleanup and silence lint. -moj
Diffstat (limited to 'usr.sbin/mopd/mopchk')
-rw-r--r-- | usr.sbin/mopd/mopchk/mopchk.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/usr.sbin/mopd/mopchk/mopchk.c b/usr.sbin/mopd/mopchk/mopchk.c index 0fb931af25d..883270a0952 100644 --- a/usr.sbin/mopd/mopchk/mopchk.c +++ b/usr.sbin/mopd/mopchk/mopchk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mopchk.c,v 1.10 2003/12/01 00:56:51 avsm Exp $ */ +/* $OpenBSD: mopchk.c,v 1.11 2006/04/17 10:30:31 maja Exp $ */ /* * Copyright (c) 1995-96 Mats O Jansson. All rights reserved. @@ -24,8 +24,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef LINT -static const char rcsid[] = "$OpenBSD: mopchk.c,v 1.10 2003/12/01 00:56:51 avsm Exp $"; +#ifndef lint +static const char rcsid[] = "$OpenBSD: mopchk.c,v 1.11 2006/04/17 10:30:31 maja Exp $"; #endif /* @@ -53,7 +53,7 @@ void mopProcess(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; extern char version[]; int @@ -62,21 +62,12 @@ main(argc, argv) char **argv; { int op, i, fd; - char *filename; + char *filename, *p; struct if_info *ii; int err, aout; - 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, "av")) != -1) { @@ -94,7 +85,7 @@ main(argc, argv) } if (VersionFlag) - printf("%s: Version %s\n",Program,version); + printf("%s: Version %s\n", __progname, version); if (AllFlag) { if (VersionFlag) @@ -105,11 +96,17 @@ main(argc, argv) printf("No interface\n"); } else { printf("Interface Address\n"); + p = NULL; for (ii = iflist; ii; ii = ii->next) { + if (p != NULL) { + if (strcmp(p,ii->if_name) == 0) + continue; + } 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]); + p = ii->if_name; } } } @@ -153,13 +150,14 @@ main(argc, argv) void Usage() { - (void) fprintf(stderr, "usage: %s [-a] [-v] [filename...]\n",Program); + fprintf(stderr, "usage: %s [-a] [-v] [filename...]\n", __progname); exit(1); } /* * Process incomming packages, NOT. */ +/* ARGSUSED */ void mopProcess(ii, pkt) struct if_info *ii; |