Sync usage with man page.
[netbsd-mini2440.git] / dist / ntp / libntp / socktohost.c
blobec874b8f6306b881249402d47fe423fd9dd7f81c
1 /* $NetBSD: socktohost.c,v 1.2 2003/12/04 16:23:37 drochner Exp $ */
3 /*
4 * socktoa - return a numeric host name from a sockaddr_storage structure
5 */
6 #include <sys/types.h>
7 #include <sys/socket.h>
8 #include <netinet/in.h>
10 #include <arpa/inet.h>
12 #include <stdio.h>
14 #include "ntp_fp.h"
15 #include "lib_strbuf.h"
16 #include "ntp_stdlib.h"
17 #include "ntp.h"
20 char *
21 socktohost(
22 struct sockaddr_storage* sock
25 register char *buffer;
27 LIB_GETBUF(buffer);
28 if (getnameinfo((struct sockaddr *)sock, SOCKLEN(sock), buffer,
29 LIB_BUFLENGTH /* NI_MAXHOST*/, NULL, 0, 0))
30 return stoa(sock);
32 return buffer;