File: refnumtoa.c

package info (click to toggle)
xntp3 5.93-2
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 7,644 kB
  • ctags: 7,419
  • sloc: ansic: 59,474; perl: 3,633; sh: 2,623; awk: 417; makefile: 311; asm: 37
file content (30 lines) | stat: -rw-r--r-- 597 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * 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)
	u_int32 num;
{
	register u_int32 netnum;
	register char *buf;
	register const char *rclock;
	
	netnum = ntohl(num);
	
	LIB_GETBUF(buf);

	rclock = clockname((int)((u_long)netnum >> 8) & 0xff);

	if (rclock != NULL)
		(void)sprintf(buf, "%s(%lu)", rclock, (u_long)netnum & 0xff);
	else
		(void)sprintf(buf, "REFCLK(%lu,%lu)",
		    ((u_long)netnum >> 8) & 0xff, (u_long)netnum & 0xff);
	return buf;
}