diff options
author | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2009-02-11 23:10:14 -0500 |
---|---|---|
committer | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2009-02-11 23:10:14 -0500 |
commit | ab388574f83567ca779e68f0cadddbcd59aa2ac0 (patch) | |
tree | 92a9ba1fba42ecfc292c702d21f58611951d59ea | |
parent | 689aeb76c0cf1a704499a790e8e9439b0395cb2d (diff) | |
download | slapi-nis-ab388574f83567ca779e68f0cadddbcd59aa2ac0.tar.gz slapi-nis-ab388574f83567ca779e68f0cadddbcd59aa2ac0.tar.xz slapi-nis-ab388574f83567ca779e68f0cadddbcd59aa2ac0.zip |
- learn about tirpc, offer a v6 option
-rw-r--r-- | tests/clients/Makefile.am | 3 | ||||
-rw-r--r-- | tests/clients/yp.c | 23 |
2 files changed, 18 insertions, 8 deletions
diff --git a/tests/clients/Makefile.am b/tests/clients/Makefile.am index 69830d2..ecc6a82 100644 --- a/tests/clients/Makefile.am +++ b/tests/clients/Makefile.am @@ -1,8 +1,9 @@ +AM_CFLAGS = @TIRPC_CFLAGS@ @RPC_CFLAGS@ RPCGEN=@RPCGEN@ if CAN_TEST noinst_PROGRAMS = yp ldifsort yp_SOURCES = yp.c yp_clnt.c -yp_LDADD = -lnsl +yp_LDADD = @TIRPC_LIBS@ @RPC_LIBS@ yp_clnt.c: $(includedir)/rpcsvc/yp.x $(RPCGEN) -l $< > $@ CLEANFILES = yp_clnt.c diff --git a/tests/clients/yp.c b/tests/clients/yp.c index e5aacf1..0557977 100644 --- a/tests/clients/yp.c +++ b/tests/clients/yp.c @@ -322,14 +322,18 @@ usage(const char *argv0) int main(int argc, char **argv) { - int c, sock, port = 0, timeout = 60, ret; + int c, sock, port = 0, timeout = 60, ret, six; FILE *output; CLIENT *client; struct timeval tv; struct addrinfo *hostaddr, hints; const char *host = NULL; - while ((c = getopt(argc, argv, "ch:p:t:")) != -1) { + six = 0; + while ((c = getopt(argc, argv, "6ch:p:t:")) != -1) { switch (c) { + case '6': + six = 1; + break; case 'c': connected = 1; break; @@ -359,7 +363,7 @@ main(int argc, char **argv) } if (host != NULL) { memset(&hints, 0, sizeof(hints)); - hints.ai_family = AF_INET; + hints.ai_family = six ? AF_INET6 : AF_INET; hints.ai_socktype = connected ? SOCK_STREAM : SOCK_DGRAM; if (getaddrinfo(host, NULL, &hints, &hostaddr) != 0) { perror("getaddrinfo"); @@ -373,10 +377,15 @@ main(int argc, char **argv) memset(&timeout, 0, sizeof(timeout)); tv.tv_sec = timeout; sock = RPC_ANYSOCK; - client = connected ? clnttcp_create(&server, YPPROG, YPVERS, &sock, - 0, 0) : - clntudp_create(&server, YPPROG, YPVERS, tv, - &sock); + client = six ? + (connected ? clnttcp6_create(&server, YPPROG, YPVERS, &sock, + 0, 0) : + clntudp6_create(&server, YPPROG, YPVERS, tv, + &sock)) : + (connected ? clnttcp_create(&server, YPPROG, YPVERS, &sock, + 0, 0) : + clntudp_create(&server, YPPROG, YPVERS, tv, + &sock)); if (client == NULL) { fprintf(stderr, "error setting up RPC client\n"); return -1; |