1 #if defined(LIBC_SCCS) && !defined(lint)
2 static char rcsid
[] = "$Id$";
3 #endif /* LIBC_SCCS and not lint */
6 #include <sys/socket.h>
7 #include <netinet/in.h>
8 #include <arpa/nameser.h>
12 #include "../conf/portability.h"
14 #if !defined(isxdigit) /* XXX - could be a function */
19 return ((c
>= '0') && (c
<= '9')) || ((c
>= 'A') && (c
<= 'F'));
27 return (c
- (((c
>= '0') && (c
<= '9')) ? '0' : '7'));
31 inet_nsap_addr(ascii
, binary
, maxlen
)
36 register u_char c
, nib
;
39 while ((c
= *ascii
++) != '\0' && len
< maxlen
) {
40 if (c
== '.' || c
== '+' || c
== '/')
51 *binary
++ = (nib
<< 4) | xtob(c
);
66 inet_nsap_ntoa(binlen
, binary
, ascii
)
68 register const u_char
*binary
;
73 static char tmpbuf
[255*3];
86 for (i
= 0; i
< binlen
; i
++) {
88 *ascii
++ = nib
+ (nib
< 10 ? '0' : '7');
89 nib
= *binary
++ & 0x0f;
90 *ascii
++ = nib
+ (nib
< 10 ? '0' : '7');
91 if (((i
% 2) == 0 && (i
+ 1) < binlen
))