Annotation of embedaddon/ntp/libntp/numtoa.c, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * numtoa - return asciized network numbers store in local array space
                      3:  */
                      4: #include <config.h>
                      5: 
                      6: #include <sys/types.h>
                      7: #ifdef HAVE_NETINET_IN_H
                      8: #include <netinet/in.h>                /* ntohl */
                      9: #endif
                     10: 
                     11: #include <stdio.h>
                     12: 
                     13: #include "ntp_fp.h"
                     14: #include "lib_strbuf.h"
                     15: #include "ntp_stdlib.h"
                     16: 
                     17: char *
                     18: numtoa(
                     19:        u_int32 num
                     20:        )
                     21: {
                     22:        register u_int32 netnum;
                     23:        register char *buf;
                     24: 
                     25:        netnum = ntohl(num);
                     26:        LIB_GETBUF(buf);
                     27:        snprintf(buf, LIB_BUFLENGTH, "%lu.%lu.%lu.%lu",
                     28:                 ((u_long)netnum >> 24) & 0xff,
                     29:                 ((u_long)netnum >> 16) & 0xff,
                     30:                 ((u_long)netnum >> 8) & 0xff,
                     31:                 (u_long)netnum & 0xff);
                     32:        return buf;
                     33: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>