summaryrefslogtreecommitdiffstats
path: root/usr.sbin/mopd
diff options
context:
space:
mode:
authormaja <maja@openbsd.org>2006-04-17 10:30:31 +0000
committermaja <maja@openbsd.org>2006-04-17 10:30:31 +0000
commit4110cbab8be1c0bb4107b7efd3d9df1345ccc6ab (patch)
treec6cbf4e00715c3e15e4c543a29f7c105010fefd3 /usr.sbin/mopd
parentIf there is a timeout while writing to the PHY in (diff)
downloadwireguard-openbsd-4110cbab8be1c0bb4107b7efd3d9df1345ccc6ab.tar.xz
wireguard-openbsd-4110cbab8be1c0bb4107b7efd3d9df1345ccc6ab.zip
Only show a interface once. Some cleanup and silence lint. -moj
Diffstat (limited to 'usr.sbin/mopd')
-rw-r--r--usr.sbin/mopd/mopchk/mopchk.c32
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;