Some initial changes for win32 support, but not all.
authorgram <gram@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 10 Jan 2000 17:33:17 +0000 (17:33 +0000)
committergram <gram@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 10 Jan 2000 17:33:17 +0000 (17:33 +0000)
Added lots of #ifdef HAVE_*_H wrappers.
Added some #defines in config.h.win32
Check for more headers in configure.in
Added prototype for inet_aton() in inet_v6defs.h.
Changed "BYTE" token (i.e., #define) in ascend-gramamr.y because it
conflicts with a windows definition. Use HEXBYTE instead.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@1448 f5534014-38df-0310-8fa8-9805f1628bb7

18 files changed:
config.h.win32
configure.in
dfilter-scanner.l
gtk/gtkclist.c
inet_aton.c
inet_ntop.c
inet_pton.c
inet_v6defs.h
packet-bgp.c
packet.c
resolv.c
util.c
wiretap/ascend-grammar.y
wiretap/ascend-scanner.l
wiretap/ascend.c
wiretap/config.h.win32
wiretap/configure.in
wiretap/file.c

index 78888f85f395cb6e4d0ddc22a1ed9c6e452a4c5f..dbc4479a1f29b4fb2e576f0544573c18b431c177 100644 (file)
 /* Version number of package */
 #define VERSION "0.8.0"
 
-#define HAVE_WINSOCK_H
-#define snprintf _snprintf
-#define vsnprintf _vsnprintf
-#define HAVE_DIRECT_H
-#define HAVE_IO_H
-#define strncasecmp strnicmp
+#define HAVE_WINSOCK_H          1
+#define HAVE_DIRECT_H           1
+#define HAVE_IO_H               1
+#define NEED_INET_V6DEFS_H      1
+#define snprintf                _snprintf
+#define vsnprintf               _vsnprintf
+#define strncasecmp             strnicmp
+#define open                    _open
+#define close                   _close
+#define popen                   _popen
+#define pclose                  _pclose
+
index 4bcf0f4c24e0db6e56dc69f41d2476573c98c40b..b3a7dc05776d60af44a0dd996cf1d14d67b5f855 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: configure.in,v 1.71 2000/01/09 20:05:37 guy Exp $
+# $Id: configure.in,v 1.72 2000/01/10 17:32:50 gram Exp $
 dnl
 dnl Process this file with autoconf 2.13 or later to produce a
 dnl configure script; 2.12 doesn't generate a "configure" script that
@@ -154,10 +154,12 @@ fi
 dnl Checks for header files.
 AC_HEADER_STDC
 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h stdarg.h netdb.h)
-AC_CHECK_HEADERS(sys/stat.h sys/sockio.h sys/types.h netinet/in.h sys/socket.h net/if.h)
-AC_CHECK_HEADERS(sys/wait.h)
+AC_CHECK_HEADERS(sys/stat.h sys/sockio.h sys/types.h sys/socket.h)
+AC_CHECK_HEADERS(sys/wait.h sys/param.h)
+AC_CHECK_HEADERS(netinet/in.h net/if.h)
 AC_CHECK_HEADERS(stddef.h)
 AC_CHECK_HEADERS(dlfcn.h)
+AC_CHECK_HEADERS(arpa/inet.h arpa/nameser.h)
 
 dnl SNMP Check
 AC_ARG_ENABLE(snmp,
index 9f60e72deff52bfb68bb66187b533c35d7c4bcbc..08e9a2227bb48e2062da7bcdb3613f2b97b6d126 100644 (file)
@@ -3,7 +3,7 @@
 /* dfilter-scanner.l
  * Scanner for display filters
  *
- * $Id: dfilter-scanner.l,v 1.26 1999/10/19 05:45:45 gram Exp $
+ * $Id: dfilter-scanner.l,v 1.27 2000/01/10 17:32:50 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
 # include "config.h"
 #endif
 
+#ifdef HAVE_IO_H
+#include <io.h>         /* for isatty() on win32 */
+#endif
+
 #ifdef HAVE_SYS_TYPES_H
 # include <sys/types.h>
 #endif
index 43323cdbc5645a54141c65b3cf2c343a71dbfea9..a8130644dd3e0eae02fa3c645ecca75f27885df2 100644 (file)
 #include "gtkclist.h"
 #include <gtk/gtkbindings.h>
 #include <gtk/gtkdnd.h>
+
+#ifdef WIN32
+#include <gdk/win32/gdkwin32.h>
+#else
 #include <gdk/gdkx.h>
+#endif
+
 #include <gdk/gdkkeysyms.h>
 
 /* length of button_actions array */
index 47e044678e642fc8d19f265c49f43c76b923acb0..dd1c039d3acb1cd8d962cd69ddee9e9e6d1bcea0 100644 (file)
  * SUCH DAMAGE.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)inet_addr.c        8.1 (Berkeley) 6/17/93";
 #endif /* LIBC_SCCS and not lint */
 
+#ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
+#endif
+
+#ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
+#endif
+
+#ifdef HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>
+#endif
+
 #include <ctype.h>
 
 /* 
index ff80e4e1f86bf14b9f84764284d3b69a93d3a941..0fc98839701add3ed928a2406f688bf0f8f1d299 100644 (file)
  * SOFTWARE.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$Id: inet_ntop.c,v 1.2 1999/10/14 06:55:08 guy Exp $";
+static char rcsid[] = "$Id: inet_ntop.c,v 1.3 2000/01/10 17:32:51 gram Exp $";
 #endif /* LIBC_SCCS and not lint */
 
-#include "config.h"
-
+#ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
+#endif
+
 #include <sys/types.h>
+
+#ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
+#endif
+
+#ifdef HAVE_WINSOCK_H
+#include <winsock.h>
+#define EAFNOSUPPORT    WSAEAFNOSUPPORT
+#endif
 
+#ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
+#endif
+
+#ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>
+#endif
+
+#ifdef HAVE_ARPA_NAMESER_H
 #include <arpa/nameser.h>
+#endif
 
 #include <errno.h>
 #include <stdio.h>
index 5e2690779f2faee3b5ae3362a721bca6f2b21264..038f1cad50a04cda9f052882ce000922a6e59792 100644 (file)
  * SOFTWARE.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$Id: inet_pton.c,v 1.2 1999/10/14 06:55:10 guy Exp $";
+static char rcsid[] = "$Id: inet_pton.c,v 1.3 2000/01/10 17:32:51 gram Exp $";
 #endif /* LIBC_SCCS and not lint */
 
+#ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
+#endif
+
 #include <sys/types.h>
+
+#ifdef HAVE_WINSOCK_H
+#include <winsock.h>
+#define EAFNOSUPPORT   WSAEAFNOSUPPORT
+#endif
+
+#ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
+#endif
+
+#ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
+#endif
+
+#ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>
+#endif
+
+#ifdef HAVE_ARPA_NAMESER_H
 #include <arpa/nameser.h>
+#endif
+
 #include <string.h>
 #include <errno.h>
 
index 3d124d83381764114d785452e6c9dc26da5be410..91e86ad8c4c4f8424aedda83801f096c5b502f28 100644 (file)
@@ -1,6 +1,6 @@
 /* inet_pton.h
  *
- * $Id: inet_v6defs.h,v 1.1 1999/10/14 06:55:09 guy Exp $
+ * $Id: inet_v6defs.h,v 1.2 2000/01/10 17:32:51 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -29,6 +29,9 @@ 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);
 
+struct in_addr;
+extern int inet_aton(const char* cp_arg, struct in_addr *addr);
+
 /*
  * 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()".
index d85856b768cdb00308af307fdfdb9fd7b8e30abe..1921388ced77e64e1bd43f5c60552f76ba0b8d2c 100644 (file)
 #include "packet.h"
 #include "packet-bgp.h"
 #include "packet-ipv6.h"
+
+#ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>
+#endif
 
 static const value_string bgptypevals[] = {
     { BGP_OPEN, "OPEN Message" },
index 0a6dcdf405244ca50a3224b5ed3c21fa109ea108..69bd2ac8f5b8406ef18ab673b4578af915f8892a 100644 (file)
--- a/packet.c
+++ b/packet.c
@@ -1,7 +1,7 @@
 /* packet.c
  * Routines for packet disassembly
  *
- * $Id: packet.c,v 1.62 1999/12/29 07:37:12 guy Exp $
+ * $Id: packet.c,v 1.63 2000/01/10 17:32:52 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -55,7 +55,9 @@
 # include <netinet/in.h>
 #endif
 
+#ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>
+#endif
 
 #ifdef NEED_INET_V6DEFS_H
 # include "inet_v6defs.h"
index 120df6c6712177bc492133e4c5a45ca8fe1237b5..56afa5babff5ca43c72b1ec64e17f37da3326695 100644 (file)
--- a/resolv.c
+++ b/resolv.c
@@ -1,7 +1,7 @@
 /* resolv.c
  * Routines for network object lookup
  *
- * $Id: resolv.c,v 1.21 1999/11/22 06:03:46 gram Exp $
+ * $Id: resolv.c,v 1.22 2000/01/10 17:32:52 gram Exp $
  *
  * Laurent Deniel <deniel@worldnet.fr>
  *
@@ -55,7 +55,9 @@
 #include <netdb.h>
 #endif
 
+#ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>
+#endif
 
 #include <signal.h>
 
diff --git a/util.c b/util.c
index 3b52a0490a99e81a4d2301110008734adf87647f..18c914ed2dbecd5e92be5b1d12764a6734c6f99a 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1,7 +1,7 @@
 /* util.c
  * Utility routines
  *
- * $Id: util.c,v 1.24 1999/12/09 07:19:05 guy Exp $
+ * $Id: util.c,v 1.25 2000/01/10 17:32:53 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
 
 #include "util.h"
 
+#ifdef HAVE_IO_H
+#include <io.h>
+typedef int mode_t;    /* for win32 */
+#endif
+
 static char *
 setup_tmpdir(char *dir)
 {
index 6a5dcbc168ad98b81114d803f6b83c3411b9a3ed..3ba28646e81901d071c2b86e155317a0b3ea1f6e 100644 (file)
@@ -1,7 +1,7 @@
 %{
 /* ascend-grammar.y
  *
- * $Id: ascend-grammar.y,v 1.8 1999/10/31 19:34:46 guy Exp $
+ * $Id: ascend-grammar.y,v 1.9 2000/01/10 17:33:16 gram Exp $
  *
  * Wiretap Library
  * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@@ -87,7 +87,7 @@ char    b;
 
 %token <s> STRING KEYWORD COUNTER
 %token <d> WDS_PREFIX DECNUM HEXNUM
-%token <b> BYTE
+%token <b> HEXBYTE
 
 %type <s> string dataln datagroup
 %type <d> wds_prefix decnum hexnum
@@ -164,7 +164,7 @@ wdd_hdr: KEYWORD decnum decnum decnum KEYWORD decnum decnum decnum KEYWORD strin
 }
 ;
  
-byte: BYTE {
+byte: HEXBYTE {
   if (bcur < caplen) {
     pkt_data[bcur] = $1;
     bcur++;
index 2ed89de7c2a3676919fef2f3c0c00899c999b93d..bb09b69912e4a01ca457c88f3df4b543564338f3 100644 (file)
@@ -1,7 +1,7 @@
 %{
 /* ascend-scanner.l
  *
- * $Id: ascend-scanner.l,v 1.9 1999/11/24 19:29:45 guy Exp $
+ * $Id: ascend-scanner.l,v 1.10 2000/01/10 17:33:16 gram Exp $
  *
  * Wiretap Library
  * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+
+#ifdef HAVE_IO_H
+#include <io.h>        /* for isatty() on win32 */
+#endif
+
 #include "wtap.h"
 #include "ascend.h"
 #include "ascend-grammar.h"
@@ -151,7 +156,7 @@ WDD_TYPE    "type "[^\n\r\t ]+
 
 <sc_gen_byte>{H}{2} {
   ascendlval.b = strtol(ascendtext, NULL, 16);
-  return BYTE;
+  return HEXBYTE;
 }
 
 <INITIAL,sc_gen_byte>{WDD_DATE} {
index a5d735ce05ef23c1204a17c2ec43b7d23b802fc9..4d90b1b7340d47489bcd31cd2719ab9995fe53f1 100644 (file)
@@ -1,6 +1,6 @@
 /* ascend.c
  *
- * $Id: ascend.c,v 1.9 1999/10/28 01:42:43 gerald Exp $
+ * $Id: ascend.c,v 1.10 2000/01/10 17:33:16 gram Exp $
  *
  * Wiretap Library
  * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
 #include "file.h"
 
 #include <sys/stat.h>
+
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
+
 #include <ctype.h>
 #include <string.h>
 
index ea0d457c1fa0bfc7db160d08bf5f01828acc6216..249df566d252095fccbaf2c0c5a69f1061e94ddf 100644 (file)
@@ -25,4 +25,7 @@
 /* Version number of package */
 #define VERSION "0.0.0"
 
-#define HAVE_WINSOCK_H
+#define HAVE_WINSOCK_H         1
+#define HAVE_IO_H              1
+#define open                   _open
+#define close                  _close
index f3bf9d3f0df44ff1a084ebcfff261c0b6b5af83e..dbd1c9ea7ee6b1f40b075282a44624affb73c5b2 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: configure.in,v 1.18 1999/12/04 05:14:38 guy Exp $
+# $Id: configure.in,v 1.19 2000/01/10 17:33:17 gram Exp $
 dnl
 dnl Process this file with autoconf 2.13 or later to produce a
 dnl configure script; 2.12 doesn't generate a "configure" script that
@@ -87,7 +87,7 @@ dnl defined, have it take an "off_t" as its second argument, and
 dnl put it into a file that doesn't require HAVE_UNISTD_H.
 dnl
 AC_HEADER_STDC
-AC_CHECK_HEADERS(sys/time.h netinet/in.h)
+AC_CHECK_HEADERS(sys/time.h netinet/in.h unistd.h)
 
 AC_CANONICAL_HOST
 
index ed98dd80b405b751554596c1d6db041e68085d20..5ae3a0431e56c24980fa2120cb1a6ead71a26fe5 100644 (file)
@@ -1,6 +1,6 @@
 /* file.c
  *
- * $Id: file.c,v 1.43 1999/12/15 01:34:17 guy Exp $
+ * $Id: file.c,v 1.44 2000/01/10 17:33:17 gram Exp $
  *
  * Wiretap Library
  * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+
 #include <stdio.h>
 #include <fcntl.h>
 #include <string.h>
 #include <stdlib.h>
 #include <sys/stat.h>
 #include <errno.h>
+
+#ifdef HAVE_IO_H
+#include <io.h>        /* open/close on win32 */
+#endif
+
 #include "wtap.h"
 #include "file.h"
 #include "buffer.h"