diff options
author | assar <assar@FreeBSD.org> | 2001-02-13 16:46:19 +0000 |
---|---|---|
committer | assar <assar@FreeBSD.org> | 2001-02-13 16:46:19 +0000 |
commit | 3a971fe69aad52dfd248901ae796e64a96ae3e37 (patch) | |
tree | ac7b5c62510ffa9f0316643bcb19a3fed3d5bef7 /crypto/heimdal/lib/roken/getaddrinfo_hostspec.c | |
parent | 2934fc23653f64b32f4db32233d7eda11ca274f0 (diff) | |
parent | ebfe6dc471c206300fd82c7c0fd145f683aa52f6 (diff) | |
download | FreeBSD-src-3a971fe69aad52dfd248901ae796e64a96ae3e37.zip FreeBSD-src-3a971fe69aad52dfd248901ae796e64a96ae3e37.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r72445,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'crypto/heimdal/lib/roken/getaddrinfo_hostspec.c')
-rw-r--r-- | crypto/heimdal/lib/roken/getaddrinfo_hostspec.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/crypto/heimdal/lib/roken/getaddrinfo_hostspec.c b/crypto/heimdal/lib/roken/getaddrinfo_hostspec.c index 76e5d2b..7f6b0d1 100644 --- a/crypto/heimdal/lib/roken/getaddrinfo_hostspec.c +++ b/crypto/heimdal/lib/roken/getaddrinfo_hostspec.c @@ -33,7 +33,7 @@ #ifdef HAVE_CONFIG_H #include <config.h> -RCSID("$Id: getaddrinfo_hostspec.c,v 1.1 2000/02/07 13:38:22 joda Exp $"); +RCSID("$Id: getaddrinfo_hostspec.c,v 1.3 2000/07/15 12:50:32 joda Exp $"); #endif #include "roken.h" @@ -41,14 +41,16 @@ RCSID("$Id: getaddrinfo_hostspec.c,v 1.1 2000/02/07 13:38:22 joda Exp $"); /* getaddrinfo via string specifying host and port */ int -roken_getaddrinfo_hostspec(const char *hostspec, - int port, - struct addrinfo **ai) +roken_getaddrinfo_hostspec2(const char *hostspec, + int socktype, + int port, + struct addrinfo **ai) { const char *p; char portstr[NI_MAXSERV]; char host[MAXHOSTNAMELEN]; struct addrinfo hints; + int hostspec_len; struct hst { const char *prefix; @@ -64,6 +66,8 @@ roken_getaddrinfo_hostspec(const char *hostspec, }; memset(&hints, 0, sizeof(hints)); + + hints.ai_socktype = socktype; for(hstp = hst; hstp->prefix; hstp++) { if(strncmp(hostspec, hstp->prefix, strlen(hstp->prefix)) == 0) { @@ -81,9 +85,20 @@ roken_getaddrinfo_hostspec(const char *hostspec, char *end; port = strtol (p + 1, &end, 0); + hostspec_len = p - hostspec; + } else { + hostspec_len = strlen(hostspec); } snprintf (portstr, sizeof(portstr), "%u", port); - snprintf (host, sizeof(host), "%.*s", p - hostspec, hostspec); + snprintf (host, sizeof(host), "%.*s", hostspec_len, hostspec); return getaddrinfo (host, portstr, &hints, ai); } + +int +roken_getaddrinfo_hostspec(const char *hostspec, + int port, + struct addrinfo **ai) +{ + return roken_getaddrinfo_hostspec2(hostspec, 0, port, ai); +} |