From 1a0391391c65a147b7eee692421c4876ff97553e Mon Sep 17 00:00:00 2001 From: mdw Date: Sun, 13 Jan 2002 14:49:56 +0000 Subject: [PATCH] Conditional compilation for @getnetbyname@, since Cygwin doesn't have it. --- inet.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/inet.c b/inet.c index a9a559e..f98c7fa 100644 --- a/inet.c +++ b/inet.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: inet.c,v 1.3 2000/08/01 17:59:56 mdw Exp $ + * $Id: inet.c,v 1.4 2002/01/13 14:49:56 mdw Exp $ * * Protocol specific definitions for IPv4 sockets * @@ -29,6 +29,10 @@ /*----- Revision history --------------------------------------------------* * * $Log: inet.c,v $ + * Revision 1.4 2002/01/13 14:49:56 mdw + * Conditional compilation for @getnetbyname@, since Cygwin doesn't have + * it. + * * Revision 1.3 2000/08/01 17:59:56 mdw * Switch over to using `size_t' for socket address lengths. * @@ -197,9 +201,12 @@ static int inet_option(scanner *sc, addr_opts *ao) if (sc->t == CTOK_WORD && strcmp(sc->d.buf, "from") == 0) token(sc); conf_name(sc, '.', &d); +#ifdef HAVE_GETNETBYNAME if ((n = getnetbyname(d.buf)) != 0) a.s_addr = htonl(n->n_net); - else if ((h = gethostbyname(d.buf)) == 0) + else +#endif + if ((h = gethostbyname(d.buf)) == 0) error(sc, "couldn't resolve address `%s'", d.buf); else memcpy(&a, h->h_addr, sizeof(struct in_addr)); -- 2.11.0