diff options
author | roberto <roberto@FreeBSD.org> | 2008-08-17 17:37:33 +0000 |
---|---|---|
committer | roberto <roberto@FreeBSD.org> | 2008-08-17 17:37:33 +0000 |
commit | 4ded1c1fa0bc21c61f91a2dbe864835986745121 (patch) | |
tree | 16d100fbc9dae63888d48b464e471ba0e5065193 /contrib/ntp/libntp/decodenetnum.c | |
parent | 8b5a86d4fda08a9c68231415812edcb26be52f79 (diff) | |
download | FreeBSD-src-4ded1c1fa0bc21c61f91a2dbe864835986745121.zip FreeBSD-src-4ded1c1fa0bc21c61f91a2dbe864835986745121.tar.gz |
Flatten the dist and various 4.n.n trees in preparation of future ntp imports.
Diffstat (limited to 'contrib/ntp/libntp/decodenetnum.c')
-rw-r--r-- | contrib/ntp/libntp/decodenetnum.c | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/contrib/ntp/libntp/decodenetnum.c b/contrib/ntp/libntp/decodenetnum.c deleted file mode 100644 index 4accf4a..0000000 --- a/contrib/ntp/libntp/decodenetnum.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * decodenetnum - return a net number (this is crude, but careful) - */ -#include <sys/types.h> -#include <ctype.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <netdb.h> - -#include "ntp_stdlib.h" - -int -decodenetnum( - const char *num, - struct sockaddr_storage *netnum - ) -{ - struct addrinfo hints, *ai = NULL; - register int err, i; - register const char *cp; - char name[80]; - - cp = num; - - if (*cp == '[') { - cp++; - for (i = 0; *cp != ']'; cp++, i++) - name[i] = *cp; - name[i] = '\0'; - num = name; - } - memset(&hints, 0, sizeof(struct addrinfo)); - hints.ai_flags = AI_NUMERICHOST; - err = getaddrinfo(num, NULL, &hints, &ai); - if (err != 0) - return 0; - memcpy(netnum, (struct sockaddr_storage *)ai->ai_addr, ai->ai_addrlen); - freeaddrinfo(ai); - return 1; -} |