aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorAshok Narayanan <ashokn@cisco.com>1999-09-23 04:39:01 +0000
committerAshok Narayanan <ashokn@cisco.com>1999-09-23 04:39:01 +0000
commit501b9b05e19391fba0e33751b41bb6a47063491a (patch)
tree5c1982f3297f1cf679f2cbb229df4b37f895a1da /wiretap
parent5953b86866ee16efb2badc9603080e90fa9f86d6 (diff)
Adds progress bar functionality back for loading files (it was changed to
bounce bar for compressed file support). Note that the progress bar may not grow smoothly for compressed files, but it should be reasonably accurate for files which are large enough to matter. svn path=/trunk/; revision=701
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/ascend-scanner.l5
-rw-r--r--wiretap/file.c11
-rw-r--r--wiretap/wtap.c7
-rw-r--r--wiretap/wtap.h4
4 files changed, 22 insertions, 5 deletions
diff --git a/wiretap/ascend-scanner.l b/wiretap/ascend-scanner.l
index c80b208dd1..4d8a59c7ca 100644
--- a/wiretap/ascend-scanner.l
+++ b/wiretap/ascend-scanner.l
@@ -12,7 +12,10 @@
#include "file.h"
void *yy_fh;
-#define YY_INPUT(buf,result,max_size) { int c = file_getc(yy_fh); result = (c==EOF) ? YY_NULL : (buf[0] = c, 1); }
+extern char *ascend_ra_ptr;
+extern char *ascend_ra_last;
+#define YY_INPUT(buf,result,max_size) { int c = file_getc(yy_fh); \
+result = (c==EOF) ? YY_NULL : (buf[0] = c, 1); }
struct ascend_phdr *pseudo_header;
diff --git a/wiretap/file.c b/wiretap/file.c
index 128e1fe413..a10472984d 100644
--- a/wiretap/file.c
+++ b/wiretap/file.c
@@ -1,6 +1,6 @@
/* file.c
*
- * $Id: file.c,v 1.21 1999/09/22 01:26:46 ashokn Exp $
+ * $Id: file.c,v 1.22 1999/09/23 04:39:00 ashokn Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@@ -24,6 +24,7 @@
#include "config.h"
#endif
#include <stdio.h>
+#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
@@ -106,7 +107,12 @@ wtap* wtap_open_offline(const char *filename, int *err)
/* Open the file */
errno = WTAP_ERR_CANT_OPEN;
- if (!(wth->fh = file_open(filename, "rb"))) {
+ if (!(wth->fd = open(filename, O_RDONLY))) {
+ *err = errno;
+ free(wth);
+ return NULL;
+ }
+ if (!(wth->fh = filed_open(wth->fd, "rb"))) {
*err = errno;
free(wth);
return NULL;
@@ -124,6 +130,7 @@ wtap* wtap_open_offline(const char *filename, int *err)
/* I/O error - give up */
*err = errno;
file_close(wth->fh);
+ close(wth->fd);
free(wth);
return NULL;
diff --git a/wiretap/wtap.c b/wiretap/wtap.c
index 0b5b5090f8..4e68f7bd59 100644
--- a/wiretap/wtap.c
+++ b/wiretap/wtap.c
@@ -1,6 +1,6 @@
/* wtap.c
*
- * $Id: wtap.c,v 1.20 1999/09/22 01:26:50 ashokn Exp $
+ * $Id: wtap.c,v 1.21 1999/09/23 04:39:00 ashokn Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@@ -36,6 +36,11 @@ FILE* wtap_file(wtap *wth)
return wth->fh;
}
+int wtap_fd(wtap *wth)
+{
+ return wth->fd;
+}
+
int wtap_file_type(wtap *wth)
{
return wth->file_type;
diff --git a/wiretap/wtap.h b/wiretap/wtap.h
index 799942151d..e468b17a1f 100644
--- a/wiretap/wtap.h
+++ b/wiretap/wtap.h
@@ -1,6 +1,6 @@
/* wtap.h
*
- * $Id: wtap.h,v 1.39 1999/09/22 01:26:50 ashokn Exp $
+ * $Id: wtap.h,v 1.40 1999/09/23 04:39:01 ashokn Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@@ -284,6 +284,7 @@ typedef int (*subtype_read_func)(struct wtap*, int*);
typedef struct wtap {
/* FILE_T fh; */
void * fh;
+ int fd; /* File descriptor for cap file */
int file_type;
int snapshot_length;
struct Buffer *frame_buffer;
@@ -335,6 +336,7 @@ wtap* wtap_open_offline(const char *filename, int *err);
int wtap_loop(wtap *wth, int, wtap_handler, u_char*, int*);
FILE* wtap_file(wtap *wth);
+int wtap_fd(wtap *wth);
int wtap_snapshot_length(wtap *wth); /* per file */
int wtap_file_type(wtap *wth);
const char *wtap_file_type_string(wtap *wth);