diff options
Diffstat (limited to 'libntp/numtoa.c')
-rw-r--r-- | libntp/numtoa.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libntp/numtoa.c b/libntp/numtoa.c index 36a7c5819a4c..5efbe942e3b4 100644 --- a/libntp/numtoa.c +++ b/libntp/numtoa.c @@ -31,3 +31,29 @@ numtoa( (u_long)netnum & 0xff); return buf; } + + +/* Convert a refid & stratum to a string */ +const char * +refid_str( + u_int32 refid, + int stratum + ) +{ + char * text; + size_t tlen; + + if (stratum > 1) + return numtoa(refid); + + LIB_GETBUF(text); + text[0] = '.'; + memcpy(&text[1], &refid, sizeof(refid)); + text[1 + sizeof(refid)] = '\0'; + tlen = strlen(text); + text[tlen] = '.'; + text[tlen + 1] = '\0'; + + return text; +} + |