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