Sync usage with man page.
[netbsd-mini2440.git] / dist / ntp / libntp / refnumtoa.c
blob58cf42f403b38ffaccd156ddb1c1f0a239f79eb3
1 /* $NetBSD$ */
3 /*
4 * refnumtoa - return asciized refclock addresses stored in local array space
5 */
6 #include <stdio.h>
8 #include "ntp_fp.h"
9 #include "lib_strbuf.h"
10 #include "ntp_stdlib.h"
12 char *
13 refnumtoa(
14 struct sockaddr_storage* num
17 register u_int32 netnum;
18 register char *buf;
19 register const char *rclock;
21 LIB_GETBUF(buf);
23 if(num->ss_family == AF_INET) {
24 netnum = ntohl(((struct sockaddr_in*)num)->sin_addr.s_addr);
25 rclock = clockname((int)((u_long)netnum >> 8) & 0xff);
27 if (rclock != NULL)
28 (void)sprintf(buf, "%s(%lu)", rclock, (u_long)netnum & 0xff);
29 else
30 (void)sprintf(buf, "REFCLK(%lu,%lu)",
31 ((u_long)netnum >> 8) & 0xff, (u_long)netnum & 0xff);
34 else {
35 (void)sprintf(buf, "refclock address type not implemented yet, use IPv4 refclock address.");
37 return buf;