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

23 lines
432 B
C
Raw Normal View History

1994-09-29 23:04:24 +00:00
/*
1993-12-21 18:36:48 +00:00
* numtoa - return asciized network numbers store in local array space
*/
#include <stdio.h>
#include "ntp_fp.h"
#include "lib_strbuf.h"
#include "ntp_stdlib.h"
char *
numtoa(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;
netnum = ntohl(num);
LIB_GETBUF(buf);
1994-09-29 23:04:24 +00:00
(void) sprintf(buf, "%lu.%lu.%lu.%lu", (netnum >> 24) & 0xff,
(netnum >> 16) & 0xff, (netnum >> 8) & 0xff, netnum & 0xff);
1993-12-21 18:36:48 +00:00
return buf;
}