aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-11-20 19:27:14 -0500
committerMike Frysinger <vapier@gentoo.org>2011-11-20 19:46:38 -0500
commit46cd57a736c30bafd41406781e7b1c6532e6a97d (patch)
tree8a760a169b7fadaec8be60d4067c7dc90d3b4e76
parentpull in stdlib.h for malloc() prototype (diff)
downloadnet-tools-46cd57a736c30bafd41406781e7b1c6532e6a97d.tar.gz
net-tools-46cd57a736c30bafd41406781e7b1c6532e6a97d.tar.bz2
net-tools-46cd57a736c30bafd41406781e7b1c6532e6a97d.zip
fix up unused variable warnings
Some of these are unused, so drop them. Others are only used in debug code, so refactor those so things are always compiled. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r--lib/arcnet.c32
-rw-r--r--lib/ax25.c27
-rw-r--r--lib/ether.c32
-rw-r--r--lib/eui64.c37
-rw-r--r--lib/fddi.c32
-rw-r--r--lib/hippi.c32
-rw-r--r--lib/ib.c10
-rw-r--r--lib/inet6_gr.c8
-rw-r--r--lib/ipx.c2
-rw-r--r--lib/netrom.c27
-rw-r--r--lib/rose.c11
-rw-r--r--lib/tr.c32
12 files changed, 127 insertions, 155 deletions
diff --git a/lib/arcnet.c b/lib/arcnet.c
index 35a2b9a..10b59e5 100644
--- a/lib/arcnet.c
+++ b/lib/arcnet.c
@@ -43,6 +43,11 @@ static const char *pr_arcnet(const char *ptr)
return (buff);
}
+#ifdef DEBUG
+#define _DEBUG 1
+#else
+#define _DEBUG 0
+#endif
/* Input an ARCnet address and convert to binary. */
static int in_arcnet(char *bufp, struct sockaddr *sap)
@@ -66,9 +71,8 @@ static int in_arcnet(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val = c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_arcnet(%s): invalid arcnet address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_arcnet(%s): invalid arcnet address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -81,9 +85,8 @@ static int in_arcnet(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val |= c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_arcnet(%s): invalid arcnet address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_arcnet(%s): invalid arcnet address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -92,28 +95,21 @@ static int in_arcnet(char *bufp, struct sockaddr *sap)
/* We might get a semicolon here - not required. */
if (*bufp == ':') {
- if (i == ETH_ALEN) {
-#ifdef DEBUG
+ if (_DEBUG && i == ETH_ALEN)
fprintf(stderr, _("in_arcnet(%s): trailing : ignored!\n"),
- orig)
-#endif
- ; /* nothing */
- }
+ orig);
bufp++;
}
}
/* That's it. Any trailing junk? */
- if ((i == ETH_ALEN) && (*bufp != '\0')) {
-#ifdef DEBUG
+ if (_DEBUG && (i == ETH_ALEN) && (*bufp != '\0')) {
fprintf(stderr, _("in_arcnet(%s): trailing junk!\n"), orig);
errno = EINVAL;
return (-1);
-#endif
}
-#ifdef DEBUG
- fprintf(stderr, "in_arcnet(%s): %s\n", orig, pr_arcnet(sap->sa_data));
-#endif
+ if (_DEBUG)
+ fprintf(stderr, "in_arcnet(%s): %s\n", orig, pr_arcnet(sap->sa_data));
return (0);
}
diff --git a/lib/ax25.c b/lib/ax25.c
index 209e479..afc035b 100644
--- a/lib/ax25.c
+++ b/lib/ax25.c
@@ -76,6 +76,11 @@ static const char *
return (AX25_print(((struct sockaddr_ax25 *) sap)->sax25_call.ax25_call));
}
+#ifdef DEBUG
+#define _DEBUG 1
+#else
+#define _DEBUG 0
+#endif
static int AX25_input(int type, char *bufp, struct sockaddr *sap)
{
@@ -95,9 +100,8 @@ static int AX25_input(int type, char *bufp, struct sockaddr *sap)
c = toupper(c);
if (!(isupper(c) || isdigit(c))) {
safe_strncpy(AX25_errmsg, _("Invalid callsign"), sizeof(AX25_errmsg));
-#ifdef DEBUG
- fprintf(stderr, "ax25_input(%s): %s !\n", AX25_errmsg, orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, "ax25_input(%s): %s !\n", AX25_errmsg, orig);
errno = EINVAL;
return (-1);
}
@@ -108,9 +112,8 @@ static int AX25_input(int type, char *bufp, struct sockaddr *sap)
/* Callsign too long? */
if ((i == 6) && (*bufp != '-') && (*bufp != '\0')) {
strcpy(AX25_errmsg, _("Callsign too long"));
-#ifdef DEBUG
- fprintf(stderr, "ax25_input(%s): %s !\n", AX25_errmsg, orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, "ax25_input(%s): %s !\n", AX25_errmsg, orig);
errno = E2BIG;
return (-1);
}
@@ -128,12 +131,12 @@ static int AX25_input(int type, char *bufp, struct sockaddr *sap)
}
/* All done. */
-#ifdef DEBUG
- fprintf(stderr, "ax25_input(%s): ", orig);
- for (i = 0; i < sizeof(ax25_address); i++)
- fprintf(stderr, "%02X ", sap->sa_data[i] & 0377);
- fprintf(stderr, "\n");
-#endif
+ if (_DEBUG) {
+ fprintf(stderr, "ax25_input(%s): ", orig);
+ for (i = 0; i < sizeof(ax25_address); i++)
+ fprintf(stderr, "%02X ", sap->sa_data[i] & 0377);
+ fprintf(stderr, "\n");
+ }
return (0);
}
diff --git a/lib/ether.c b/lib/ether.c
index ddd1598..9bf8a55 100644
--- a/lib/ether.c
+++ b/lib/ether.c
@@ -46,6 +46,11 @@ static const char *pr_ether(const char *ptr)
return (buff);
}
+#ifdef DEBUG
+#define _DEBUG 1
+#else
+#define _DEBUG 0
+#endif
/* Input an Ethernet address and convert to binary. */
static int in_ether(char *bufp, struct sockaddr *sap)
@@ -70,9 +75,8 @@ static int in_ether(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val = c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_ether(%s): invalid ether address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_ether(%s): invalid ether address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -87,9 +91,8 @@ static int in_ether(char *bufp, struct sockaddr *sap)
else if (c == ':' || c == 0)
val >>= 4;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_ether(%s): invalid ether address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_ether(%s): invalid ether address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -100,28 +103,21 @@ static int in_ether(char *bufp, struct sockaddr *sap)
/* We might get a semicolon here - not required. */
if (*bufp == ':') {
- if (i == ETH_ALEN) {
-#ifdef DEBUG
+ if (_DEBUG && i == ETH_ALEN)
fprintf(stderr, _("in_ether(%s): trailing : ignored!\n"),
- orig)
-#endif
- ; /* nothing */
- }
+ orig);
bufp++;
}
}
/* That's it. Any trailing junk? */
- if ((i == ETH_ALEN) && (*bufp != '\0')) {
-#ifdef DEBUG
+ if (_DEBUG && (i == ETH_ALEN) && (*bufp != '\0')) {
fprintf(stderr, _("in_ether(%s): trailing junk!\n"), orig);
errno = EINVAL;
return (-1);
-#endif
}
-#ifdef DEBUG
- fprintf(stderr, "in_ether(%s): %s\n", orig, pr_ether(sap->sa_data));
-#endif
+ if (_DEBUG)
+ fprintf(stderr, "in_ether(%s): %s\n", orig, pr_ether(sap->sa_data));
return (0);
}
diff --git a/lib/eui64.c b/lib/eui64.c
index 6ab7d26..32822a3 100644
--- a/lib/eui64.c
+++ b/lib/eui64.c
@@ -60,6 +60,12 @@ static const char *pr_eui64(const char *ptr)
return (buff);
}
+#ifdef DEBUG
+#define _DEBUG 1
+#else
+#define _DEBUG 0
+#endif
+
/* Start the PPP encapsulation on the file descriptor. */
static int in_eui64( char *bufp, struct sockaddr *sap )
{
@@ -84,10 +90,9 @@ static int in_eui64( char *bufp, struct sockaddr *sap )
else if (c >= 'A' && c <= 'F')
val = c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf( stderr, _("in_eui64(%s): invalid eui64 address!\n"),
- orig );
-#endif
+ if (_DEBUG)
+ fprintf( stderr, _("in_eui64(%s): invalid eui64 address!\n"),
+ orig );
errno = EINVAL;
return (-1);
}
@@ -103,10 +108,9 @@ static int in_eui64( char *bufp, struct sockaddr *sap )
else if (c == ':' || c == 0)
val >>= 4;
else {
-#ifdef DEBUG
- fprintf( stderr, _("in_eui64(%s): invalid eui64 address!\n"),
- orig );
-#endif
+ if (_DEBUG)
+ fprintf( stderr, _("in_eui64(%s): invalid eui64 address!\n"),
+ orig );
errno = EINVAL;
return (-1);
}
@@ -119,28 +123,21 @@ static int in_eui64( char *bufp, struct sockaddr *sap )
/* We might get a semicolon here - not required. */
if (*bufp == ':') {
- if (i == EUI64_ALEN) {
-#ifdef DEBUG
+ if (_DEBUG && i == EUI64_ALEN)
fprintf(stderr, _("in_eui64(%s): trailing : ignored!\n"),
- orig)
-#endif
- ; /* nothing */
- }
+ orig);
bufp++;
}
}
/* That's it. Any trailing junk? */
- if ((i == EUI64_ALEN) && (*bufp != '\0')) {
-#ifdef DEBUG
+ if (_DEBUG && (i == EUI64_ALEN) && (*bufp != '\0')) {
fprintf(stderr, _("in_eui64(%s): trailing junk!\n"), orig);
errno = EINVAL;
return (-1);
-#endif
}
-#ifdef DEBUG
- fprintf(stderr, "in_eui64(%s): %s\n", orig, pr_eui64(sap->sa_data));
-#endif
+ if (_DEBUG)
+ fprintf(stderr, "in_eui64(%s): %s\n", orig, pr_eui64(sap->sa_data));
return (0);
}
diff --git a/lib/fddi.c b/lib/fddi.c
index 75adddd..750cc2d 100644
--- a/lib/fddi.c
+++ b/lib/fddi.c
@@ -57,6 +57,11 @@ static const char *pr_fddi(const char *ptr)
return (buff);
}
+#ifdef DEBUG
+#define _DEBUG 1
+#else
+#define _DEBUG 0
+#endif
/* Input an FDDI address and convert to binary. */
static int in_fddi(char *bufp, struct sockaddr *sap)
@@ -80,9 +85,8 @@ static int in_fddi(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val = c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_fddi(%s): invalid fddi address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_fddi(%s): invalid fddi address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -95,9 +99,8 @@ static int in_fddi(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val |= c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_fddi(%s): invalid fddi address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_fddi(%s): invalid fddi address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -106,28 +109,21 @@ static int in_fddi(char *bufp, struct sockaddr *sap)
/* We might get a semicolon here - not required. */
if (*bufp == ':') {
- if (i == FDDI_K_ALEN) {
-#ifdef DEBUG
+ if (_DEBUG && i == FDDI_K_ALEN)
fprintf(stderr, _("in_fddi(%s): trailing : ignored!\n"),
- orig)
-#endif
- ; /* nothing */
- }
+ orig);
bufp++;
}
}
/* That's it. Any trailing junk? */
- if ((i == FDDI_K_ALEN) && (*bufp != '\0')) {
-#ifdef DEBUG
+ if (_DEBUG && (i == FDDI_K_ALEN) && (*bufp != '\0')) {
fprintf(stderr, _("in_fddi(%s): trailing junk!\n"), orig);
errno = EINVAL;
return (-1);
-#endif
}
-#ifdef DEBUG
- fprintf(stderr, "in_fddi(%s): %s\n", orig, pr_fddi(sap->sa_data));
-#endif
+ if (_DEBUG)
+ fprintf(stderr, "in_fddi(%s): %s\n", orig, pr_fddi(sap->sa_data));
return (0);
}
diff --git a/lib/hippi.c b/lib/hippi.c
index bd73ea1..ae6e31b 100644
--- a/lib/hippi.c
+++ b/lib/hippi.c
@@ -57,6 +57,11 @@ static const char *pr_hippi(const char *ptr)
return (buff);
}
+#ifdef DEBUG
+#define _DEBUG 1
+#else
+#define _DEBUG 0
+#endif
/* Input an HIPPI address and convert to binary. */
static int in_hippi(char *bufp, struct sockaddr *sap)
@@ -80,9 +85,8 @@ static int in_hippi(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val = c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_hippi(%s): invalid hippi address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_hippi(%s): invalid hippi address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -95,9 +99,8 @@ static int in_hippi(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val |= c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_hippi(%s): invalid hippi address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_hippi(%s): invalid hippi address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -106,27 +109,20 @@ static int in_hippi(char *bufp, struct sockaddr *sap)
/* We might get a semicolon here - not required. */
if (*bufp == ':') {
- if (i == HIPPI_ALEN) {
-#ifdef DEBUG
- fprintf(stderr, _("in_hippi(%s): trailing : ignored!\n"), orig)
-#endif
- ; /* nothing */
- }
+ if (_DEBUG && i == HIPPI_ALEN)
+ fprintf(stderr, _("in_hippi(%s): trailing : ignored!\n"), orig);
bufp++;
}
}
/* That's it. Any trailing junk? */
- if ((i == HIPPI_ALEN) && (*bufp != '\0')) {
-#ifdef DEBUG
+ if (_DEBUG && (i == HIPPI_ALEN) && (*bufp != '\0')) {
fprintf(stderr, _("in_hippi(%s): trailing junk!\n"), orig);
errno = EINVAL;
return (-1);
-#endif
}
-#ifdef DEBUG
- fprintf(stderr, "in_hippi(%s): %s\n", orig, pr_hippi(sap->sa_data));
-#endif
+ if (_DEBUG)
+ fprintf(stderr, "in_hippi(%s): %s\n", orig, pr_hippi(sap->sa_data));
return (0);
}
diff --git a/lib/ib.c b/lib/ib.c
index e05bd3e..98f3446 100644
--- a/lib/ib.c
+++ b/lib/ib.c
@@ -56,6 +56,11 @@ static const char *pr_ib(const char *ptr)
return (buff);
}
+#ifdef DEBUG
+#define _DEBUG 1
+#else
+#define _DEBUG 0
+#endif
/* Input an Infiniband address and convert to binary. */
static int in_ib(char *bufp, struct sockaddr *sap)
@@ -80,9 +85,8 @@ static int in_ib(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val = c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_ib(%s): invalid infiniband address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_ib(%s): invalid infiniband address!\n"), orig);
errno = EINVAL;
return (-1);
}
diff --git a/lib/inet6_gr.c b/lib/inet6_gr.c
index 7f1bc20..2b055f6 100644
--- a/lib/inet6_gr.c
+++ b/lib/inet6_gr.c
@@ -92,10 +92,8 @@ int rprint_fib6(int ext, int numeric)
naddr6p[0], naddr6p[1], naddr6p[2], naddr6p[3],
naddr6p[4], naddr6p[5], naddr6p[6], naddr6p[7],
&metric, &refcnt, &use, &iflags, iface);
-#if 0
- if (num < 23)
+ if (0 && num < 23)
continue;
-#endif
if (iflags & RTF_CACHE) {
if (!(numeric & RTF_CACHE))
continue;
@@ -163,7 +161,7 @@ int rprint_cache6(int ext, int numeric)
char buff[4096], iface[16], flags[16];
char addr6[128], haddr[20], statestr[20];
struct sockaddr_in6 saddr6;
- int type, num, refcnt, prefix_len, location, state, gc;
+ int type, refcnt, prefix_len, location, state, gc;
long tstamp, expire, ndflags, reachable, stale, delete;
FILE *fp = fopen(_PATH_PROCNET_NDISC, "r");
char addr6p[8][5], haddrp[6][3];
@@ -184,7 +182,7 @@ int rprint_cache6(int ext, int numeric)
while (fgets(buff, 1023, fp)) {
- num = sscanf(buff, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %08lx %08lx %08lx %04x %04x %04lx %8s %2s%2s%2s%2s%2s%2s\n",
+ sscanf(buff, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %08lx %08lx %08lx %04x %04x %04lx %8s %2s%2s%2s%2s%2s%2s\n",
addr6p[0], addr6p[1], addr6p[2], addr6p[3],
addr6p[4], addr6p[5], addr6p[6], addr6p[7],
&location, &prefix_len, &type, &state, &expire, &tstamp, &reachable, &gc, &refcnt,
diff --git a/lib/ipx.c b/lib/ipx.c
index 1359f5f..f90c96c 100644
--- a/lib/ipx.c
+++ b/lib/ipx.c
@@ -87,12 +87,10 @@ static int IPX_getsock(char *bufp, struct sockaddr *sap)
{
char *sp = bufp, *bp;
unsigned int i;
- unsigned char val;
struct sockaddr_ipx *sipx = (struct sockaddr_ipx *) sap;
sipx->sipx_port = 0;
- val = 0;
bp = (char *) sipx->sipx_node;
for (i = 0; i < sizeof(sipx->sipx_node); i++) {
*sp = toupper(*sp);
diff --git a/lib/netrom.c b/lib/netrom.c
index f3033c7..254bd61 100644
--- a/lib/netrom.c
+++ b/lib/netrom.c
@@ -79,6 +79,11 @@ static const char *NETROM_sprint(struct sockaddr *sap, int numeric)
return (NETROM_print(((struct sockaddr_ax25 *) sap)->sax25_call.ax25_call));
}
+#ifdef DEBUG
+#define _DEBUG 1
+#else
+#define _DEBUG 0
+#endif
static int NETROM_input(int type, char *bufp, struct sockaddr *sap)
{
@@ -98,9 +103,8 @@ static int NETROM_input(int type, char *bufp, struct sockaddr *sap)
c = toupper(c);
if (!(isupper(c) || isdigit(c))) {
safe_strncpy(netrom_errmsg, _("Invalid callsign"), sizeof(netrom_errmsg));
-#ifdef DEBUG
- fprintf(stderr, "netrom_input(%s): %s !\n", netrom_errmsg, orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, "netrom_input(%s): %s !\n", netrom_errmsg, orig);
errno = EINVAL;
return (-1);
}
@@ -111,9 +115,8 @@ static int NETROM_input(int type, char *bufp, struct sockaddr *sap)
/* Callsign too long? */
if ((i == 6) && (*bufp != '-') && (*bufp != '\0')) {
safe_strncpy(netrom_errmsg, _("Callsign too long"), sizeof(netrom_errmsg));
-#ifdef DEBUG
- fprintf(stderr, "netrom_input(%s): %s !\n", netrom_errmsg, orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, "netrom_input(%s): %s !\n", netrom_errmsg, orig);
errno = E2BIG;
return (-1);
}
@@ -131,12 +134,12 @@ static int NETROM_input(int type, char *bufp, struct sockaddr *sap)
}
/* All done. */
-#ifdef DEBUG
- fprintf(stderr, "netrom_input(%s): ", orig);
- for (i = 0; i < sizeof(ax25_address); i++)
- fprintf(stderr, "%02X ", sap->sa_data[i] & 0377);
- fprintf(stderr, "\n");
-#endif
+ if (_DEBUG) {
+ fprintf(stderr, "netrom_input(%s): ", orig);
+ for (i = 0; i < sizeof(ax25_address); i++)
+ fprintf(stderr, "%02X ", sap->sa_data[i] & 0377);
+ fprintf(stderr, "\n");
+ }
return (0);
}
diff --git a/lib/rose.c b/lib/rose.c
index 52d025a..c02e741 100644
--- a/lib/rose.c
+++ b/lib/rose.c
@@ -73,7 +73,6 @@ static const char *
return (ROSE_print(((struct sockaddr_rose *) sap)->srose_addr.rose_addr));
}
-
static int ROSE_input(int type, char *bufp, struct sockaddr *sap)
{
char *ptr;
@@ -85,9 +84,6 @@ static int ROSE_input(int type, char *bufp, struct sockaddr *sap)
/* Node address the correct length ? */
if (strlen(bufp) != 10) {
strcpy(ROSE_errmsg, _("Node address must be ten digits"));
-#ifdef DEBUG
- fprintf(stderr, "rose_input(%s): %s !\n", ROSE_errmsg, orig);
-#endif
errno = EINVAL;
return (-1);
}
@@ -98,13 +94,6 @@ static int ROSE_input(int type, char *bufp, struct sockaddr *sap)
}
/* All done. */
-#ifdef DEBUG
- fprintf(stderr, "rose_input(%s): ", orig);
- for (i = 0; i < sizeof(rose_address); i++)
- fprintf(stderr, "%02X ", sap->sa_data[i] & 0377);
- fprintf(stderr, "\n");
-#endif
-
return (0);
}
diff --git a/lib/tr.c b/lib/tr.c
index 961cdb1..a0413f4 100644
--- a/lib/tr.c
+++ b/lib/tr.c
@@ -50,6 +50,11 @@ static const char *pr_tr(const char *ptr)
return (buff);
}
+#ifdef DEBUG
+#define _DEBUG 1
+#else
+#define _DEBUG 0
+#endif
static int in_tr(char *bufp, struct sockaddr *sap)
{
@@ -82,9 +87,8 @@ static int in_tr(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val = c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_tr(%s): invalid token ring address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_tr(%s): invalid token ring address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -97,9 +101,8 @@ static int in_tr(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val |= c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_tr(%s): invalid token ring address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_tr(%s): invalid token ring address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -108,28 +111,21 @@ static int in_tr(char *bufp, struct sockaddr *sap)
/* We might get a semicolon here - not required. */
if (*bufp == ':') {
- if (i == TR_ALEN) {
-#ifdef DEBUG
+ if (_DEBUG && i == TR_ALEN)
fprintf(stderr, _("in_tr(%s): trailing : ignored!\n"),
- orig)
-#endif
- ; /* nothing */
- }
+ orig);
bufp++;
}
}
/* That's it. Any trailing junk? */
- if ((i == TR_ALEN) && (*bufp != '\0')) {
-#ifdef DEBUG
+ if (_DEBUG && (i == TR_ALEN) && (*bufp != '\0')) {
fprintf(stderr, _("in_tr(%s): trailing junk!\n"), orig);
errno = EINVAL;
return (-1);
-#endif
}
-#ifdef DEBUG
- fprintf(stderr, "in_tr(%s): %s\n", orig, pr_tr(sap->sa_data));
-#endif
+ if (_DEBUG)
+ fprintf(stderr, "in_tr(%s): %s\n", orig, pr_tr(sap->sa_data));
return (0);
}