summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorrisso <risso>2002-08-01 08:52:55 +0000
committerrisso <risso>2002-08-01 08:52:55 +0000
commit3d932490b826facb568937a1290910a1265267f5 (patch)
tree65e999a8071b1f4bad5c7d437d3846b777f302db /util.c
parente5ec03a25c981b8df7f81fe6f91deb4879524065 (diff)
downloadtcpdump-3d932490b826facb568937a1290910a1265267f5.tar.gz
Added support for Win32, based on WinPcap.
Diffstat (limited to 'util.c')
-rw-r--r--util.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/util.c b/util.c
index 3c396a23..32278bf3 100644
--- a/util.c
+++ b/util.c
@@ -21,19 +21,17 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.76 2002-07-18 00:04:12 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.77 2002-08-01 08:53:37 risso Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/file.h>
+#include <tcpdump-stdinc.h>
+
#include <sys/stat.h>
-#include <ctype.h>
#include <errno.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
@@ -46,7 +44,6 @@ static const char rcsid[] =
#ifdef TIME_WITH_SYS_TIME
#include <time.h>
#endif
-#include <unistd.h>
#include "interface.h"
@@ -361,7 +358,16 @@ read_infile(char *fname)
if (cc < 0)
error("read %s: %s", fname, pcap_strerror(errno));
if (cc != buf.st_size)
+#ifndef WIN32
error("short read %s (%d != %d)", fname, cc, (int)buf.st_size);
+#else
+/* Windows seems not to like the final \xa character */
+ {
+ char *pdest;
+ pdest=strchr( cp, '\xa');
+ *pdest=0;
+ }
+#endif WIN32
cp[(int)buf.st_size] = '\0';
return (cp);