Annotation of 43BSDTahoe/new/xns/morexnslib/xnsbfs/nsntoa.c, revision 1.1.1.1

1.1       root        1: /* $Header: nsntoa.c,v 1.1 86/06/27 13:14:36 jqj Exp $ */
                      2: /* $Log:       nsntoa.c,v $
                      3:  * Revision 1.1  86/06/27  13:14:36  jqj
                      4:  * Initial revision
                      5:  * 
                      6:  */
                      7:  
                      8: #include <sys/types.h>
                      9: #include <netns/ns.h>
                     10: 
                     11: /*
                     12:  * Convert network-format ns address to ascii.
                     13:  * This routine should be part of library, but just incase it isn't we
                     14:  * have it here.
                     15:  */
                     16: char *
                     17: ns_ntoa(addr)
                     18:        struct ns_addr addr;
                     19: {
                     20:        static char b[25];
                     21:        char temp[15];
                     22:        char *t;
                     23:        union ns_net_u net_u;
                     24: 
                     25: 
                     26:        /* net */
                     27:        net_u.net_e = addr.x_net;
                     28: 
                     29:        /* build a host number */
                     30:        sprintf(temp,"%02X%02X%02X%02X%02X%02X",
                     31:                addr.x_host.c_host[0],
                     32:                addr.x_host.c_host[1],
                     33:                addr.x_host.c_host[2],
                     34:                addr.x_host.c_host[3],
                     35:                addr.x_host.c_host[4],
                     36:                addr.x_host.c_host[5]);
                     37:        /* strip leading zeros */
                     38:        for (t = temp; *t == '0'; t++)
                     39:                ;
                     40:        sprintf(b, "%lXH.%sH", ntohl(net_u.long_e),t);
                     41:        return (b);
                     42: }
                     43: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.