aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>1999-07-13 02:53:26 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>1999-07-13 02:53:26 +0000
commit601c52f0fb7d36599045e90a6baafe918997f644 (patch)
tree4ddecf128133922607a7f2d194c4d36601690f1e /file.c
parent093f28c38214ac4389826e72e18bca01ff08956d (diff)
Added support for compiling on win32 with Visual C and 'nmake'. It compiles,
but does not link. Perhaps someone who understands the MS tools can help out. I made it link a few months ago, but with different version of glib/gtk+. I can't remember how I made it link. Most of the compatibility issues were resolved with adding #ifdef HAVE_UNISTD_H the the source code. Please be sure to add this to all future code. svn path=/trunk/; revision=359
Diffstat (limited to 'file.c')
-rw-r--r--file.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/file.c b/file.c
index 7813e8288a..c059ca8504 100644
--- a/file.c
+++ b/file.c
@@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
- * $Id: file.c,v 1.36 1999/07/11 08:40:52 guy Exp $
+ * $Id: file.c,v 1.37 1999/07/13 02:52:49 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -30,7 +30,15 @@
#include <gtk/gtk.h>
#include <stdio.h>
+
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
+
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+
#include <string.h>
#include <sys/stat.h>
#include <errno.h>
@@ -86,7 +94,9 @@ static void wtap_dispatch_cb(u_char *, const struct wtap_pkthdr *, int,
static void init_col_widths(capture_file *);
static void set_col_widths(capture_file *);
+#ifdef HAVE_LIBPCAP
static gint tail_timeout_cb(gpointer);
+#endif
int
open_cap_file(char *fname, capture_file *cf) {
@@ -95,8 +105,10 @@ open_cap_file(char *fname, capture_file *cf) {
/* First, make sure the file is valid */
if (stat(fname, &cf_stat))
return (errno);
+#ifndef WIN32
if (! S_ISREG(cf_stat.st_mode) && ! S_ISFIFO(cf_stat.st_mode))
return (OPEN_CAP_FILE_NOT_REGULAR);
+#endif
/* Next, try to open the file */
cf->fh = fopen(fname, "r");
@@ -259,6 +271,7 @@ load_cap_file(char *fname, capture_file *cf) {
return err;
}
+#ifdef HAVE_LIBPCAP
void
cap_file_input_cb (gpointer data, gint source, GdkInputCondition condition) {
@@ -404,6 +417,7 @@ tail_cap_file(char *fname, capture_file *cf) {
}
return err;
}
+#endif
static void
compute_time_stamps(frame_data *fdata, capture_file *cf)
@@ -690,16 +704,20 @@ file_mv(char *from, char *to)
int retval;
+#ifndef WIN32
/* try a hard link */
retval = link(from, to);
/* or try a copy */
if (retval < 0) {
+#endif
retval = file_cp(from, to);
if (!retval) {
return 0;
}
+#ifndef WIN32
}
+#endif
unlink(from);
return 1;