diff options
author | Moritz Jodeit <moritz@cvs.openbsd.org> | 2006-03-13 19:05:57 +0000 |
---|---|---|
committer | Moritz Jodeit <moritz@cvs.openbsd.org> | 2006-03-13 19:05:57 +0000 |
commit | 93e999e18eeac8fc2bf2335d97c04180a8dd8a10 (patch) | |
tree | dc1815ffa14f28f41399afafa251f0ec38eef56b /usr.sbin/tcpdump | |
parent | 1b59c0ec0f05a3fc80ab596f35d1b6f1c86ae444 (diff) |
Simplify error() and warning() a bit. From Alexey Dobriyan.
ok jaredy@ otto@
Diffstat (limited to 'usr.sbin/tcpdump')
-rw-r--r-- | usr.sbin/tcpdump/tcpdump.c | 6 | ||||
-rw-r--r-- | usr.sbin/tcpdump/util.c | 16 |
2 files changed, 7 insertions, 15 deletions
diff --git a/usr.sbin/tcpdump/tcpdump.c b/usr.sbin/tcpdump/tcpdump.c index d0fc74234fb..b3520aecc1a 100644 --- a/usr.sbin/tcpdump/tcpdump.c +++ b/usr.sbin/tcpdump/tcpdump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcpdump.c,v 1.49 2006/02/15 20:34:23 otto Exp $ */ +/* $OpenBSD: tcpdump.c,v 1.50 2006/03/13 19:05:56 moritz Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -26,7 +26,7 @@ static const char copyright[] = "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997\n\ The Regents of the University of California. All rights reserved.\n"; static const char rcsid[] = - "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/tcpdump.c,v 1.49 2006/02/15 20:34:23 otto Exp $ (LBL)"; + "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/tcpdump.c,v 1.50 2006/03/13 19:05:56 moritz Exp $ (LBL)"; #endif /* @@ -195,7 +195,7 @@ pcap_list_linktypes(pcap_t *p) err(1, "BIOCGDLTLIST"); if (dl.bfl_len > MAXDLT) - error("Invalid number of linktypes: %u\n", dl.bfl_len); + error("Invalid number of linktypes: %u", dl.bfl_len); fprintf(stderr, "%d link type%s supported:\n", dl.bfl_len, dl.bfl_len == 1 ? "" : "s"); diff --git a/usr.sbin/tcpdump/util.c b/usr.sbin/tcpdump/util.c index 759272f6e20..5348fd1e85e 100644 --- a/usr.sbin/tcpdump/util.c +++ b/usr.sbin/tcpdump/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.19 2005/03/07 16:13:38 reyk Exp $ */ +/* $OpenBSD: util.c,v 1.20 2006/03/13 19:05:56 moritz Exp $ */ /* * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997 @@ -23,7 +23,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/util.c,v 1.19 2005/03/07 16:13:38 reyk Exp $ (LBL)"; + "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/util.c,v 1.20 2006/03/13 19:05:56 moritz Exp $ (LBL)"; #endif #include <sys/types.h> @@ -217,11 +217,7 @@ error(const char *fmt, ...) va_start(ap, fmt); (void)vfprintf(stderr, fmt, ap); va_end(ap); - if (*fmt) { - fmt += strlen(fmt); - if (fmt[-1] != '\n') - (void)fputc('\n', stderr); - } + (void)fputc('\n', stderr); exit(1); /* NOTREACHED */ } @@ -236,11 +232,7 @@ warning(const char *fmt, ...) va_start(ap, fmt); (void)vfprintf(stderr, fmt, ap); va_end(ap); - if (*fmt) { - fmt += strlen(fmt); - if (fmt[-1] != '\n') - (void)fputc('\n', stderr); - } + (void)fputc('\n', stderr); } |