aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-10-14 06:55:11 +0000
committerGuy Harris <guy@alum.mit.edu>1999-10-14 06:55:11 +0000
commitae276ffe2010027af678da5453339affcdde66be (patch)
tree09b20a56b5d5081b22bafd4a31a690a2a3bd22ec
parent831497b33e358305b8f409882ec61097335b772d (diff)
Make it build on systems lacking "inet_pton()", "inet_ntop()", and a
definition of "AF_INET6". Declare those functions and, if it's not defined, define "AF_INET6" in "inet_v6defs.h", and arrange to include it if "inet_ntop()" is missing. (Systems will probably have both of them or lack both of them, and we may choose not to use the system's "inet_pton()" because it's buggy, so base the decision on whether to include "inet_v6defs.h" on whether we're using the system's "inet_ntop()" or not.) Fix some macro references in "Makefile.am" and "configure.in". svn path=/trunk/; revision=830
-rw-r--r--Makefile.am4
-rw-r--r--acconfig.h4
-rw-r--r--configure.in9
-rw-r--r--inet_ntop.c6
-rw-r--r--inet_pton.c4
-rw-r--r--inet_v6defs.h47
-rw-r--r--packet.c6
-rw-r--r--resolv.c7
8 files changed, 75 insertions, 12 deletions
diff --git a/Makefile.am b/Makefile.am
index a19930e25a..1caabf297f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
# Makefile.am
# Automake file for Ethereal
#
-# $Id: Makefile.am,v 1.86 1999/10/14 05:41:28 itojun Exp $
+# $Id: Makefile.am,v 1.87 1999/10/14 06:55:07 guy Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@zing.org>
@@ -168,7 +168,7 @@ ethereal_DEPENDENCIES = @SNMP_O@ @SNPRINTF_O@ @STRERROR_O@ \
@STRNCASECMP_O@ @MKSTEMP_O@ @INET_ATON_O@ @INET_PTON_O@ @INET_NTOP_O@\
wiretap/libwiretap.a gtk/libui.a
ethereal_LDADD = @SNMP_O@ @SNPRINTF_O@ @STRERROR_O@ \
-@STRNCASECMP_O@ @MKSTEMP_O@ @INET_ATON_O@ @INET_ATON_O@ @INET_NTOP_O@\
+@STRNCASECMP_O@ @MKSTEMP_O@ @INET_ATON_O@ @INET_PTON_O@ @INET_NTOP_O@\
wiretap/libwiretap.a gtk/libui.a \
@SNMP_A@
diff --git a/acconfig.h b/acconfig.h
index b28b7f024c..ad6c942f83 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -1,7 +1,7 @@
/* acconfig.h
* #ifdefs to be controlled by "configure"
*
- * $Id: acconfig.h,v 1.11 1999/10/06 03:37:52 guy Exp $
+ * $Id: acconfig.h,v 1.12 1999/10/14 06:55:11 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -31,6 +31,8 @@
#undef DATAFILE_DIR
+#undef NEED_INET_V6DEFS_H
+
#undef NEED_SNPRINTF_H
#undef NEED_STRERROR_H
diff --git a/configure.in b/configure.in
index dfd62b59eb..4bcc514ccf 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
-# $Id: configure.in,v 1.51 1999/10/14 05:41:28 itojun Exp $
+# $Id: configure.in,v 1.52 1999/10/14 06:55:08 guy Exp $
dnl Process this file with autoconf to produce a configure script.
AC_INIT(etypes.h)
@@ -228,10 +228,11 @@ AC_SUBST(INET_PTON_C)
AC_SUBST(INET_PTON_O)
AC_CHECK_FUNC(inet_ntop, INET_NTOP_O="",
- INET_ATON_O="inet_ntop.o")
+ INET_NTOP_O="inet_ntop.o")
if test "$ac_cv_func_inet_ntop" = no ; then
- INET_ATON_C="inet_ntop.c"
- INET_ATON_O="inet_ntop.o"
+ INET_NTOP_C="inet_ntop.c"
+ INET_NTOP_O="inet_ntop.o"
+ AC_DEFINE(NEED_INET_V6DEFS_H)
fi
AC_SUBST(INET_NTOP_C)
AC_SUBST(INET_NTOP_O)
diff --git a/inet_ntop.c b/inet_ntop.c
index 009ac4e305..ff80e4e1f8 100644
--- a/inet_ntop.c
+++ b/inet_ntop.c
@@ -16,9 +16,11 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$Id: inet_ntop.c,v 1.1 1999/10/14 05:41:29 itojun Exp $";
+static char rcsid[] = "$Id: inet_ntop.c,v 1.2 1999/10/14 06:55:08 guy Exp $";
#endif /* LIBC_SCCS and not lint */
+#include "config.h"
+
#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -40,6 +42,8 @@ static char rcsid[] = "$Id: inet_ntop.c,v 1.1 1999/10/14 05:41:29 itojun Exp $";
# include "snprintf.h"
#endif
+#include "inet_v6defs.h"
+
#ifndef NS_INADDRSZ
#define NS_INADDRSZ 4
#endif
diff --git a/inet_pton.c b/inet_pton.c
index 8769a7beb6..5e2690779f 100644
--- a/inet_pton.c
+++ b/inet_pton.c
@@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$Id: inet_pton.c,v 1.1 1999/10/14 05:41:29 itojun Exp $";
+static char rcsid[] = "$Id: inet_pton.c,v 1.2 1999/10/14 06:55:10 guy Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -28,6 +28,8 @@ static char rcsid[] = "$Id: inet_pton.c,v 1.1 1999/10/14 05:41:29 itojun Exp $";
#include <string.h>
#include <errno.h>
+#include "inet_v6defs.h"
+
#ifndef NS_INADDRSZ
#define NS_INADDRSZ 4
#endif
diff --git a/inet_v6defs.h b/inet_v6defs.h
new file mode 100644
index 0000000000..3d124d8338
--- /dev/null
+++ b/inet_v6defs.h
@@ -0,0 +1,47 @@
+/* inet_pton.h
+ *
+ * $Id: inet_v6defs.h,v 1.1 1999/10/14 06:55:09 guy Exp $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@zing.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Version of "inet_pton()" and "inet_ntop()", for the benefit of OSes that
+ * don't have it.
+ */
+extern int inet_pton(int af, const char *src, void *dst);
+extern const char *inet_ntop(int af, const void *src, char *dst,
+ size_t size);
+
+/*
+ * Those OSes may also not have AF_INET6, so declare it here if it's not
+ * already declared, so that we can pass it to "inet_ntop()" and "inet_pton()".
+ */
+#ifndef AF_INET6
+#define AF_INET6 127 /* pick a value unlikely to duplicate an existing AF_ value */
+#endif
+
+/*
+ * And if __P isn't defined, define it here, so we can use it in
+ * "inet_ntop.c" and "inet_pton.c" (rather than having to change them
+ * not to use it).
+ */
+#ifndef __P
+#define __P(args) args
+#endif
diff --git a/packet.c b/packet.c
index e13d31d7be..591797a55d 100644
--- a/packet.c
+++ b/packet.c
@@ -1,7 +1,7 @@
/* packet.c
* Routines for packet disassembly
*
- * $Id: packet.c,v 1.47 1999/10/14 05:41:30 itojun Exp $
+ * $Id: packet.c,v 1.48 1999/10/14 06:55:09 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -55,6 +55,10 @@
# include <netinet/in.h>
#endif
+#ifdef NEED_INET_V6DEFS_H
+# include "inet_v6defs.h"
+#endif
+
#include "packet.h"
#include "print.h"
#include "file.h"
diff --git a/resolv.c b/resolv.c
index 4c8efb6404..62c84a1fac 100644
--- a/resolv.c
+++ b/resolv.c
@@ -1,7 +1,7 @@
/* resolv.c
* Routines for network object lookup
*
- * $Id: resolv.c,v 1.14 1999/10/14 05:41:33 itojun Exp $
+ * $Id: resolv.c,v 1.15 1999/10/14 06:55:10 guy Exp $
*
* Laurent Deniel <deniel@worldnet.fr>
*
@@ -39,7 +39,6 @@
#endif
#endif
-
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -68,6 +67,10 @@
# include <setjmp.h>
#endif
+#ifdef NEED_INET_V6DEFS_H
+# include "inet_v6defs.h"
+#endif
+
#include "packet.h"
#include "packet-ipv6.h"
#include "globals.h"