* Copyright (c) 1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid
[] = "@(#)ns_ntoa.c 6.3 (Berkeley) 3/9/86";
#endif LIBC_SCCS and not lint
union { union ns_net net_e
; u_long long_e
; } net
;
u_short port
= htons(addr
.x_port
);
register u_char
*up
= addr
.x_host
.c_host
;
sprintf(obuf
, "%lx", ntohl(net
.long_e
));
while (*up
==0 && up
< uplim
) up
++;
sprintf(cp
, ".%x", *up
++);
sprintf(cp
, "%02x", *up
++);
sprintf(cp
, ".%x", port
);
for (; *p
; p
++) switch (*p
) {
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9':
if (nonzero
&& !ok
) { *p
++ = 'H'; *p
= 0; }