File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / ntp / libntp / numtoa.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:08:38 2012 UTC (12 years, 1 month ago) by misho
Branches: ntp, MAIN
CVS tags: v4_2_6p5p0, v4_2_6p5, HEAD
ntp 4.2.6p5

    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>