dbee9103d1583963fab4c0e898311573e4de7c0e
* Copyright (c) 1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
static char sccsid
[] = "@(#)ns_ntoa.c 6.1 (Berkeley) %G%";
u_short port
= htons(addr
.x_port
);
register u_char
*up
= addr
.x_host
.c_host
;
* (union ns_net
*) &net
= addr
.x_net
;
sprintf(obuf
, "%lx", net
);
while (*up
==0 && up
< uplim
) up
++;
if (up
== uplim
) return (obuf
);
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; }