File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / ntp / libntp / refnumtoa.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:  * refnumtoa - return asciized refclock addresses stored in local array space
    3:  */
    4: #include <stdio.h>
    5: 
    6: #include "ntp_net.h"
    7: #include "lib_strbuf.h"
    8: #include "ntp_stdlib.h"
    9: 
   10: char *
   11: refnumtoa(
   12: 	sockaddr_u *num
   13: 	)
   14: {
   15: 	register u_int32 netnum;
   16: 	register char *buf;
   17: 	register const char *rclock;
   18: 
   19: 	LIB_GETBUF(buf);
   20: 
   21: 	if (ISREFCLOCKADR(num)) {
   22: 		netnum = SRCADR(num);
   23: 		rclock = clockname((int)((u_long)netnum >> 8) & 0xff);
   24: 
   25: 		if (rclock != NULL)
   26: 			snprintf(buf, LIB_BUFLENGTH, "%s(%lu)",
   27: 				 rclock, (u_long)netnum & 0xff);
   28: 		else
   29: 			snprintf(buf, LIB_BUFLENGTH, "REFCLK(%lu,%lu)",
   30: 				 ((u_long)netnum >> 8) & 0xff,
   31: 				 (u_long)netnum & 0xff);
   32: 
   33: 	}
   34: 
   35: 	return buf;
   36: }

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