aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fddi.c')
-rw-r--r--lib/fddi.c32
1 files changed, 14 insertions, 18 deletions
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);
}