freebsd-dev/usr.sbin/xntpd/lib/refnumtoa.c

31 lines
561 B
C
Raw Normal View History

1994-09-29 23:04:24 +00:00
/*
1993-12-21 18:36:48 +00:00
* refnumtoa - return asciized refclock addresses stored in local array space
*/
#include <stdio.h>
#include "ntp_fp.h"
#include "lib_strbuf.h"
#include "ntp_stdlib.h"
char *
refnumtoa(num)
1994-09-29 23:04:24 +00:00
u_long num;
1993-12-21 18:36:48 +00:00
{
1994-09-29 23:04:24 +00:00
register u_long netnum;
1993-12-21 18:36:48 +00:00
register char *buf;
register const char *rclock;
1995-05-30 03:57:47 +00:00
1993-12-21 18:36:48 +00:00
netnum = ntohl(num);
1995-05-30 03:57:47 +00:00
1993-12-21 18:36:48 +00:00
LIB_GETBUF(buf);
1994-09-29 23:04:24 +00:00
rclock = clockname((int)((netnum >> 8) & 0xff));
1993-12-21 18:36:48 +00:00
if (rclock != NULL)
1994-09-29 23:04:24 +00:00
(void)sprintf(buf, "%s(%lu)", rclock, netnum & 0xff);
1993-12-21 18:36:48 +00:00
else
1994-09-29 23:04:24 +00:00
(void)sprintf(buf, "REFCLK(%lu,%lu)",
(netnum >> 8) & 0xff, netnum&0xff);
1993-12-21 18:36:48 +00:00
return buf;
}