diff options
Diffstat (limited to 'lib/eui64.c')
-rw-r--r-- | lib/eui64.c | 37 |
1 files changed, 17 insertions, 20 deletions
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); } |