Move the file utility functions from wiretap to libwsutil so that

libwireshark (and the plugins using those functions) do not depend on
wiretap on Windows.

While doing that, rename the eth_* functions to ws_*.

svn path=/trunk/; revision=25354
This commit is contained in:
Jeff Morriss 2008-05-22 15:46:27 +00:00
parent da2f447a9b
commit a5cee04fad
108 changed files with 986 additions and 997 deletions

View File

@ -45,6 +45,7 @@ EXTRA_OBJECTS = \
wireshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \ wireshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
wsock32.lib user32.lib shell32.lib comctl32.lib \ wsock32.lib user32.lib shell32.lib comctl32.lib \
$(HHC_LIBS) \ $(HHC_LIBS) \
wsutil\libwsutil.lib \
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
epan\libwireshark.lib \ epan\libwireshark.lib \
!ELSE !ELSE
@ -53,7 +54,6 @@ wireshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
epan\crypt\airpdcap.lib \ epan\crypt\airpdcap.lib \
epan\dfilter\dfilter.lib \ epan\dfilter\dfilter.lib \
epan\ftypes\ftypes.lib \ epan\ftypes\ftypes.lib \
wsutil\libwsutil.lib \
$(ADNS_LIBS) \ $(ADNS_LIBS) \
$(PCRE_LIBS) \ $(PCRE_LIBS) \
$(ZLIB_LIBS) \ $(ZLIB_LIBS) \
@ -63,6 +63,7 @@ wireshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
tshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \ tshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
wsock32.lib user32.lib \ wsock32.lib user32.lib \
$(GLIB_LIBS) \ $(GLIB_LIBS) \
wsutil\libwsutil.lib \
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
epan\libwireshark.lib \ epan\libwireshark.lib \
!ELSE !ELSE
@ -71,7 +72,6 @@ tshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
epan\crypt\airpdcap.lib \ epan\crypt\airpdcap.lib \
epan\dfilter\dfilter.lib \ epan\dfilter\dfilter.lib \
epan\ftypes\ftypes.lib \ epan\ftypes\ftypes.lib \
wsutil\libwsutil.lib \
$(ADNS_LIBS) \ $(ADNS_LIBS) \
$(PCRE_LIBS) \ $(PCRE_LIBS) \
$(ZLIB_LIBS) \ $(ZLIB_LIBS) \
@ -81,6 +81,7 @@ tshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
rawshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \ rawshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
wsock32.lib user32.lib \ wsock32.lib user32.lib \
$(GLIB_LIBS) \ $(GLIB_LIBS) \
wsutil\libwsutil.lib \
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
epan\libwireshark.lib \ epan\libwireshark.lib \
!ELSE !ELSE
@ -89,7 +90,6 @@ rawshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
epan\crypt\airpdcap.lib \ epan\crypt\airpdcap.lib \
epan\dfilter\dfilter.lib \ epan\dfilter\dfilter.lib \
epan\ftypes\ftypes.lib \ epan\ftypes\ftypes.lib \
wsutil\libwsutil.lib \
$(ADNS_LIBS) \ $(ADNS_LIBS) \
$(PCRE_LIBS) \ $(PCRE_LIBS) \
$(ZLIB_LIBS) \ $(ZLIB_LIBS) \
@ -124,13 +124,13 @@ dumpcap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
dftest_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \ dftest_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
wsock32.lib user32.lib \ wsock32.lib user32.lib \
$(GLIB_LIBS) \ $(GLIB_LIBS) \
wsutil\libwsutil.lib \
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
epan\libwireshark.lib \ epan\libwireshark.lib \
!ELSE !ELSE
epan\dissectors\dissectors.lib \ epan\dissectors\dissectors.lib \
epan\wireshark.lib \ epan\wireshark.lib \
epan\dfilter\dfilter.lib epan\ftypes\ftypes.lib \ epan\dfilter\dfilter.lib epan\ftypes\ftypes.lib \
wsutil\libwsutil.lib \
$(ADNS_LIBS) \ $(ADNS_LIBS) \
$(PCRE_LIBS) \ $(PCRE_LIBS) \
$(ZLIB_LIBS) \ $(ZLIB_LIBS) \

View File

@ -90,7 +90,7 @@
#include "capture-wpcap.h" #include "capture-wpcap.h"
#endif #endif
#include "ui_util.h" #include "ui_util.h"
#include "file_util.h" #include "wsutil/file_util.h"
#include "log.h" #include "log.h"
typedef struct if_stat_cache_item_s { typedef struct if_stat_cache_item_s {
@ -580,7 +580,7 @@ capture_input_closed(capture_options *capture_opts)
if(capture_opts->restart) { if(capture_opts->restart) {
capture_opts->restart = FALSE; capture_opts->restart = FALSE;
eth_unlink(capture_opts->save_file); ws_unlink(capture_opts->save_file);
/* if it was a tempfile, throw away the old filename (so it will become a tempfile again) */ /* if it was a tempfile, throw away the old filename (so it will become a tempfile again) */
if(cf_is_tempfile(capture_opts->cf)) { if(cf_is_tempfile(capture_opts->cf)) {

View File

@ -69,7 +69,7 @@
#include "cmdarg_err.h" #include "cmdarg_err.h"
#include "capture-pcap-util.h" #include "capture-pcap-util.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
typedef struct { typedef struct {
char *name; char *name;
@ -877,7 +877,7 @@ static int capture_opts_test_for_fifo(const char *path)
{ {
struct stat statb; struct stat statb;
if (eth_stat(path, &statb) < 0) if (ws_stat(path, &statb) < 0)
return errno; return errno;
if (S_ISFIFO(statb.st_mode)) if (S_ISFIFO(statb.st_mode))

View File

@ -98,7 +98,7 @@
#include "capture-wpcap.h" #include "capture-wpcap.h"
#endif #endif
#include "ui_util.h" #include "ui_util.h"
#include "file_util.h" #include <wsutil/file_util.h>
#include "log.h" #include "log.h"
#ifdef _WIN32 #ifdef _WIN32
@ -506,7 +506,7 @@ sync_pipe_start(capture_options *capture_opts) {
* it just capture with the specified capture parameters * it just capture with the specified capture parameters
*/ */
dup2(sync_pipe[PIPE_WRITE], 2); dup2(sync_pipe[PIPE_WRITE], 2);
eth_close(sync_pipe[PIPE_READ]); ws_close(sync_pipe[PIPE_READ]);
execv(argv[0], (gpointer)argv); execv(argv[0], (gpointer)argv);
g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s", g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s",
argv[0], strerror(errno)); argv[0], strerror(errno));
@ -538,15 +538,15 @@ sync_pipe_start(capture_options *capture_opts) {
#ifdef _WIN32 #ifdef _WIN32
CloseHandle(sync_pipe_write); CloseHandle(sync_pipe_write);
#else #else
eth_close(sync_pipe[PIPE_WRITE]); ws_close(sync_pipe[PIPE_WRITE]);
#endif #endif
if (capture_opts->fork_child == -1) { if (capture_opts->fork_child == -1) {
/* We couldn't even create the child process. */ /* We couldn't even create the child process. */
report_failure("Couldn't create child process: %s", strerror(errno)); report_failure("Couldn't create child process: %s", strerror(errno));
eth_close(sync_pipe_read_fd); ws_close(sync_pipe_read_fd);
#ifdef _WIN32 #ifdef _WIN32
eth_close(capture_opts->signal_pipe_write_fd); ws_close(capture_opts->signal_pipe_write_fd);
#endif #endif
return FALSE; return FALSE;
} }
@ -679,7 +679,7 @@ sync_pipe_open_command(const char** argv, int *read_fd, int *fork_child, gchar *
* it just capture with the specified capture parameters * it just capture with the specified capture parameters
*/ */
dup2(sync_pipe[PIPE_WRITE], 1); dup2(sync_pipe[PIPE_WRITE], 1);
eth_close(sync_pipe[PIPE_READ]); ws_close(sync_pipe[PIPE_READ]);
execv(argv[0], (gpointer)argv); execv(argv[0], (gpointer)argv);
g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s", g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s",
argv[0], strerror(errno)); argv[0], strerror(errno));
@ -711,13 +711,13 @@ sync_pipe_open_command(const char** argv, int *read_fd, int *fork_child, gchar *
#ifdef _WIN32 #ifdef _WIN32
CloseHandle(sync_pipe_write); CloseHandle(sync_pipe_write);
#else #else
eth_close(sync_pipe[PIPE_WRITE]); ws_close(sync_pipe[PIPE_WRITE]);
#endif #endif
if (*fork_child == -1) { if (*fork_child == -1) {
/* We couldn't even create the child process. */ /* We couldn't even create the child process. */
*msg = g_strdup_printf("Couldn't create child process: %s", strerror(errno)); *msg = g_strdup_printf("Couldn't create child process: %s", strerror(errno));
eth_close(*read_fd); ws_close(*read_fd);
return CANT_RUN_DUMPCAP; return CANT_RUN_DUMPCAP;
} }
@ -734,7 +734,7 @@ sync_pipe_close_command(int *read_fd, gchar **msg) {
#endif #endif
int fork_child_status; int fork_child_status;
eth_close(*read_fd); ws_close(*read_fd);
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "sync_pipe_close_command: wait till child closed"); g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "sync_pipe_close_command: wait till child closed");
@ -801,7 +801,7 @@ sync_pipe_run_command(const char** argv, gchar **msg) {
/* We were able to set up to read dumpcap's output. Do so and /* We were able to set up to read dumpcap's output. Do so and
return its exit value. */ return its exit value. */
msg_buf = g_string_new(""); msg_buf = g_string_new("");
while ((count = eth_read(sync_pipe_read_fd, buf, PIPE_BUF_SIZE)) > 0) { while ((count = ws_read(sync_pipe_read_fd, buf, PIPE_BUF_SIZE)) > 0) {
buf[count] = '\0'; buf[count] = '\0';
g_string_append(msg_buf, buf); g_string_append(msg_buf, buf);
} }
@ -1181,7 +1181,7 @@ sync_pipe_input_cb(gint source, gpointer user_data)
sync_pipe_wait_for_child(capture_opts); sync_pipe_wait_for_child(capture_opts);
#ifdef _WIN32 #ifdef _WIN32
eth_close(capture_opts->signal_pipe_write_fd); ws_close(capture_opts->signal_pipe_write_fd);
#endif #endif
capture_input_closed(capture_opts); capture_input_closed(capture_opts);
return FALSE; return FALSE;
@ -1195,7 +1195,7 @@ sync_pipe_input_cb(gint source, gpointer user_data)
/* We weren't able to open the new capture file; user has been /* We weren't able to open the new capture file; user has been
alerted. Close the sync pipe. */ alerted. Close the sync pipe. */
eth_close(source); ws_close(source);
/* the child has send us a filename which we couldn't open. /* the child has send us a filename which we couldn't open.
this probably means, the child is creating files faster than we can handle it. this probably means, the child is creating files faster than we can handle it.

View File

@ -34,7 +34,7 @@
#include <string.h> #include <string.h>
#include <epan/filesystem.h> #include <epan/filesystem.h>
#include "file_util.h" #include <wsutil/file_util.h>
#include <epan/packet.h> #include <epan/packet.h>
#include "color.h" #include "color.h"
@ -630,7 +630,7 @@ read_users_filters(GSList **cfl)
/* decide what file to open (from dfilter code) */ /* decide what file to open (from dfilter code) */
path = get_persconffile_path("colorfilters", TRUE, FALSE); path = get_persconffile_path("colorfilters", TRUE, FALSE);
if ((f = eth_fopen(path, "r")) == NULL) { if ((f = ws_fopen(path, "r")) == NULL) {
if (errno != ENOENT) { if (errno != ENOENT) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Could not open filter file\n\"%s\": %s.", path, "Could not open filter file\n\"%s\": %s.", path,
@ -657,7 +657,7 @@ color_filters_read_globals(gpointer user_data)
/* decide what file to open (from dfilter code) */ /* decide what file to open (from dfilter code) */
path = get_datafile_path("colorfilters"); path = get_datafile_path("colorfilters");
if ((f = eth_fopen(path, "r")) == NULL) { if ((f = ws_fopen(path, "r")) == NULL) {
if (errno != ENOENT) { if (errno != ENOENT) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Could not open global filter file\n\"%s\": %s.", path, "Could not open global filter file\n\"%s\": %s.", path,
@ -681,7 +681,7 @@ color_filters_import(gchar *path, gpointer user_data)
FILE *f; FILE *f;
gboolean ret; gboolean ret;
if ((f = eth_fopen(path, "r")) == NULL) { if ((f = ws_fopen(path, "r")) == NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Could not open\n%s\nfor reading: %s.", "Could not open\n%s\nfor reading: %s.",
path, strerror(errno)); path, strerror(errno));
@ -755,7 +755,7 @@ color_filters_write(GSList *cfl)
} }
path = get_persconffile_path("colorfilters", TRUE, TRUE); path = get_persconffile_path("colorfilters", TRUE, TRUE);
if ((f = eth_fopen(path, "w+")) == NULL) { if ((f = ws_fopen(path, "w+")) == NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Could not open\n%s\nfor writing: %s.", "Could not open\n%s\nfor writing: %s.",
path, strerror(errno)); path, strerror(errno));
@ -774,7 +774,7 @@ color_filters_export(gchar *path, GSList *cfl, gboolean only_marked)
{ {
FILE *f; FILE *f;
if ((f = eth_fopen(path, "w+")) == NULL) { if ((f = ws_fopen(path, "w+")) == NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Could not open\n%s\nfor writing: %s.", "Could not open\n%s\nfor writing: %s.",
path, strerror(errno)); path, strerror(errno));

View File

@ -41,7 +41,7 @@
#include <epan/proto.h> #include <epan/proto.h>
#include "disabled_protos.h" #include "disabled_protos.h"
#include "file_util.h" #include <wsutil/file_util.h>
#define GLOBAL_PROTOCOLS_FILE_NAME "disabled_protos" #define GLOBAL_PROTOCOLS_FILE_NAME "disabled_protos"
#define PROTOCOLS_FILE_NAME "disabled_protos" #define PROTOCOLS_FILE_NAME "disabled_protos"
@ -104,7 +104,7 @@ read_disabled_protos_list(char **gpath_return, int *gopen_errno_return,
/* Read the global disabled protocols file, if it exists. */ /* Read the global disabled protocols file, if it exists. */
*gpath_return = NULL; *gpath_return = NULL;
if ((ff = eth_fopen(gff_path, "r")) != NULL) { if ((ff = ws_fopen(gff_path, "r")) != NULL) {
/* We succeeded in opening it; read it. */ /* We succeeded in opening it; read it. */
err = read_disabled_protos_list_file(gff_path, ff, err = read_disabled_protos_list_file(gff_path, ff,
&global_disabled_protos); &global_disabled_protos);
@ -137,7 +137,7 @@ read_disabled_protos_list(char **gpath_return, int *gopen_errno_return,
/* Read the user's disabled protocols file, if it exists. */ /* Read the user's disabled protocols file, if it exists. */
*path_return = NULL; *path_return = NULL;
if ((ff = eth_fopen(ff_path, "r")) != NULL) { if ((ff = ws_fopen(ff_path, "r")) != NULL) {
/* We succeeded in opening it; read it. */ /* We succeeded in opening it; read it. */
err = read_disabled_protos_list_file(ff_path, ff, &disabled_protos); err = read_disabled_protos_list_file(ff_path, ff, &disabled_protos);
if (err != 0) { if (err != 0) {
@ -345,7 +345,7 @@ save_disabled_protos_list(char **pref_path_return, int *errno_return)
completely. */ completely. */
ff_path_new = g_strdup_printf("%s.new", ff_path); ff_path_new = g_strdup_printf("%s.new", ff_path);
if ((ff = eth_fopen(ff_path_new, "w")) == NULL) { if ((ff = ws_fopen(ff_path_new, "w")) == NULL) {
*pref_path_return = ff_path; *pref_path_return = ff_path;
*errno_return = errno; *errno_return = errno;
g_free(ff_path_new); g_free(ff_path_new);
@ -373,7 +373,7 @@ save_disabled_protos_list(char **pref_path_return, int *errno_return)
if (fclose(ff) == EOF) { if (fclose(ff) == EOF) {
*pref_path_return = ff_path; *pref_path_return = ff_path;
*errno_return = errno; *errno_return = errno;
eth_unlink(ff_path_new); ws_unlink(ff_path_new);
g_free(ff_path_new); g_free(ff_path_new);
return; return;
} }
@ -383,22 +383,22 @@ save_disabled_protos_list(char **pref_path_return, int *errno_return)
exists; the Win32 call to rename files doesn't do so, which I exists; the Win32 call to rename files doesn't do so, which I
infer is the reason why the MSVC++ "rename()" doesn't do so. infer is the reason why the MSVC++ "rename()" doesn't do so.
We must therefore remove the target file first, on Windows. */ We must therefore remove the target file first, on Windows. */
if (eth_remove(ff_path) < 0 && errno != ENOENT) { if (ws_remove(ff_path) < 0 && errno != ENOENT) {
/* It failed for some reason other than "it's not there"; if /* It failed for some reason other than "it's not there"; if
it's not there, we don't need to remove it, so we just it's not there, we don't need to remove it, so we just
drive on. */ drive on. */
*pref_path_return = ff_path; *pref_path_return = ff_path;
*errno_return = errno; *errno_return = errno;
eth_unlink(ff_path_new); ws_unlink(ff_path_new);
g_free(ff_path_new); g_free(ff_path_new);
return; return;
} }
#endif #endif
if (eth_rename(ff_path_new, ff_path) < 0) { if (ws_rename(ff_path_new, ff_path) < 0) {
*pref_path_return = ff_path; *pref_path_return = ff_path;
*errno_return = errno; *errno_return = errno;
eth_unlink(ff_path_new); ws_unlink(ff_path_new);
g_free(ff_path_new); g_free(ff_path_new);
return; return;
} }

View File

@ -94,7 +94,7 @@
#include "tempfile.h" #include "tempfile.h"
#include "log.h" #include "log.h"
#include "file_util.h" #include "wsutil/file_util.h"
/* /*
* Get information about libpcap format from "wiretap/libpcap.h". * Get information about libpcap format from "wiretap/libpcap.h".
@ -689,7 +689,7 @@ cap_pipe_open_live(char *pipename, struct pcap_hdr *hdr, loop_data *ld,
#endif /* _WIN32 */ #endif /* _WIN32 */
} else { } else {
#ifndef _WIN32 #ifndef _WIN32
if (eth_stat(pipename, &pipe_stat) < 0) { if (ws_stat(pipename, &pipe_stat) < 0) {
if (errno == ENOENT || errno == ENOTDIR) if (errno == ENOENT || errno == ENOTDIR)
ld->cap_pipe_err = PIPNEXIST; ld->cap_pipe_err = PIPNEXIST;
else { else {
@ -716,7 +716,7 @@ cap_pipe_open_live(char *pipename, struct pcap_hdr *hdr, loop_data *ld,
} }
return -1; return -1;
} }
fd = eth_open(pipename, O_RDONLY | O_NONBLOCK, 0000 /* no creation so don't matter */); fd = ws_open(pipename, O_RDONLY | O_NONBLOCK, 0000 /* no creation so don't matter */);
if (fd == -1) { if (fd == -1) {
g_snprintf(errmsg, errmsgl, g_snprintf(errmsg, errmsgl,
"The capture session could not be initiated " "The capture session could not be initiated "
@ -891,7 +891,7 @@ cap_pipe_open_live(char *pipename, struct pcap_hdr *hdr, loop_data *ld,
error: error:
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "cap_pipe_open_live: error %s", errmsg); g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "cap_pipe_open_live: error %s", errmsg);
ld->cap_pipe_err = PIPERR; ld->cap_pipe_err = PIPERR;
eth_close(fd); ws_close(fd);
return -1; return -1;
} }
@ -1288,7 +1288,7 @@ static void capture_loop_close_input(loop_data *ld) {
/* if open, close the capture pipe "input file" */ /* if open, close the capture pipe "input file" */
if (ld->cap_pipe_fd >= 0) { if (ld->cap_pipe_fd >= 0) {
g_assert(ld->from_cap_pipe); g_assert(ld->from_cap_pipe);
eth_close(ld->cap_pipe_fd); ws_close(ld->cap_pipe_fd);
ld->cap_pipe_fd = 0; ld->cap_pipe_fd = 0;
} }
@ -1644,7 +1644,7 @@ capture_loop_open_output(capture_options *capture_opts, int *save_file_fd,
} }
} else { } else {
/* Try to open/create the specified file for use as a capture buffer. */ /* Try to open/create the specified file for use as a capture buffer. */
*save_file_fd = eth_open(capfile_name, O_RDWR|O_BINARY|O_TRUNC|O_CREAT, *save_file_fd = ws_open(capfile_name, O_RDWR|O_BINARY|O_TRUNC|O_CREAT,
0600); 0600);
} }
} }
@ -2094,13 +2094,13 @@ error:
/* We can't use the save file, and we have no FILE * for the stream /* We can't use the save file, and we have no FILE * for the stream
to close in order to close it, so close the FD directly. */ to close in order to close it, so close the FD directly. */
if(save_file_fd != -1) { if(save_file_fd != -1) {
eth_close(save_file_fd); ws_close(save_file_fd);
} }
/* We couldn't even start the capture, so get rid of the capture /* We couldn't even start the capture, so get rid of the capture
file. */ file. */
if(capture_opts->save_file != NULL) { if(capture_opts->save_file != NULL) {
eth_unlink(capture_opts->save_file); ws_unlink(capture_opts->save_file);
g_free(capture_opts->save_file); g_free(capture_opts->save_file);
} }
} }

View File

@ -122,7 +122,7 @@
#include "filesystem.h" #include "filesystem.h"
#include <epan/strutil.h> #include <epan/strutil.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include <epan/prefs.h> #include <epan/prefs.h>
#include <epan/emem.h> #include <epan/emem.h>
@ -465,7 +465,7 @@ static void parse_services_file(const char * path)
static char *buf = NULL; static char *buf = NULL;
/* services hash table initialization */ /* services hash table initialization */
serv_p = eth_fopen(path, "r"); serv_p = ws_fopen(path, "r");
if (serv_p == NULL) if (serv_p == NULL)
return; return;
@ -991,7 +991,7 @@ static void set_ethent(char *path)
if (eth_p) if (eth_p)
rewind(eth_p); rewind(eth_p);
else else
eth_p = eth_fopen(path, "r"); eth_p = ws_fopen(path, "r");
} }
static void end_ethent(void) static void end_ethent(void)
@ -1573,7 +1573,7 @@ static void set_ipxnetent(char *path)
if (ipxnet_p) if (ipxnet_p)
rewind(ipxnet_p); rewind(ipxnet_p);
else else
ipxnet_p = eth_fopen(path, "r"); ipxnet_p = ws_fopen(path, "r");
} }
static void end_ipxnetent(void) static void end_ipxnetent(void)
@ -1798,7 +1798,7 @@ read_hosts_file (const char *hostspath)
* See the hosts(4) or hosts(5) man page for hosts file format * See the hosts(4) or hosts(5) man page for hosts file format
* (not available on all systems). * (not available on all systems).
*/ */
if ((hf = eth_fopen(hostspath, "r")) == NULL) if ((hf = ws_fopen(hostspath, "r")) == NULL)
return FALSE; return FALSE;
while (fgetline(&line, &size, hf) >= 0) { while (fgetline(&line, &size, hf) >= 0) {
@ -1873,7 +1873,7 @@ read_subnets_file (const char *subnetspath)
guint32 host_addr; /* IPv4 ONLY */ guint32 host_addr; /* IPv4 ONLY */
int mask_length; int mask_length;
if ((hf = eth_fopen(subnetspath, "r")) == NULL) if ((hf = ws_fopen(subnetspath, "r")) == NULL)
return FALSE; return FALSE;
while (fgetline(&line, &size, hf) >= 0) { while (fgetline(&line, &size, hf) >= 0) {

View File

@ -38,7 +38,7 @@
#include <epan/uat.h> #include <epan/uat.h>
#include <epan/report_err.h> #include <epan/report_err.h>
#include <epan/proto.h> #include <epan/proto.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
typedef struct { typedef struct {
const char* name; const char* name;
@ -112,7 +112,7 @@ static void macro_fprint(dfilter_macro_t* m, void* ud) {
} }
void dfilter_macro_save(const gchar* filename, gchar** error) { void dfilter_macro_save(const gchar* filename, gchar** error) {
FILE* f = eth_fopen(filename,"w"); FILE* f = ws_fopen(filename,"w");
if (!f) { if (!f) {
*error = ep_strdup_printf("Could not open file: '%s', error: %s\n", filename, strerror(errno) ); *error = ep_strdup_printf("Could not open file: '%s', error: %s\n", filename, strerror(errno) );

View File

@ -59,7 +59,7 @@
#include "emem.h" #include "emem.h"
#include "diam_dict.h" #include "diam_dict.h"
#include "diam_dict_lex.h" #include "diam_dict_lex.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
typedef struct entity_t { typedef struct entity_t {
char* name; char* name;
@ -615,7 +615,7 @@ static FILE* ddict_open(const char* system_directory, const char* filename) {
fname = strdup(filename); fname = strdup(filename);
} }
fh = eth_fopen(fname,"r"); fh = ws_fopen(fname,"r");
D(("fname: %s fh: %p\n",fname,fh)); D(("fname: %s fh: %p\n",fname,fh));

View File

@ -301,7 +301,7 @@
#include "packet-giop.h" #include "packet-giop.h"
#include "packet-tcp.h" #include "packet-tcp.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
/* /*
@ -1291,7 +1291,7 @@ static void read_IOR_strings_from_file(const gchar *name, int max_iorlen) {
gboolean stream_is_big_endian; gboolean stream_is_big_endian;
fp = eth_fopen(name,"r"); /* open read only */ fp = ws_fopen(name,"r"); /* open read only */
if (fp == NULL) { if (fp == NULL) {
if (errno == EACCES) if (errno == EACCES)

View File

@ -56,7 +56,7 @@
#include <nettle/cbc.h> #include <nettle/cbc.h>
#endif #endif
#include <epan/strutil.h> #include <epan/strutil.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#endif #endif
#include <epan/packet.h> #include <epan/packet.h>
@ -3218,7 +3218,7 @@ isakmp_init_protocol(void) {
G_ALLOC_AND_FREE); G_ALLOC_AND_FREE);
if (logf) if (logf)
fclose(logf); fclose(logf);
logf = eth_fopen(pluto_log_path, "r"); logf = ws_fopen(pluto_log_path, "r");
scan_pluto_log(); scan_pluto_log();
#endif /* HAVE_LIBNETTLE */ #endif /* HAVE_LIBNETTLE */

View File

@ -102,7 +102,7 @@
#include <epan/dissectors/packet-gssapi.h> #include <epan/dissectors/packet-gssapi.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#define UDP_PORT_KERBEROS 88 #define UDP_PORT_KERBEROS 88
#define TCP_PORT_KERBEROS 88 #define TCP_PORT_KERBEROS 88
@ -731,7 +731,7 @@ read_keytab_file(const char *service_key_file)
unsigned char buf[SERVICE_KEY_SIZE]; unsigned char buf[SERVICE_KEY_SIZE];
int newline_skip = 0, count = 0; int newline_skip = 0, count = 0;
if (service_key_file != NULL && eth_stat (service_key_file, &st) == 0) { if (service_key_file != NULL && ws_stat (service_key_file, &st) == 0) {
/* The service key file contains raw 192-bit (24 byte) 3DES keys. /* The service key file contains raw 192-bit (24 byte) 3DES keys.
* There can be zero, one (\n), or two (\r\n) characters between * There can be zero, one (\n), or two (\r\n) characters between
@ -749,7 +749,7 @@ read_keytab_file(const char *service_key_file)
} }
} }
skf = eth_fopen(service_key_file, "rb"); skf = ws_fopen(service_key_file, "rb");
if (! skf) return; if (! skf) return;
while (fread(buf, SERVICE_KEY_SIZE, 1, skf) == 1) { while (fread(buf, SERVICE_KEY_SIZE, 1, skf) == 1) {

View File

@ -37,7 +37,7 @@
#include <epan/emem.h> #include <epan/emem.h>
#include <epan/strutil.h> #include <epan/strutil.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
/* /*
* Lookup tables * Lookup tables
@ -2650,7 +2650,7 @@ ssl_parse_key_list(const gchar * keys_list, GHashTable *key_hash, GTree* associa
ip[0], ip[1], ip[2], ip[3], service->port, filename, cert_passwd); ip[0], ip[1], ip[2], ip[3], service->port, filename, cert_passwd);
/* try to load pen or p12 file*/ /* try to load pen or p12 file*/
fp = eth_fopen(filename, "rb"); fp = ws_fopen(filename, "rb");
if (!fp) { if (!fp) {
fprintf(stderr, "can't open file %s \n",filename); fprintf(stderr, "can't open file %s \n",filename);
continue; continue;
@ -2753,7 +2753,7 @@ ssl_set_debug(char* name)
else if (!name || (strcmp(name, "") ==0)) else if (!name || (strcmp(name, "") ==0))
ssl_debug_file = NULL; ssl_debug_file = NULL;
else else
ssl_debug_file = eth_fopen(name, "w"); ssl_debug_file = ws_fopen(name, "w");
if (!use_stderr && ssl_debug_file) if (!use_stderr && ssl_debug_file)
debug_file_must_be_closed = 1; debug_file_must_be_closed = 1;
} }

View File

@ -120,7 +120,7 @@
#include "packet-x509if.h" #include "packet-x509if.h"
#include "packet-ssl.h" #include "packet-ssl.h"
#include "packet-ssl-utils.h" #include "packet-ssl-utils.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
static gboolean ssl_desegment = TRUE; static gboolean ssl_desegment = TRUE;
@ -334,7 +334,7 @@ ssl_parse(void)
if (ssl_keys_list && (ssl_keys_list[0] != 0)) if (ssl_keys_list && (ssl_keys_list[0] != 0))
{ {
if (file_exists(ssl_keys_list)) { if (file_exists(ssl_keys_list)) {
if ((ssl_keys_file = eth_fopen(ssl_keys_list, "r"))) { if ((ssl_keys_file = ws_fopen(ssl_keys_list, "r"))) {
read_failed = FALSE; read_failed = FALSE;
fstat(fileno(ssl_keys_file), &statb); fstat(fileno(ssl_keys_file), &statb);
size = statb.st_size; size = statb.st_size;

View File

@ -36,7 +36,7 @@
#include <glib.h> #include <glib.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include <epan/packet.h> #include <epan/packet.h>
#include <epan/prefs.h> #include <epan/prefs.h>
@ -684,7 +684,7 @@ static gint init_tpncp_db(void) {
g_snprintf(tpncp_dat_file_path, MAX_TPNCP_DAT_FILE_PATH_LEN, "%s" G_DIR_SEPARATOR_S"tpncp" G_DIR_SEPARATOR_S "tpncp.dat", get_datafile_dir()); g_snprintf(tpncp_dat_file_path, MAX_TPNCP_DAT_FILE_PATH_LEN, "%s" G_DIR_SEPARATOR_S"tpncp" G_DIR_SEPARATOR_S "tpncp.dat", get_datafile_dir());
/* Open file with TPNCP data. */ /* Open file with TPNCP data. */
if ((file = eth_fopen(tpncp_dat_file_path, "r")) == NULL) if ((file = ws_fopen(tpncp_dat_file_path, "r")) == NULL)
return (-1); return (-1);
fill_tpncp_id_vals(tpncp_events_id_vals, file); fill_tpncp_id_vals(tpncp_events_id_vals, file);

View File

@ -60,7 +60,7 @@
#include <stdio.h> #include <stdio.h>
#include "dtd.h" #include "dtd.h"
#include "dtd_preparse_lex.h" #include "dtd_preparse_lex.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#define ECHO g_string_append(current,yytext); #define ECHO g_string_append(current,yytext);
@ -196,7 +196,7 @@ extern GString* dtd_preparse(const gchar* dname,const gchar* fname, GString* er
filename = fname; filename = fname;
linenum = 1; linenum = 1;
yyin = eth_fopen(fullname,"r"); yyin = ws_fopen(fullname,"r");
if (!yyin) { if (!yyin) {
if (err) if (err)

View File

@ -44,7 +44,6 @@
#include <glib.h> #include <glib.h>
#include <proto.h> #include <proto.h>
#include "emem.h" #include "emem.h"
#include <wiretap/file_util.h>
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> /* VirtualAlloc, VirtualProtect */ #include <windows.h> /* VirtualAlloc, VirtualProtect */

View File

@ -57,7 +57,7 @@
#include "filesystem.h" #include "filesystem.h"
#include "privileges.h" #include "privileges.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#define PROFILES_DIR "profiles" #define PROFILES_DIR "profiles"
#define U3_MY_CAPTURES "\\My Captures" #define U3_MY_CAPTURES "\\My Captures"
@ -195,7 +195,7 @@ test_for_directory(const char *path)
{ {
struct stat statb; struct stat statb;
if (eth_stat(path, &statb) < 0) if (ws_stat(path, &statb) < 0)
return errno; return errno;
if (S_ISDIR(statb.st_mode)) if (S_ISDIR(statb.st_mode))
@ -209,7 +209,7 @@ test_for_fifo(const char *path)
{ {
struct stat statb; struct stat statb;
if (eth_stat(path, &statb) < 0) if (ws_stat(path, &statb) < 0)
return errno; return errno;
if (S_ISFIFO(statb.st_mode)) if (S_ISFIFO(statb.st_mode))
@ -975,12 +975,12 @@ delete_directory (const char *directory, char **pf_dir_path_return)
gchar *filename; gchar *filename;
int ret = 0; int ret = 0;
if ((dir = eth_dir_open(directory, 0, NULL)) != NULL) { if ((dir = ws_dir_open(directory, 0, NULL)) != NULL) {
while ((file = eth_dir_read_name(dir)) != NULL) { while ((file = ws_dir_read_name(dir)) != NULL) {
filename = g_strdup_printf ("%s%s%s", directory, G_DIR_SEPARATOR_S, filename = g_strdup_printf ("%s%s%s", directory, G_DIR_SEPARATOR_S,
eth_dir_get_name(file)); ws_dir_get_name(file));
if (test_for_directory(filename) != EISDIR) { if (test_for_directory(filename) != EISDIR) {
ret = eth_remove(filename); ret = ws_remove(filename);
#if 0 #if 0
} else { } else {
/* The user has manually created a directory in the profile directory */ /* The user has manually created a directory in the profile directory */
@ -994,10 +994,10 @@ delete_directory (const char *directory, char **pf_dir_path_return)
} }
g_free (filename); g_free (filename);
} }
eth_dir_close(dir); ws_dir_close(dir);
} }
if (ret == 0 && (ret = eth_remove(directory)) != 0) { if (ret == 0 && (ret = ws_remove(directory)) != 0) {
*pf_dir_path_return = g_strdup (directory); *pf_dir_path_return = g_strdup (directory);
} }
@ -1025,7 +1025,7 @@ rename_persconffile_profile(const char *fromname, const char *toname,
char *to_dir = g_strdup (get_persconffile_dir(toname)); char *to_dir = g_strdup (get_persconffile_dir(toname));
int ret = 0; int ret = 0;
ret = eth_rename (from_dir, to_dir); ret = ws_rename (from_dir, to_dir);
if (ret != 0) { if (ret != 0) {
*pf_from_dir_path_return = g_strdup (from_dir); *pf_from_dir_path_return = g_strdup (from_dir);
*pf_to_dir_path_return = g_strdup (to_dir); *pf_to_dir_path_return = g_strdup (to_dir);
@ -1061,8 +1061,8 @@ create_persconffile_profile(const char *profilename, char **pf_dir_path_return)
* If not then create it. * If not then create it.
*/ */
pf_dir_path = get_profiles_dir (); pf_dir_path = get_profiles_dir ();
if (eth_stat(pf_dir_path, &s_buf) != 0 && errno == ENOENT) { if (ws_stat(pf_dir_path, &s_buf) != 0 && errno == ENOENT) {
ret = eth_mkdir(pf_dir_path, 0755); ret = ws_mkdir(pf_dir_path, 0755);
if (ret == -1) { if (ret == -1) {
*pf_dir_path_return = g_strdup(pf_dir_path); *pf_dir_path_return = g_strdup(pf_dir_path);
return ret; return ret;
@ -1071,7 +1071,7 @@ create_persconffile_profile(const char *profilename, char **pf_dir_path_return)
} }
pf_dir_path = get_persconffile_dir(profilename); pf_dir_path = get_persconffile_dir(profilename);
if (eth_stat(pf_dir_path, &s_buf) != 0 && errno == ENOENT) { if (ws_stat(pf_dir_path, &s_buf) != 0 && errno == ENOENT) {
#ifdef _WIN32 #ifdef _WIN32
/* /*
* Does the parent directory of that directory * Does the parent directory of that directory
@ -1089,20 +1089,20 @@ create_persconffile_profile(const char *profilename, char **pf_dir_path_return)
pf_dir_parent_path_len = strlen(pf_dir_parent_path); pf_dir_parent_path_len = strlen(pf_dir_parent_path);
if (pf_dir_parent_path_len > 0 if (pf_dir_parent_path_len > 0
&& pf_dir_parent_path[pf_dir_parent_path_len - 1] != ':' && pf_dir_parent_path[pf_dir_parent_path_len - 1] != ':'
&& eth_stat(pf_dir_parent_path, &s_buf) != 0) { && ws_stat(pf_dir_parent_path, &s_buf) != 0) {
/* /*
* No, it doesn't exist - make it first. * No, it doesn't exist - make it first.
*/ */
ret = eth_mkdir(pf_dir_parent_path, 0755); ret = ws_mkdir(pf_dir_parent_path, 0755);
if (ret == -1) { if (ret == -1) {
*pf_dir_path_return = pf_dir_parent_path; *pf_dir_path_return = pf_dir_parent_path;
return -1; return -1;
} }
} }
g_free(pf_dir_path_copy); g_free(pf_dir_path_copy);
ret = eth_mkdir(pf_dir_path, 0755); ret = ws_mkdir(pf_dir_path, 0755);
#else #else
ret = eth_mkdir(pf_dir_path, 0755); ret = ws_mkdir(pf_dir_path, 0755);
#endif #endif
} else { } else {
/* /*
@ -1268,7 +1268,7 @@ get_persconffile_path(const char *filename, gboolean from_profile, gboolean for_
} }
#ifdef _WIN32 #ifdef _WIN32
if (!for_writing) { if (!for_writing) {
if (eth_stat(path, &s_buf) != 0 && errno == ENOENT) { if (ws_stat(path, &s_buf) != 0 && errno == ENOENT) {
/* /*
* OK, it's not in the personal configuration file * OK, it's not in the personal configuration file
* directory; is it in the ".wireshark" subdirectory * directory; is it in the ".wireshark" subdirectory
@ -1277,7 +1277,7 @@ get_persconffile_path(const char *filename, gboolean from_profile, gboolean for_
old_path = g_strdup_printf( old_path = g_strdup_printf(
"%s" G_DIR_SEPARATOR_S ".wireshark" G_DIR_SEPARATOR_S "%s", "%s" G_DIR_SEPARATOR_S ".wireshark" G_DIR_SEPARATOR_S "%s",
get_home_dir(), filename); get_home_dir(), filename);
if (eth_stat(old_path, &s_buf) == 0) { if (ws_stat(old_path, &s_buf) == 0) {
/* /*
* OK, it exists; return it instead. * OK, it exists; return it instead.
*/ */
@ -1368,7 +1368,7 @@ get_datafile_path(const char *filename)
gboolean gboolean
deletefile(const char *path) deletefile(const char *path)
{ {
return eth_unlink(path) == 0; return ws_unlink(path) == 0;
} }
/* /*
@ -1481,14 +1481,14 @@ file_exists(const char *fname)
* so this is working, but maybe not quite the way expected. ULFL * so this is working, but maybe not quite the way expected. ULFL
*/ */
file_stat.st_ino = 1; /* this will make things work if an error occured */ file_stat.st_ino = 1; /* this will make things work if an error occured */
eth_stat(fname, &file_stat); ws_stat(fname, &file_stat);
if (file_stat.st_ino == 0) { if (file_stat.st_ino == 0) {
return TRUE; return TRUE;
} else { } else {
return FALSE; return FALSE;
} }
#else #else
if (eth_stat(fname, &file_stat) != 0 && errno == ENOENT) { if (ws_stat(fname, &file_stat) != 0 && errno == ENOENT) {
return FALSE; return FALSE;
} else { } else {
return TRUE; return TRUE;
@ -1543,9 +1543,9 @@ files_identical(const char *fname1, const char *fname2)
/* /*
* Compare st_dev and st_ino. * Compare st_dev and st_ino.
*/ */
if (eth_stat(fname1, &filestat1) == -1) if (ws_stat(fname1, &filestat1) == -1)
return FALSE; /* can't get info about the first file */ return FALSE; /* can't get info about the first file */
if (eth_stat(fname2, &filestat2) == -1) if (ws_stat(fname2, &filestat2) == -1)
return FALSE; /* can't get info about the second file */ return FALSE; /* can't get info about the second file */
return (filestat1.st_dev == filestat2.st_dev && return (filestat1.st_dev == filestat2.st_dev &&
filestat1.st_ino == filestat2.st_ino); filestat1.st_ino == filestat2.st_ino);

View File

@ -335,7 +335,6 @@ epan_dissect_run
epan_get_version epan_get_version
epan_init epan_init
epan_strcasestr epan_strcasestr
eth_stdio_fopen
ether_to_str ether_to_str
ex_opt_add ex_opt_add
ex_opt_count ex_opt_count

View File

@ -50,7 +50,7 @@
#include "filesystem.h" #include "filesystem.h"
#include "privileges.h" #include "privileges.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include "report_err.h" #include "report_err.h"
/* linked list of all plugins */ /* linked list of all plugins */
@ -148,12 +148,12 @@ plugins_scan_dir(const char *dirname)
gchar *dot; gchar *dot;
int cr; int cr;
if ((dir = eth_dir_open(dirname, 0, NULL)) != NULL) if ((dir = ws_dir_open(dirname, 0, NULL)) != NULL)
{ {
while ((file = eth_dir_read_name(dir)) != NULL) while ((file = ws_dir_read_name(dir)) != NULL)
{ {
name = eth_dir_get_name(file); name = ws_dir_get_name(file);
/* /*
* GLib 2.x defines G_MODULE_SUFFIX as the extension used on * GLib 2.x defines G_MODULE_SUFFIX as the extension used on
@ -321,7 +321,7 @@ plugins_scan_dir(const char *dirname)
} }
} }
eth_dir_close(dir); ws_dir_close(dir);
} }
} }
@ -357,9 +357,9 @@ init_plugins(void)
*/ */
plugin_dir = get_plugin_dir(); plugin_dir = get_plugin_dir();
if (running_in_build_directory()) { if (running_in_build_directory()) {
if ((dir = eth_dir_open(plugin_dir, 0, NULL)) != NULL) { if ((dir = ws_dir_open(plugin_dir, 0, NULL)) != NULL) {
while ((file = eth_dir_read_name(dir)) != NULL) { while ((file = ws_dir_read_name(dir)) != NULL) {
name = eth_dir_get_name(file); name = ws_dir_get_name(file);
if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0) if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0)
continue; /* skip "." and ".." */ continue; /* skip "." and ".." */
/* /*

View File

@ -46,7 +46,7 @@
#include "cfile.h" #include "cfile.h"
#include <epan/column.h> #include <epan/column.h>
#include "print.h" #include "print.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include <epan/prefs-int.h> #include <epan/prefs-int.h>
#include <epan/uat-int.h> #include <epan/uat-int.h>
@ -1263,19 +1263,19 @@ read_prefs(int *gpf_errno_return, int *gpf_read_errno_return,
* file doesn't exist, try the old path. * file doesn't exist, try the old path.
*/ */
gpf_path = get_datafile_path(PF_NAME); gpf_path = get_datafile_path(PF_NAME);
if ((pf = eth_fopen(gpf_path, "r")) == NULL && errno == ENOENT) { if ((pf = ws_fopen(gpf_path, "r")) == NULL && errno == ENOENT) {
/* /*
* It doesn't exist by the new name; try the old name. * It doesn't exist by the new name; try the old name.
*/ */
g_free(gpf_path); g_free(gpf_path);
gpf_path = get_datafile_path(OLD_GPF_NAME); gpf_path = get_datafile_path(OLD_GPF_NAME);
pf = eth_fopen(gpf_path, "r"); pf = ws_fopen(gpf_path, "r");
} }
} else { } else {
/* /*
* We have the path; try it. * We have the path; try it.
*/ */
pf = eth_fopen(gpf_path, "r"); pf = ws_fopen(gpf_path, "r");
} }
/* /*
@ -1318,7 +1318,7 @@ read_prefs(int *gpf_errno_return, int *gpf_read_errno_return,
/* Read the user's preferences file, if it exists. */ /* Read the user's preferences file, if it exists. */
*pf_path_return = NULL; *pf_path_return = NULL;
if ((pf = eth_fopen(pf_path, "r")) != NULL) { if ((pf = ws_fopen(pf_path, "r")) != NULL) {
/* /*
* Start out the counters of "mgcp.{tcp,udp}.port" entries we've * Start out the counters of "mgcp.{tcp,udp}.port" entries we've
* seen. * seen.
@ -2562,7 +2562,7 @@ write_prefs(char **pf_path_return)
if (pf_path_return != NULL) { if (pf_path_return != NULL) {
pf_path = get_persconffile_path(PF_NAME, TRUE, TRUE); pf_path = get_persconffile_path(PF_NAME, TRUE, TRUE);
if ((pf = eth_fopen(pf_path, "w")) == NULL) { if ((pf = ws_fopen(pf_path, "w")) == NULL) {
*pf_path_return = pf_path; *pf_path_return = pf_path;
return errno; return errno;
} }

View File

@ -59,7 +59,7 @@
#include <epan/packet.h> #include <epan/packet.h>
#include <epan/dissectors/packet-radius.h> #include <epan/dissectors/packet-radius.h>
#include "radius_dict_lex.h" #include "radius_dict_lex.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#ifdef _WIN32 #ifdef _WIN32
/* disable Windows VC compiler warning "signed/unsigned mismatch" associated */ /* disable Windows VC compiler warning "signed/unsigned mismatch" associated */
@ -198,7 +198,7 @@
fullpaths[include_stack_ptr] = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", fullpaths[include_stack_ptr] = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s",
directory,yytext); directory,yytext);
yyin = eth_fopen( fullpaths[include_stack_ptr], "r" ); yyin = ws_fopen( fullpaths[include_stack_ptr], "r" );
if (!yyin) { if (!yyin) {
if (errno) { if (errno) {
@ -382,7 +382,7 @@ gboolean radius_load_dictionary (radius_dictionary_t* d, gchar* dir, const gchar
error = g_string_new(""); error = g_string_new("");
yyin = eth_fopen(fullpaths[include_stack_ptr],"r"); yyin = ws_fopen(fullpaths[include_stack_ptr],"r");
if (!yyin) { if (!yyin) {
g_string_append_printf(error, "Could not open file: '%s', error: %s\n", fullpaths[include_stack_ptr], strerror(errno) ); g_string_append_printf(error, "Could not open file: '%s', error: %s\n", fullpaths[include_stack_ptr], strerror(errno) );

View File

@ -43,7 +43,7 @@
#include <epan/filesystem.h> #include <epan/filesystem.h>
#include <epan/packet.h> #include <epan/packet.h>
#include <epan/range.h> #include <epan/range.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include "uat-int.h" #include "uat-int.h"
@ -240,7 +240,7 @@ gboolean uat_save(uat_t* uat, char** error) {
if (! fname ) return FALSE; if (! fname ) return FALSE;
fp = eth_fopen(fname,"w"); fp = ws_fopen(fname,"w");
if (!fp) { if (!fp) {
*error = ep_strdup_printf("uat_save: error opening '%s': %s",fname,strerror(errno)); *error = ep_strdup_printf("uat_save: error opening '%s': %s",fname,strerror(errno));

View File

@ -59,7 +59,7 @@
#include <epan/emem.h> #include <epan/emem.h>
#include "uat-int.h" #include "uat-int.h"
#include "uat_load_lex.h" #include "uat_load_lex.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#ifdef _WIN32 #ifdef _WIN32
/* disable Windows VC compiler warning "signed/unsigned mismatch" associated */ /* disable Windows VC compiler warning "signed/unsigned mismatch" associated */
@ -288,7 +288,7 @@ gboolean uat_load(uat_t* uat_in, char** err) {
} }
if (!(yyin = eth_fopen(fname,"r"))) { if (!(yyin = ws_fopen(fname,"r"))) {
*err = strerror(errno); *err = strerror(errno);
g_free(fname); g_free(fname);
return FALSE; return FALSE;

View File

@ -32,7 +32,7 @@
#include <epan/expert.h> #include <epan/expert.h>
#include <epan/ex-opt.h> #include <epan/ex-opt.h>
#include <epan/privileges.h> #include <epan/privileges.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
static lua_State* L = NULL; static lua_State* L = NULL;
@ -192,7 +192,7 @@ static int lua_main_error_handler(lua_State* LS) {
void lua_load_script(const gchar* filename) { void lua_load_script(const gchar* filename) {
FILE* file; FILE* file;
if (! ( file = eth_fopen(filename,"r")) ) { if (! ( file = ws_fopen(filename,"r")) ) {
report_open_failure(filename,errno,FALSE); report_open_failure(filename,errno,FALSE);
return; return;
} }

40
file.c
View File

@ -74,7 +74,7 @@
#include <epan/dissectors/packet-ber.h> #include <epan/dissectors/packet-ber.h>
#include <epan/timestamp.h> #include <epan/timestamp.h>
#include <epan/dfilter/dfilter-macro.h> #include <epan/dfilter/dfilter-macro.h>
#include "file_util.h" #include <wsutil/file_util.h>
#include <epan/column-utils.h> #include <epan/column-utils.h>
#include <epan/strutil.h> #include <epan/strutil.h>
#include <epan/emem.h> #include <epan/emem.h>
@ -327,7 +327,7 @@ cf_reset_state(capture_file *cf)
if (cf->filename != NULL) { if (cf->filename != NULL) {
/* If it's a temporary file, remove it. */ /* If it's a temporary file, remove it. */
if (cf->is_tempfile) if (cf->is_tempfile)
eth_unlink(cf->filename); ws_unlink(cf->filename);
g_free(cf->filename); g_free(cf->filename);
cf->filename = NULL; cf->filename = NULL;
} }
@ -1178,7 +1178,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
if (*out_filenamep != NULL) { if (*out_filenamep != NULL) {
out_filename = *out_filenamep; out_filename = *out_filenamep;
out_fd = eth_open(out_filename, O_CREAT|O_TRUNC|O_BINARY, 0600); out_fd = ws_open(out_filename, O_CREAT|O_TRUNC|O_BINARY, 0600);
if (out_fd == -1) if (out_fd == -1)
open_err = errno; open_err = errno;
} else { } else {
@ -1201,7 +1201,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
merge_max_snapshot_length(in_file_count, in_files), merge_max_snapshot_length(in_file_count, in_files),
FALSE /* compressed */, &open_err); FALSE /* compressed */, &open_err);
if (pdh == NULL) { if (pdh == NULL) {
eth_close(out_fd); ws_close(out_fd);
merge_close_in_files(in_file_count, in_files); merge_close_in_files(in_file_count, in_files);
g_free(in_files); g_free(in_files);
cf_open_failure_alert_box(out_filename, open_err, err_info, TRUE, cf_open_failure_alert_box(out_filename, open_err, err_info, TRUE,
@ -2236,7 +2236,7 @@ cf_write_pdml_packets(capture_file *cf, print_args_t *print_args)
FILE *fh; FILE *fh;
psp_return_t ret; psp_return_t ret;
fh = eth_fopen(print_args->file, "w"); fh = ws_fopen(print_args->file, "w");
if (fh == NULL) if (fh == NULL)
return CF_PRINT_OPEN_ERROR; /* attempt to open destination failed */ return CF_PRINT_OPEN_ERROR; /* attempt to open destination failed */
@ -2310,7 +2310,7 @@ cf_write_psml_packets(capture_file *cf, print_args_t *print_args)
FILE *fh; FILE *fh;
psp_return_t ret; psp_return_t ret;
fh = eth_fopen(print_args->file, "w"); fh = ws_fopen(print_args->file, "w");
if (fh == NULL) if (fh == NULL)
return CF_PRINT_OPEN_ERROR; /* attempt to open destination failed */ return CF_PRINT_OPEN_ERROR; /* attempt to open destination failed */
@ -2384,7 +2384,7 @@ cf_write_csv_packets(capture_file *cf, print_args_t *print_args)
FILE *fh; FILE *fh;
psp_return_t ret; psp_return_t ret;
fh = eth_fopen(print_args->file, "w"); fh = ws_fopen(print_args->file, "w");
if (fh == NULL) if (fh == NULL)
return CF_PRINT_OPEN_ERROR; /* attempt to open destination failed */ return CF_PRINT_OPEN_ERROR; /* attempt to open destination failed */
@ -2445,7 +2445,7 @@ cf_write_carrays_packets(capture_file *cf, print_args_t *print_args)
FILE *fh; FILE *fh;
psp_return_t ret; psp_return_t ret;
fh = eth_fopen(print_args->file, "w"); fh = ws_fopen(print_args->file, "w");
if (fh == NULL) if (fh == NULL)
return CF_PRINT_OPEN_ERROR; /* attempt to open destination failed */ return CF_PRINT_OPEN_ERROR; /* attempt to open destination failed */
@ -3499,7 +3499,7 @@ cf_save(capture_file *cf, const char *fname, packet_range_t *range, guint save_f
capture, so it doesn't need to stay around under that name; capture, so it doesn't need to stay around under that name;
first, try renaming the capture buffer file to the new name. */ first, try renaming the capture buffer file to the new name. */
#ifndef _WIN32 #ifndef _WIN32
if (eth_rename(cf->filename, fname) == 0) { if (ws_rename(cf->filename, fname) == 0) {
/* That succeeded - there's no need to copy the source file. */ /* That succeeded - there's no need to copy the source file. */
from_filename = NULL; from_filename = NULL;
do_copy = FALSE; do_copy = FALSE;
@ -3928,7 +3928,7 @@ copy_binary_file(const char *from_filename, const char *to_filename)
guint8 pd[65536]; guint8 pd[65536];
/* Copy the raw bytes of the file. */ /* Copy the raw bytes of the file. */
from_fd = eth_open(from_filename, O_RDONLY | O_BINARY, 0000 /* no creation so don't matter */); from_fd = ws_open(from_filename, O_RDONLY | O_BINARY, 0000 /* no creation so don't matter */);
if (from_fd < 0) { if (from_fd < 0) {
open_failure_alert_box(from_filename, errno, FALSE); open_failure_alert_box(from_filename, errno, FALSE);
goto done; goto done;
@ -3939,23 +3939,23 @@ copy_binary_file(const char *from_filename, const char *to_filename)
may open the file in text mode, not binary mode, but we want may open the file in text mode, not binary mode, but we want
to copy the raw bytes of the file, so we need the output file to copy the raw bytes of the file, so we need the output file
to be open in binary mode. */ to be open in binary mode. */
to_fd = eth_open(to_filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); to_fd = ws_open(to_filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
if (to_fd < 0) { if (to_fd < 0) {
open_failure_alert_box(to_filename, errno, TRUE); open_failure_alert_box(to_filename, errno, TRUE);
eth_close(from_fd); ws_close(from_fd);
goto done; goto done;
} }
while ((nread = eth_read(from_fd, pd, sizeof pd)) > 0) { while ((nread = ws_read(from_fd, pd, sizeof pd)) > 0) {
nwritten = eth_write(to_fd, pd, nread); nwritten = ws_write(to_fd, pd, nread);
if (nwritten < nread) { if (nwritten < nread) {
if (nwritten < 0) if (nwritten < 0)
err = errno; err = errno;
else else
err = WTAP_ERR_SHORT_WRITE; err = WTAP_ERR_SHORT_WRITE;
write_failure_alert_box(to_filename, err); write_failure_alert_box(to_filename, err);
eth_close(from_fd); ws_close(from_fd);
eth_close(to_fd); ws_close(to_fd);
goto done; goto done;
} }
} }
@ -3964,12 +3964,12 @@ copy_binary_file(const char *from_filename, const char *to_filename)
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"An error occurred while reading from the file \"%s\": %s.", "An error occurred while reading from the file \"%s\": %s.",
from_filename, strerror(err)); from_filename, strerror(err));
eth_close(from_fd); ws_close(from_fd);
eth_close(to_fd); ws_close(to_fd);
goto done; goto done;
} }
eth_close(from_fd); ws_close(from_fd);
if (eth_close(to_fd) < 0) { if (ws_close(to_fd) < 0) {
write_failure_alert_box(to_filename, errno); write_failure_alert_box(to_filename, errno);
goto done; goto done;
} }

View File

@ -51,7 +51,7 @@
#include <glib.h> #include <glib.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include "globals.h" #include "globals.h"
#include <epan/filesystem.h> #include <epan/filesystem.h>
@ -183,7 +183,7 @@ fileset_add_file(const char *dirname, const char *fname, gboolean current)
path = g_strdup_printf("%s%s", dirname, fname); path = g_strdup_printf("%s%s", dirname, fname);
fh = eth_open( path, O_RDONLY, 0000 /* no creation so don't matter */); fh = ws_open( path, O_RDONLY, 0000 /* no creation so don't matter */);
if(fh != -1) { if(fh != -1) {
/* Get statistics */ /* Get statistics */
@ -203,7 +203,7 @@ fileset_add_file(const char *dirname, const char *fname, gboolean current)
set.entries = g_list_append(set.entries, entry); set.entries = g_list_append(set.entries, entry);
} }
eth_close(fh); ws_close(fh);
} }
g_free(path); g_free(path);
@ -262,15 +262,15 @@ fileset_add_dir(const char *fname)
/* is the current file probably a part of any fileset? */ /* is the current file probably a part of any fileset? */
if(fileset_filename_match_pattern(fname)) { if(fileset_filename_match_pattern(fname)) {
/* yes, go through the files in the directory and check if the file in question is part of the current file set */ /* yes, go through the files in the directory and check if the file in question is part of the current file set */
if ((dir = eth_dir_open(dirname->str, 0, NULL)) != NULL) { if ((dir = ws_dir_open(dirname->str, 0, NULL)) != NULL) {
while ((file = eth_dir_read_name(dir)) != NULL) { while ((file = ws_dir_read_name(dir)) != NULL) {
name = eth_dir_get_name(file); name = ws_dir_get_name(file);
if(fileset_filename_match_pattern(name) && fileset_is_file_in_set(name, get_basename(fname))) { if(fileset_filename_match_pattern(name) && fileset_is_file_in_set(name, get_basename(fname))) {
fileset_add_file(dirname->str, name, strcmp(name, get_basename(fname))== 0 /* current */); fileset_add_file(dirname->str, name, strcmp(name, get_basename(fname))== 0 /* current */);
} }
} /* while */ } /* while */
eth_dir_close(dir); ws_dir_close(dir);
} /* if */ } /* if */
} else { } else {
/* no, this is a "standalone file", just add this one */ /* no, this is a "standalone file", just add this one */

View File

@ -40,7 +40,7 @@
#include <epan/filesystem.h> #include <epan/filesystem.h>
#include "filters.h" #include "filters.h"
#include "file_util.h" #include <wsutil/file_util.h>
/* /*
* Old filter file name. * Old filter file name.
@ -146,7 +146,7 @@ read_filter_list(filter_list_type_t list_type, char **pref_path_return,
/* try to open personal "cfilters"/"dfilters" file */ /* try to open personal "cfilters"/"dfilters" file */
ff_path = get_persconffile_path(ff_name, TRUE, FALSE); ff_path = get_persconffile_path(ff_name, TRUE, FALSE);
if ((ff = eth_fopen(ff_path, "r")) == NULL) { if ((ff = ws_fopen(ff_path, "r")) == NULL) {
/* /*
* Did that fail because the file didn't exist? * Did that fail because the file didn't exist?
*/ */
@ -169,7 +169,7 @@ read_filter_list(filter_list_type_t list_type, char **pref_path_return,
*/ */
g_free(ff_path); g_free(ff_path);
ff_path = get_persconffile_path(FILTER_FILE_NAME, FALSE, FALSE); ff_path = get_persconffile_path(FILTER_FILE_NAME, FALSE, FALSE);
if ((ff = eth_fopen(ff_path, "r")) == NULL) { if ((ff = ws_fopen(ff_path, "r")) == NULL) {
/* /*
* Did that fail because the file didn't exist? * Did that fail because the file didn't exist?
*/ */
@ -186,7 +186,7 @@ read_filter_list(filter_list_type_t list_type, char **pref_path_return,
* Try to open the global "cfilters/dfilters" file */ * Try to open the global "cfilters/dfilters" file */
g_free(ff_path); g_free(ff_path);
ff_path = get_datafile_path(ff_name); ff_path = get_datafile_path(ff_name);
if ((ff = eth_fopen(ff_path, "r")) == NULL) { if ((ff = ws_fopen(ff_path, "r")) == NULL) {
/* /*
* Well, that didn't work, either. Just give up. * Well, that didn't work, either. Just give up.
@ -497,7 +497,7 @@ save_filter_list(filter_list_type_t list_type, char **pref_path_return,
completely. */ completely. */
ff_path_new = g_strdup_printf("%s.new", ff_path); ff_path_new = g_strdup_printf("%s.new", ff_path);
if ((ff = eth_fopen(ff_path_new, "w")) == NULL) { if ((ff = ws_fopen(ff_path_new, "w")) == NULL) {
*pref_path_return = ff_path; *pref_path_return = ff_path;
*errno_return = errno; *errno_return = errno;
g_free(ff_path_new); g_free(ff_path_new);
@ -526,7 +526,7 @@ save_filter_list(filter_list_type_t list_type, char **pref_path_return,
*pref_path_return = ff_path; *pref_path_return = ff_path;
*errno_return = errno; *errno_return = errno;
fclose(ff); fclose(ff);
eth_unlink(ff_path_new); ws_unlink(ff_path_new);
g_free(ff_path_new); g_free(ff_path_new);
return; return;
} }
@ -535,7 +535,7 @@ save_filter_list(filter_list_type_t list_type, char **pref_path_return,
if (fclose(ff) == EOF) { if (fclose(ff) == EOF) {
*pref_path_return = ff_path; *pref_path_return = ff_path;
*errno_return = errno; *errno_return = errno;
eth_unlink(ff_path_new); ws_unlink(ff_path_new);
g_free(ff_path_new); g_free(ff_path_new);
return; return;
} }
@ -545,22 +545,22 @@ save_filter_list(filter_list_type_t list_type, char **pref_path_return,
exists; the Win32 call to rename files doesn't do so, which I exists; the Win32 call to rename files doesn't do so, which I
infer is the reason why the MSVC++ "rename()" doesn't do so. infer is the reason why the MSVC++ "rename()" doesn't do so.
We must therefore remove the target file first, on Windows. */ We must therefore remove the target file first, on Windows. */
if (eth_remove(ff_path) < 0 && errno != ENOENT) { if (ws_remove(ff_path) < 0 && errno != ENOENT) {
/* It failed for some reason other than "it's not there"; if /* It failed for some reason other than "it's not there"; if
it's not there, we don't need to remove it, so we just it's not there, we don't need to remove it, so we just
drive on. */ drive on. */
*pref_path_return = ff_path; *pref_path_return = ff_path;
*errno_return = errno; *errno_return = errno;
eth_unlink(ff_path_new); ws_unlink(ff_path_new);
g_free(ff_path_new); g_free(ff_path_new);
return; return;
} }
#endif #endif
if (eth_rename(ff_path_new, ff_path) < 0) { if (ws_rename(ff_path_new, ff_path) < 0) {
*pref_path_return = ff_path; *pref_path_return = ff_path;
*errno_return = errno; *errno_return = errno;
eth_unlink(ff_path_new); ws_unlink(ff_path_new);
g_free(ff_path_new); g_free(ff_path_new);
return; return;
} }

View File

@ -47,7 +47,7 @@
#include "../color_filters.h" #include "../color_filters.h"
#include "../merge.h" #include "../merge.h"
#include "../util.h" #include "../util.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include "gtk/gtkglobals.h" #include "gtk/gtkglobals.h"
#include "gtk/keys.h" #include "gtk/keys.h"
@ -1350,7 +1350,7 @@ static void file_save_as_exists_answered_cb(gpointer dialog _U_, gint btn, gpoin
switch(btn) { switch(btn) {
case(ESD_BTN_OK): case(ESD_BTN_OK):
/* save file */ /* save file */
eth_unlink(cf_name); ws_unlink(cf_name);
file_save_as_cb(NULL, data); file_save_as_cb(NULL, data);
break; break;
case(ESD_BTN_CANCEL): case(ESD_BTN_CANCEL):

View File

@ -44,7 +44,7 @@
#include <../alert_box.h> #include <../alert_box.h>
#include <../simple_dialog.h> #include <../simple_dialog.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include <gtk/dlg_utils.h> #include <gtk/dlg_utils.h>
#include <gtk/file_dlg.h> #include <gtk/file_dlg.h>
@ -125,7 +125,7 @@ eo_save_entry(gchar *save_as_filename, export_object_entry_t *entry, gboolean sh
{ {
int to_fd; int to_fd;
to_fd = eth_open(save_as_filename, O_WRONLY | O_CREAT | O_EXCL | to_fd = ws_open(save_as_filename, O_WRONLY | O_CREAT | O_EXCL |
O_BINARY, 0644); O_BINARY, 0644);
if(to_fd == -1) { /* An error occurred */ if(to_fd == -1) { /* An error occurred */
if (show_err) if (show_err)
@ -134,15 +134,15 @@ eo_save_entry(gchar *save_as_filename, export_object_entry_t *entry, gboolean sh
return FALSE; return FALSE;
} }
if(eth_write(to_fd, entry->payload_data, entry->payload_len) < 0) { if(ws_write(to_fd, entry->payload_data, entry->payload_len) < 0) {
if (show_err) if (show_err)
write_failure_alert_box(save_as_filename, errno); write_failure_alert_box(save_as_filename, errno);
eth_close(to_fd); ws_close(to_fd);
g_free(save_as_filename); g_free(save_as_filename);
return FALSE; return FALSE;
} }
if (eth_close(to_fd) < 0) { if (ws_close(to_fd) < 0) {
if (show_err) if (show_err)
write_failure_alert_box(save_as_filename, errno); write_failure_alert_box(save_as_filename, errno);
g_free(save_as_filename); g_free(save_as_filename);

View File

@ -66,7 +66,7 @@
#include <../alert_box.h> #include <../alert_box.h>
#include <../simple_dialog.h> #include <../simple_dialog.h>
#include <../util.h> #include <../util.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include <gtk/main.h> #include <gtk/main.h>
#include <gtk/dlg_utils.h> #include <gtk/dlg_utils.h>
@ -747,7 +747,7 @@ firewall_save_as_ok_cb(GtkWidget * w _U_, gpointer fs)
} }
rule_info = g_object_get_data(G_OBJECT(fs), WS_RULE_INFO_KEY); rule_info = g_object_get_data(G_OBJECT(fs), WS_RULE_INFO_KEY);
fh = eth_fopen(to_name, "w"); fh = ws_fopen(to_name, "w");
if (fh == NULL) { if (fh == NULL) {
open_failure_alert_box(to_name, errno, TRUE); open_failure_alert_box(to_name, errno, TRUE);
g_free(to_name); g_free(to_name);

View File

@ -52,7 +52,6 @@
#include <../alert_box.h> #include <../alert_box.h>
#include <../simple_dialog.h> #include <../simple_dialog.h>
#include <../util.h> #include <../util.h>
#include <wiretap/file_util.h>
#include <gtk/color_utils.h> #include <gtk/color_utils.h>
#include <gtk/main.h> #include <gtk/main.h>

View File

@ -45,7 +45,7 @@
#include <../isprint.h> #include <../isprint.h>
#include <../print.h> #include <../print.h>
#include <../simple_dialog.h> #include <../simple_dialog.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include <gtk/color_utils.h> #include <gtk/color_utils.h>
#include <gtk/stock_icons.h> #include <gtk/stock_icons.h>
@ -476,7 +476,7 @@ follow_print_stream(GtkWidget * w _U_, gpointer data)
print_mswin(print_dest); print_mswin(print_dest);
/* trash temp file */ /* trash temp file */
eth_remove(print_dest); ws_remove(print_dest);
} }
#endif #endif
return; return;
@ -495,7 +495,7 @@ follow_print_stream(GtkWidget * w _U_, gpointer data)
#ifdef _WIN32 #ifdef _WIN32
if (win_printer) { if (win_printer) {
/* trash temp file */ /* trash temp file */
eth_remove(print_dest); ws_remove(print_dest);
} }
#endif #endif
} }
@ -562,10 +562,10 @@ follow_save_as_ok_cb(GtkWidget * w _U_, gpointer fs)
follow_info = g_object_get_data(G_OBJECT(fs), E_FOLLOW_INFO_KEY); follow_info = g_object_get_data(G_OBJECT(fs), E_FOLLOW_INFO_KEY);
if (follow_info->show_type == SHOW_RAW) { if (follow_info->show_type == SHOW_RAW) {
/* Write the data out as raw binary data */ /* Write the data out as raw binary data */
fh = eth_fopen(to_name, "wb"); fh = ws_fopen(to_name, "wb");
} else { } else {
/* Write it out as text */ /* Write it out as text */
fh = eth_fopen(to_name, "w"); fh = ws_fopen(to_name, "w");
} }
if (fh == NULL) { if (fh == NULL) {
open_failure_alert_box(to_name, errno, TRUE); open_failure_alert_box(to_name, errno, TRUE);
@ -895,7 +895,7 @@ follow_destroy_cb(GtkWidget *w, gpointer data _U_)
switch(follow_info->follow_type) { switch(follow_info->follow_type) {
case FOLLOW_TCP : case FOLLOW_TCP :
i = eth_unlink(follow_info->data_out_filename); i = ws_unlink(follow_info->data_out_filename);
if(i != 0) { if(i != 0) {
g_warning("Follow: Couldn't remove temporary file: \"%s\", errno: %s (%u)", follow_info->data_out_filename, strerror(errno), errno); g_warning("Follow: Couldn't remove temporary file: \"%s\", errno: %s (%u)", follow_info->data_out_filename, strerror(errno), errno);
} }

View File

@ -55,7 +55,7 @@
#include "../alert_box.h" #include "../alert_box.h"
#include "../simple_dialog.h" #include "../simple_dialog.h"
#include "../tempfile.h" #include "../tempfile.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
#include "gtk/color_utils.h" #include "gtk/color_utils.h"
#include "gtk/follow_tcp.h" #include "gtk/follow_tcp.h"
@ -142,8 +142,8 @@ follow_tcp_stream_cb(GtkWidget * w, gpointer data _U_)
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Could not create temporary file %s: %s", "Could not create temporary file %s: %s",
follow_info->data_out_filename, strerror(errno)); follow_info->data_out_filename, strerror(errno));
eth_close(tmp_fd); ws_close(tmp_fd);
eth_unlink(follow_info->data_out_filename); ws_unlink(follow_info->data_out_filename);
g_free(follow_info); g_free(follow_info);
return; return;
} }
@ -190,8 +190,8 @@ follow_tcp_stream_cb(GtkWidget * w, gpointer data _U_)
if (empty_tcp_stream) { if (empty_tcp_stream) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"The packets in the capture file for that stream have no data."); "The packets in the capture file for that stream have no data.");
eth_close(tmp_fd); ws_close(tmp_fd);
eth_unlink(follow_info->data_out_filename); ws_unlink(follow_info->data_out_filename);
g_free(follow_info); g_free(follow_info);
return; return;
} }
@ -220,8 +220,8 @@ follow_tcp_stream_cb(GtkWidget * w, gpointer data _U_)
(unsigned long)sizeof(sc), (unsigned long)sizeof(sc),
(unsigned long)nchars); (unsigned long)nchars);
} }
eth_close(tmp_fd); ws_close(tmp_fd);
eth_unlink(follow_info->data_out_filename); ws_unlink(follow_info->data_out_filename);
g_free(follow_info); g_free(follow_info);
return; return;
} }
@ -335,7 +335,7 @@ follow_read_tcp_stream(follow_info_t *follow_info,
iplen = (follow_info->is_ipv6) ? 16 : 4; iplen = (follow_info->is_ipv6) ? 16 : 4;
data_out_file = eth_fopen(follow_info->data_out_filename, "rb"); data_out_file = ws_fopen(follow_info->data_out_filename, "rb");
if (data_out_file == NULL) { if (data_out_file == NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Could not open temporary file %s: %s", follow_info->data_out_filename, "Could not open temporary file %s: %s", follow_info->data_out_filename,

View File

@ -50,7 +50,7 @@
#include "../register.h" #include "../register.h"
#include "../color.h" #include "../color.h"
#include "../simple_dialog.h" #include "../simple_dialog.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
#include "gtk/gtkglobals.h" #include "gtk/gtkglobals.h"
#include "gtk/file_dlg.h" #include "gtk/file_dlg.h"
@ -276,7 +276,7 @@ static gboolean dialog_graph_dump_to_file(graph_analysis_data_t* user_data)
FILE *of; FILE *of;
of = eth_fopen(user_data->dlg.save_file,"w"); of = ws_fopen(user_data->dlg.save_file,"w");
if (of==NULL){ if (of==NULL){
return FALSE; return FALSE;
} }
@ -509,7 +509,7 @@ static void save_to_file_ok_cb(GtkWidget *ok_bt _U_, gpointer user_data _U_)
/* check whether the file exists */ /* check whether the file exists */
file_test = eth_fopen(user_data_p->dlg.save_file,"r"); file_test = ws_fopen(user_data_p->dlg.save_file,"r");
if (file_test!=NULL){ if (file_test!=NULL){
dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO, dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO,

View File

@ -37,7 +37,7 @@
#include "epan/epan.h" #include "epan/epan.h"
#include "../ui_util.h" #include "../ui_util.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
#include "gtk/gtkglobals.h" #include "gtk/gtkglobals.h"
#include "gtk/gui_utils.h" #include "gtk/gui_utils.h"

View File

@ -36,7 +36,6 @@
#include <epan/prefs.h> #include <epan/prefs.h>
#include "../simple_dialog.h" #include "../simple_dialog.h"
#include "wiretap/file_util.h"
#include "gtk/help_dlg.h" #include "gtk/help_dlg.h"
#include "gtk/text_page_utils.h" #include "gtk/text_page_utils.h"

View File

@ -100,7 +100,7 @@
#include "../alert_box.h" #include "../alert_box.h"
#include "../capture_ui_utils.h" #include "../capture_ui_utils.h"
#include "../log.h" #include "../log.h"
#include "../wiretap/file_util.h" #include <wsutil/file_util.h>
#ifdef HAVE_LIBPCAP #ifdef HAVE_LIBPCAP
@ -2663,9 +2663,9 @@ create_console(void)
create one and make it the standard input, output, and error. */ create one and make it the standard input, output, and error. */
if (!AllocConsole()) if (!AllocConsole())
return; /* couldn't create console */ return; /* couldn't create console */
eth_freopen("CONIN$", "r", stdin); ws_freopen("CONIN$", "r", stdin);
eth_freopen("CONOUT$", "w", stdout); ws_freopen("CONOUT$", "w", stdout);
eth_freopen("CONOUT$", "w", stderr); ws_freopen("CONOUT$", "w", stderr);
/* Well, we have a console now. */ /* Well, we have a console now. */
has_console = TRUE; has_console = TRUE;

View File

@ -55,7 +55,7 @@
#include "../simple_dialog.h" #include "../simple_dialog.h"
#include "../progress_dlg.h" #include "../progress_dlg.h"
#include "../ui_util.h" #include "../ui_util.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
#include "gtk/keys.h" #include "gtk/keys.h"
#include "gtk/color_utils.h" #include "gtk/color_utils.h"
@ -872,17 +872,17 @@ savehex_save_clicked_cb(GtkWidget * w _U_, gpointer data _U_)
return; return;
} }
fd = eth_open(file, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0666); fd = ws_open(file, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0666);
if (fd == -1) { if (fd == -1) {
open_failure_alert_box(file, errno, TRUE); open_failure_alert_box(file, errno, TRUE);
return; return;
} }
if (eth_write(fd, data_p + start, end - start) < 0) { if (ws_write(fd, data_p + start, end - start) < 0) {
write_failure_alert_box(file, errno); write_failure_alert_box(file, errno);
eth_close(fd); ws_close(fd);
return; return;
} }
if (eth_close(fd) < 0) { if (ws_close(fd) < 0) {
write_failure_alert_box(file, errno); write_failure_alert_box(file, errno);
return; return;
} }

View File

@ -40,7 +40,7 @@
#include "capture_opts.h" #include "capture_opts.h"
#include "capture_ui_utils.h" #include "capture_ui_utils.h"
#include "simple_dialog.h" #include "simple_dialog.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
#include "gtk/gui_utils.h" #include "gtk/gui_utils.h"
#include "gtk/color_utils.h" #include "gtk/color_utils.h"
@ -367,7 +367,7 @@ welcome_filename_link_new(const gchar *filename, GtkWidget **label)
} }
/* add file size */ /* add file size */
err = eth_stat(filename, &stat_buf); err = ws_stat(filename, &stat_buf);
if(err == 0) { if(err == 0) {
if (stat_buf.st_size/1024/1024 > 10) { if (stat_buf.st_size/1024/1024 > 10) {
g_string_append_printf(str, " %" G_GINT64_MODIFIER "dMB", (gint64) (stat_buf.st_size/1024/1024)); g_string_append_printf(str, " %" G_GINT64_MODIFIER "dMB", (gint64) (stat_buf.st_size/1024/1024));

View File

@ -54,7 +54,6 @@
#include "../register.h" #include "../register.h"
#include "../alert_box.h" #include "../alert_box.h"
#include "../simple_dialog.h" #include "../simple_dialog.h"
#include "wiretap/file_util.h"
#include "gtk/mcast_stream.h" #include "gtk/mcast_stream.h"
#include "gtk/mcast_stream_dlg.h" #include "gtk/mcast_stream_dlg.h"

View File

@ -40,7 +40,7 @@
#include "../simple_dialog.h" #include "../simple_dialog.h"
#include "../tempfile.h" #include "../tempfile.h"
#include "../util.h" #include "../util.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
#include "gtk/gtkglobals.h" #include "gtk/gtkglobals.h"
#include "gtk/keys.h" #include "gtk/keys.h"
@ -970,7 +970,7 @@ print_ok_cb(GtkWidget *ok_bt, gpointer parent_w)
/* remember to restore these values later! */ /* remember to restore these values later! */
tmp_oldfile = args->file; tmp_oldfile = args->file;
args->file = g_strdup(tmp_namebuf); args->file = g_strdup(tmp_namebuf);
eth_unlink(args->file); ws_unlink(args->file);
args->to_file = TRUE; args->to_file = TRUE;
#else #else
g_free(args->cmd); g_free(args->cmd);
@ -1104,7 +1104,7 @@ print_ok_cb(GtkWidget *ok_bt, gpointer parent_w)
print_mswin(args->file); print_mswin(args->file);
/* trash temp file */ /* trash temp file */
eth_remove(args->file); ws_remove(args->file);
/* restore old settings */ /* restore old settings */
args->to_file = FALSE; args->to_file = FALSE;

View File

@ -36,7 +36,7 @@
#include <winspool.h> #include <winspool.h>
#include "gtk/print_win32.h" #include "gtk/print_win32.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
/* /*
Some thoughts about a GTK win32 printer dialog: Some thoughts about a GTK win32 printer dialog:
@ -186,7 +186,7 @@ void print_file( char *file_name, HDC hdc) {
SetMapMode (hdc, MM_TEXT); SetMapMode (hdc, MM_TEXT);
fh1 = eth_fopen( file_name, "r" ); fh1 = ws_fopen( file_name, "r" );
if( !fh1 ) { if( !fh1 ) {
perror( "open failed on input file" ); perror( "open failed on input file" );
return; return;

View File

@ -36,7 +36,7 @@
#include <epan/prefs.h> #include <epan/prefs.h>
#include "../simple_dialog.h" #include "../simple_dialog.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include "gtk/main.h" #include "gtk/main.h"
#include "gtk/profile_dlg.h" #include "gtk/profile_dlg.h"
@ -177,9 +177,9 @@ fill_list(GtkWidget *main_w)
/* fill in data */ /* fill in data */
profiles_dir = get_profiles_dir(); profiles_dir = get_profiles_dir();
if ((dir = eth_dir_open(profiles_dir, 0, NULL)) != NULL) { if ((dir = ws_dir_open(profiles_dir, 0, NULL)) != NULL) {
while ((file = eth_dir_read_name(dir)) != NULL) { while ((file = ws_dir_read_name(dir)) != NULL) {
name = eth_dir_get_name(file); name = ws_dir_get_name(file);
filename = g_strdup_printf ("%s%s%s", profiles_dir, G_DIR_SEPARATOR_S, name); filename = g_strdup_printf ("%s%s%s", profiles_dir, G_DIR_SEPARATOR_S, name);
if (test_for_directory(filename) == EISDIR) { if (test_for_directory(filename) == EISDIR) {
@ -201,7 +201,7 @@ fill_list(GtkWidget *main_w)
} }
g_free (filename); g_free (filename);
} }
eth_dir_close (dir); ws_dir_close (dir);
} }
/* Make the current list an the edited list equal */ /* Make the current list an the edited list equal */

View File

@ -40,7 +40,7 @@
#include <epan/column.h> #include <epan/column.h>
#include "../simple_dialog.h" #include "../simple_dialog.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
#include "gtk/recent.h" #include "gtk/recent.h"
#include "gtk/main.h" #include "gtk/main.h"
@ -154,7 +154,7 @@ write_recent(void)
} }
rf_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE, TRUE); rf_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE, TRUE);
if ((rf = eth_fopen(rf_path, "w")) == NULL) { if ((rf = ws_fopen(rf_path, "w")) == NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't open recent file\n\"%s\": %s.", rf_path, "Can't open recent file\n\"%s\": %s.", rf_path,
strerror(errno)); strerror(errno));
@ -265,7 +265,7 @@ write_profile_recent(void)
} }
rf_path = get_persconffile_path(RECENT_FILE_NAME, TRUE, TRUE); rf_path = get_persconffile_path(RECENT_FILE_NAME, TRUE, TRUE);
if ((rf = eth_fopen(rf_path, "w")) == NULL) { if ((rf = ws_fopen(rf_path, "w")) == NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't open recent file\n\"%s\": %s.", rf_path, "Can't open recent file\n\"%s\": %s.", rf_path,
strerror(errno)); strerror(errno));
@ -768,7 +768,7 @@ recent_read_static(char **rf_path_return, int *rf_errno_return)
/* Read the user's recent file, if it exists. */ /* Read the user's recent file, if it exists. */
*rf_path_return = NULL; *rf_path_return = NULL;
if ((rf = eth_fopen(rf_path, "r")) != NULL) { if ((rf = ws_fopen(rf_path, "r")) != NULL) {
/* We succeeded in opening it; read it. */ /* We succeeded in opening it; read it. */
read_prefs_file(rf_path, rf, read_set_recent_common_pair_static, NULL); read_prefs_file(rf_path, rf, read_set_recent_common_pair_static, NULL);
@ -826,13 +826,13 @@ recent_read_profile_static(char **rf_path_return, int *rf_errno_return)
/* Read the user's recent file, if it exists. */ /* Read the user's recent file, if it exists. */
*rf_path_return = NULL; *rf_path_return = NULL;
if ((rf = eth_fopen(rf_path, "r")) != NULL) { if ((rf = ws_fopen(rf_path, "r")) != NULL) {
/* We succeeded in opening it; read it. */ /* We succeeded in opening it; read it. */
read_prefs_file(rf_path, rf, read_set_recent_pair_static, NULL); read_prefs_file(rf_path, rf, read_set_recent_pair_static, NULL);
fclose(rf); fclose(rf);
if (!recent.has_recent_common) { if (!recent.has_recent_common) {
/* Read older common settings from recent file */ /* Read older common settings from recent file */
rf = eth_fopen(rf_path, "r"); rf = ws_fopen(rf_path, "r");
read_prefs_file(rf_path, rf, read_set_recent_common_pair_static, NULL); read_prefs_file(rf_path, rf, read_set_recent_common_pair_static, NULL);
fclose(rf); fclose(rf);
} }
@ -866,7 +866,7 @@ recent_read_dynamic(char **rf_path_return, int *rf_errno_return)
/* Read the user's recent file, if it exists. */ /* Read the user's recent file, if it exists. */
*rf_path_return = NULL; *rf_path_return = NULL;
if ((rf = eth_fopen(rf_path, "r")) != NULL) { if ((rf = ws_fopen(rf_path, "r")) != NULL) {
/* We succeeded in opening it; read it. */ /* We succeeded in opening it; read it. */
read_prefs_file(rf_path, rf, read_set_recent_pair_dynamic, NULL); read_prefs_file(rf_path, rf, read_set_recent_pair_dynamic, NULL);
/* set dfilter combobox to have an empty line */ /* set dfilter combobox to have an empty line */

View File

@ -69,7 +69,7 @@
#include "../progress_dlg.h" #include "../progress_dlg.h"
#include "../color.h" #include "../color.h"
#include "../tempfile.h" #include "../tempfile.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
#include "gtk/gtkglobals.h" #include "gtk/gtkglobals.h"
#include "gtk/dlg_utils.h" #include "gtk/dlg_utils.h"
@ -350,10 +350,10 @@ rtp_reset(void *user_data_arg)
fclose(user_data->forward.saveinfo.fp); fclose(user_data->forward.saveinfo.fp);
if (user_data->reversed.saveinfo.fp != NULL) if (user_data->reversed.saveinfo.fp != NULL)
fclose(user_data->reversed.saveinfo.fp); fclose(user_data->reversed.saveinfo.fp);
user_data->forward.saveinfo.fp = eth_fopen(user_data->f_tempname, "wb"); user_data->forward.saveinfo.fp = ws_fopen(user_data->f_tempname, "wb");
if (user_data->forward.saveinfo.fp == NULL) if (user_data->forward.saveinfo.fp == NULL)
user_data->forward.saveinfo.error_type = TAP_RTP_FILE_OPEN_ERROR; user_data->forward.saveinfo.error_type = TAP_RTP_FILE_OPEN_ERROR;
user_data->reversed.saveinfo.fp = eth_fopen(user_data->r_tempname, "wb"); user_data->reversed.saveinfo.fp = ws_fopen(user_data->r_tempname, "wb");
if (user_data->reversed.saveinfo.fp == NULL) if (user_data->reversed.saveinfo.fp == NULL)
user_data->reversed.saveinfo.error_type = TAP_RTP_FILE_OPEN_ERROR; user_data->reversed.saveinfo.error_type = TAP_RTP_FILE_OPEN_ERROR;
return; return;
@ -712,8 +712,8 @@ static void on_destroy(GtkWidget *win _U_, user_data_t *user_data _U_)
if (user_data->reversed.saveinfo.fp != NULL) if (user_data->reversed.saveinfo.fp != NULL)
fclose(user_data->reversed.saveinfo.fp); fclose(user_data->reversed.saveinfo.fp);
/*XXX: test for error **/ /*XXX: test for error **/
eth_remove(user_data->f_tempname); ws_remove(user_data->f_tempname);
eth_remove(user_data->r_tempname); ws_remove(user_data->r_tempname);
/* destroy save_voice_as window if open */ /* destroy save_voice_as window if open */
if (user_data->dlg.save_voice_as_w != NULL) if (user_data->dlg.save_voice_as_w != NULL)
@ -1869,7 +1869,7 @@ static void save_csv_as_ok_cb(GtkWidget *bt _U_, gpointer fs /*user_data_t *user
user_data = (user_data_t*)g_object_get_data(G_OBJECT(bt), "user_data"); user_data = (user_data_t*)g_object_get_data(G_OBJECT(bt), "user_data");
if (GTK_TOGGLE_BUTTON(forw)->active || GTK_TOGGLE_BUTTON(both)->active) { if (GTK_TOGGLE_BUTTON(forw)->active || GTK_TOGGLE_BUTTON(both)->active) {
fp = eth_fopen(g_dest, "w"); fp = ws_fopen(g_dest, "w");
if (fp == NULL) { if (fp == NULL) {
open_failure_alert_box(g_dest, errno, TRUE); open_failure_alert_box(g_dest, errno, TRUE);
return; return;
@ -1923,7 +1923,7 @@ static void save_csv_as_ok_cb(GtkWidget *bt _U_, gpointer fs /*user_data_t *user
if (GTK_TOGGLE_BUTTON(rev)->active || GTK_TOGGLE_BUTTON(both)->active) { if (GTK_TOGGLE_BUTTON(rev)->active || GTK_TOGGLE_BUTTON(both)->active) {
if (GTK_TOGGLE_BUTTON(both)->active) { if (GTK_TOGGLE_BUTTON(both)->active) {
fp = eth_fopen(g_dest, "a"); fp = ws_fopen(g_dest, "a");
if (fp == NULL) { if (fp == NULL) {
open_failure_alert_box(g_dest, errno, TRUE); open_failure_alert_box(g_dest, errno, TRUE);
return; return;
@ -1935,7 +1935,7 @@ static void save_csv_as_ok_cb(GtkWidget *bt _U_, gpointer fs /*user_data_t *user
return; return;
} }
} else { } else {
fp = eth_fopen(g_dest, "w"); fp = ws_fopen(g_dest, "w");
if (fp == NULL) { if (fp == NULL) {
open_failure_alert_box(g_dest, errno, TRUE); open_failure_alert_box(g_dest, errno, TRUE);
return; return;
@ -2099,20 +2099,20 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
gboolean stop_flag = FALSE; gboolean stop_flag = FALSE;
size_t nchars; size_t nchars;
forw_fd = eth_open(user_data->f_tempname, O_RDONLY | O_BINARY, 0000 /* no creation so don't matter */); forw_fd = ws_open(user_data->f_tempname, O_RDONLY | O_BINARY, 0000 /* no creation so don't matter */);
if (forw_fd < 0) if (forw_fd < 0)
return FALSE; return FALSE;
rev_fd = eth_open(user_data->r_tempname, O_RDONLY | O_BINARY, 0000 /* no creation so don't matter */); rev_fd = ws_open(user_data->r_tempname, O_RDONLY | O_BINARY, 0000 /* no creation so don't matter */);
if (rev_fd < 0) { if (rev_fd < 0) {
eth_close(forw_fd); ws_close(forw_fd);
return FALSE; return FALSE;
} }
/* open file for saving */ /* open file for saving */
to_fd = eth_open(dest, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); to_fd = ws_open(dest, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
if (to_fd < 0) { if (to_fd < 0) {
eth_close(forw_fd); ws_close(forw_fd);
eth_close(rev_fd); ws_close(rev_fd);
return FALSE; return FALSE;
} }
@ -2123,22 +2123,22 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
/* First we write the .au header. XXX Hope this is endian independant */ /* First we write the .au header. XXX Hope this is endian independant */
/* the magic word 0x2e736e64 == .snd */ /* the magic word 0x2e736e64 == .snd */
phtonl(pd, 0x2e736e64); phtonl(pd, 0x2e736e64);
nchars=eth_write(to_fd, pd, 4); nchars=ws_write(to_fd, pd, 4);
/* header offset == 24 bytes */ /* header offset == 24 bytes */
phtonl(pd, 24); phtonl(pd, 24);
nchars=eth_write(to_fd, pd, 4); nchars=ws_write(to_fd, pd, 4);
/* total length, it is permited to set this to 0xffffffff */ /* total length, it is permited to set this to 0xffffffff */
phtonl(pd, -1); phtonl(pd, -1);
nchars=eth_write(to_fd, pd, 4); nchars=ws_write(to_fd, pd, 4);
/* encoding format == 16-bit linear PCM */ /* encoding format == 16-bit linear PCM */
phtonl(pd, 3); phtonl(pd, 3);
nchars=eth_write(to_fd, pd, 4); nchars=ws_write(to_fd, pd, 4);
/* sample rate == 8000 Hz */ /* sample rate == 8000 Hz */
phtonl(pd, 8000); phtonl(pd, 8000);
nchars=eth_write(to_fd, pd, 4); nchars=ws_write(to_fd, pd, 4);
/* channels == 1 */ /* channels == 1 */
phtonl(pd, 1); phtonl(pd, 1);
nchars=eth_write(to_fd, pd, 4); nchars=ws_write(to_fd, pd, 4);
switch (channels) { switch (channels) {
@ -2165,18 +2165,18 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
phtons(pd, sample); phtons(pd, sample);
} }
else{ else{
eth_close(forw_fd); ws_close(forw_fd);
eth_close(rev_fd); ws_close(rev_fd);
eth_close(to_fd); ws_close(to_fd);
destroy_progress_dlg(progbar); destroy_progress_dlg(progbar);
return FALSE; return FALSE;
} }
fwritten = eth_write(to_fd, pd, 2); fwritten = ws_write(to_fd, pd, 2);
if ((fwritten < 2) || (fwritten < 0) || (fread < 0)) { if ((fwritten < 2) || (fwritten < 0) || (fread < 0)) {
eth_close(forw_fd); ws_close(forw_fd);
eth_close(rev_fd); ws_close(rev_fd);
eth_close(to_fd); ws_close(to_fd);
destroy_progress_dlg(progbar); destroy_progress_dlg(progbar);
return FALSE; return FALSE;
} }
@ -2206,18 +2206,18 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
phtons(pd, sample); phtons(pd, sample);
} }
else{ else{
eth_close(forw_fd); ws_close(forw_fd);
eth_close(rev_fd); ws_close(rev_fd);
eth_close(to_fd); ws_close(to_fd);
destroy_progress_dlg(progbar); destroy_progress_dlg(progbar);
return FALSE; return FALSE;
} }
rwritten = eth_write(to_fd, pd, 2); rwritten = ws_write(to_fd, pd, 2);
if ((rwritten < 2) || (rwritten < 0) || (rread < 0)) { if ((rwritten < 2) || (rwritten < 0) || (rread < 0)) {
eth_close(forw_fd); ws_close(forw_fd);
eth_close(rev_fd); ws_close(rev_fd);
eth_close(to_fd); ws_close(to_fd);
destroy_progress_dlg(progbar); destroy_progress_dlg(progbar);
return FALSE; return FALSE;
} }
@ -2291,19 +2291,19 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
} }
else else
{ {
eth_close(forw_fd); ws_close(forw_fd);
eth_close(rev_fd); ws_close(rev_fd);
eth_close(to_fd); ws_close(to_fd);
destroy_progress_dlg(progbar); destroy_progress_dlg(progbar);
return FALSE; return FALSE;
} }
rwritten = eth_write(to_fd, pd, 2); rwritten = ws_write(to_fd, pd, 2);
if ((rwritten < 2) || (rread < 0) || (fread < 0)) { if ((rwritten < 2) || (rread < 0) || (fread < 0)) {
eth_close(forw_fd); ws_close(forw_fd);
eth_close(rev_fd); ws_close(rev_fd);
eth_close(to_fd); ws_close(to_fd);
destroy_progress_dlg(progbar); destroy_progress_dlg(progbar);
return FALSE; return FALSE;
} }
@ -2330,9 +2330,9 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
break; break;
} }
default: { default: {
eth_close(forw_fd); ws_close(forw_fd);
eth_close(rev_fd); ws_close(rev_fd);
eth_close(to_fd); ws_close(to_fd);
destroy_progress_dlg(progbar); destroy_progress_dlg(progbar);
return FALSE; return FALSE;
} }
@ -2351,12 +2351,12 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
} }
count++; count++;
rwritten = eth_write(to_fd, pd, 1); rwritten = ws_write(to_fd, pd, 1);
if ((rwritten < rread) || (rwritten < 0) || (rread < 0)) { if ((rwritten < rread) || (rwritten < 0) || (rread < 0)) {
eth_close(forw_fd); ws_close(forw_fd);
eth_close(rev_fd); ws_close(rev_fd);
eth_close(to_fd); ws_close(to_fd);
destroy_progress_dlg(progbar); destroy_progress_dlg(progbar);
return FALSE; return FALSE;
} }
@ -2364,9 +2364,9 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
} }
destroy_progress_dlg(progbar); destroy_progress_dlg(progbar);
eth_close(forw_fd); ws_close(forw_fd);
eth_close(rev_fd); ws_close(rev_fd);
eth_close(to_fd); ws_close(to_fd);
return TRUE; return TRUE;
} }
@ -3276,10 +3276,10 @@ void rtp_analysis(
/*XXX: check for errors*/ /*XXX: check for errors*/
fd = create_tempfile(user_data->f_tempname, sizeof(user_data->f_tempname), fd = create_tempfile(user_data->f_tempname, sizeof(user_data->f_tempname),
"ether_rtp_f"); "ether_rtp_f");
eth_close(fd); ws_close(fd);
fd = create_tempfile(user_data->r_tempname, sizeof(user_data->r_tempname), fd = create_tempfile(user_data->r_tempname, sizeof(user_data->r_tempname),
"ether_rtp_r"); "ether_rtp_r");
eth_close(fd); ws_close(fd);
user_data->forward.saveinfo.fp = NULL; user_data->forward.saveinfo.fp = NULL;
user_data->reversed.saveinfo.fp = NULL; user_data->reversed.saveinfo.fp = NULL;
user_data->dlg.save_voice_as_w = NULL; user_data->dlg.save_voice_as_w = NULL;

View File

@ -50,7 +50,7 @@
#include "../alert_box.h" #include "../alert_box.h"
#include "../simple_dialog.h" #include "../simple_dialog.h"
#include "../tap-rtp-common.h" #include "../tap-rtp-common.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
#include "gtk/rtp_stream.h" #include "gtk/rtp_stream.h"
#include "gtk/rtp_stream_dlg.h" #include "gtk/rtp_stream_dlg.h"
@ -90,7 +90,7 @@ gboolean rtpstream_save(rtp_stream_info_t* stream, const gchar *filename)
{ {
gboolean was_registered = the_tapinfo_struct.is_registered; gboolean was_registered = the_tapinfo_struct.is_registered;
/* open file for saving */ /* open file for saving */
the_tapinfo_struct.save_file = eth_fopen(filename, "wb"); the_tapinfo_struct.save_file = ws_fopen(filename, "wb");
if (the_tapinfo_struct.save_file==NULL) { if (the_tapinfo_struct.save_file==NULL) {
open_failure_alert_box(filename, errno, TRUE); open_failure_alert_box(filename, errno, TRUE);
return FALSE; return FALSE;

View File

@ -36,7 +36,7 @@
#include "epan/filesystem.h" #include "epan/filesystem.h"
#include "../simple_dialog.h" #include "../simple_dialog.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
#include "gtk/text_page_utils.h" #include "gtk/text_page_utils.h"
#include "gtk/gui_utils.h" #include "gtk/gui_utils.h"
@ -113,7 +113,7 @@ static void text_page_set_text(GtkWidget *page, const char *absolute_path)
FILE *text_file; FILE *text_file;
char line[4096+1]; /* XXX - size? */ char line[4096+1]; /* XXX - size? */
text_file = eth_fopen(absolute_path, "r"); text_file = ws_fopen(absolute_path, "r");
if (text_file != NULL) { if (text_file != NULL) {
while (fgets(line, sizeof line, text_file) != NULL) { while (fgets(line, sizeof line, text_file) != NULL) {
text_page_insert(page, line, strlen(line)); text_page_insert(page, line, strlen(line));

View File

@ -46,7 +46,7 @@
#include <process.h> /* getpid */ #include <process.h> /* getpid */
#endif #endif
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include <epan/filesystem.h> #include <epan/filesystem.h>
@ -130,10 +130,10 @@ void u3_register_pid()
g_snprintf(pid_file, pf_size, "%s\\%d.pid", u3hostexecpath, pid); g_snprintf(pid_file, pf_size, "%s\\%d.pid", u3hostexecpath, pid);
pid_fd = eth_open(pid_file, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); pid_fd = ws_open(pid_file, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
if(pid_fd != -1) if(pid_fd != -1)
eth_close(pid_fd); ws_close(pid_fd);
else { else {
g_free(pid_file); g_free(pid_file);
pid_file = NULL; pid_file = NULL;
@ -146,7 +146,7 @@ void u3_deregister_pid()
{ {
if(pid_file) { if(pid_file) {
/* we don't care if we succeed or fail - u3utils may have deleted the file */ /* we don't care if we succeed or fail - u3utils may have deleted the file */
eth_unlink(pid_file); ws_unlink(pid_file);
g_free(pid_file); g_free(pid_file);

View File

@ -33,7 +33,7 @@
#include "svnversion.h" #include "svnversion.h"
#include "merge.h" #include "merge.h"
#include "file_util.h" #include "wsutil/file_util.h"
#ifdef HAVE_FCNTL_H #ifdef HAVE_FCNTL_H
#include <fcntl.h> #include <fcntl.h>
@ -313,7 +313,7 @@ main(int argc, char *argv[])
out_fd = 1 /*stdout*/; out_fd = 1 /*stdout*/;
} else { } else {
/* open the outfile */ /* open the outfile */
out_fd = eth_open(out_filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); out_fd = ws_open(out_filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
if (out_fd == -1) { if (out_fd == -1) {
fprintf(stderr, "mergecap: Couldn't open output file %s: %s\n", fprintf(stderr, "mergecap: Couldn't open output file %s: %s\n",
out_filename, strerror(errno)); out_filename, strerror(errno));

View File

@ -39,7 +39,7 @@
#include <glib.h> #include <glib.h>
#include "file_util.h" #include <wsutil/file_util.h>
#ifndef __set_errno #ifndef __set_errno
#define __set_errno(x) errno=(x) #define __set_errno(x) errno=(x)
@ -76,7 +76,7 @@ mkstemp (template)
template[len - 6] = letters[i]; template[len - 6] = letters[i];
fd = eth_open (template, O_RDWR|O_BINARY|O_CREAT|O_EXCL, 0600); fd = ws_open (template, O_RDWR|O_BINARY|O_CREAT|O_EXCL, 0600);
if (fd >= 0) if (fd >= 0)
return fd; return fd;
} }

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
@ -18,7 +18,7 @@ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib ..\..\wiretap\wiretap-$(WTAP_VERSION).lib LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib ..\..\wsutil\libwsutil.lib
CFLAGS=/DHAVE_WIN32_LIBWIRESHARK_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS) CFLAGS=/DHAVE_WIN32_LIBWIRESHARK_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS)
DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj)

View File

@ -85,7 +85,7 @@
#include <epan/dissectors/packet-tcp.h> #include <epan/dissectors/packet-tcp.h>
#include <epan/oids.h> #include <epan/oids.h>
#include <plugins/asn1/asn1.h> #include <plugins/asn1/asn1.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#ifdef DISSECTOR_WITH_GUI #ifdef DISSECTOR_WITH_GUI
#include <gtk/gtk.h> #include <gtk/gtk.h>
@ -2797,7 +2797,7 @@ static char eol[] = "\r\n";
(void) log_domain; (void) log_level; (void) user_data; /* make references */ (void) log_domain; (void) log_level; (void) user_data; /* make references */
if (logf == NULL && asn1_logfile) { if (logf == NULL && asn1_logfile) {
logf = eth_fopen(asn1_logfile, "w"); logf = ws_fopen(asn1_logfile, "w");
} }
if (logf) { if (logf) {
fputs(message, logf); fputs(message, logf);
@ -2818,7 +2818,7 @@ read_asn1_type_table(const char *filename)
if ((filename == 0) || (strlen(filename) == 0)) if ((filename == 0) || (strlen(filename) == 0))
return; /* no filename provided */ return; /* no filename provided */
f = eth_fopen(filename, "rb"); f = ws_fopen(filename, "rb");
if (f == 0) { if (f == 0) {
/* /*
* Ignore "file not found" errors if it's the old default * Ignore "file not found" errors if it's the old default
@ -3929,7 +3929,7 @@ create_message_window(void)
model = gtk_tree_store_new(N_COLUMNS, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, model = gtk_tree_store_new(N_COLUMNS, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT,
G_TYPE_STRING, G_TYPE_STRING); G_TYPE_STRING, G_TYPE_STRING);
namelist = eth_fopen("namelist.txt", "w"); namelist = ws_fopen("namelist.txt", "w");
build_tree_view(model, PDUtree, NULL); build_tree_view(model, PDUtree, NULL);
fclose(namelist); fclose(namelist);
namelist = 0; namelist = 0;

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
CPPFLAGS = $(CFLAGS) -TP CPPFLAGS = $(CFLAGS) -TP

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -6,7 +6,7 @@ include ..\..\config.nmake
############### no need to modify below this line ######### ############### no need to modify below this line #########
CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS) LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../wimax /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../wimax $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -13,7 +13,7 @@ include Makefile.common
LEMON=..\..\tools\lemon LEMON=..\..\tools\lemon
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) /I$(LEMON)\ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) /I$(LEMON)\
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
@ -22,7 +22,7 @@ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) /I$(LEMON)\
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib ..\..\wiretap\wiretap-$(WTAP_VERSION).lib LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib ..\..\wsutil\libwsutil.lib
CFLAGS=/DHAVE_WIN32_LIBWIRESHARK_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS) CFLAGS=/DHAVE_WIN32_LIBWIRESHARK_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS)
DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj)

View File

@ -28,7 +28,7 @@
#include "mate.h" #include "mate.h"
#include "mate_grammar.h" #include "mate_grammar.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#define DUMMY void* #define DUMMY void*
@ -264,8 +264,8 @@ decl ::= DONE_KW SEMICOLON.
debug_decl ::= DEBUG_KW OPEN_BRACE dbgfile_default dbglevel_default pdu_dbglevel_default gop_dbglevel_default gog_dbglevel_default CLOSE_BRACE SEMICOLON. debug_decl ::= DEBUG_KW OPEN_BRACE dbgfile_default dbglevel_default pdu_dbglevel_default gop_dbglevel_default gog_dbglevel_default CLOSE_BRACE SEMICOLON.
dbgfile_default ::= FILENAME_KW QUOTED(Filename) SEMICOLON. { mc->dbg_facility = eth_fopen(Filename,"w"); if (mc->dbg_facility == NULL) report_open_failure(Filename,errno,TRUE); } dbgfile_default ::= FILENAME_KW QUOTED(Filename) SEMICOLON. { mc->dbg_facility = ws_fopen(Filename,"w"); if (mc->dbg_facility == NULL) report_open_failure(Filename,errno,TRUE); }
dbgfile_default ::= FILENAME_KW NAME(Filename) SEMICOLON. { mc->dbg_facility = eth_fopen(Filename,"w"); if (mc->dbg_facility == NULL) report_open_failure(Filename,errno,TRUE); } dbgfile_default ::= FILENAME_KW NAME(Filename) SEMICOLON. { mc->dbg_facility = ws_fopen(Filename,"w"); if (mc->dbg_facility == NULL) report_open_failure(Filename,errno,TRUE); }
dbgfile_default ::= . dbgfile_default ::= .
dbglevel_default ::= LEVEL_KW INTEGER(LevelString) SEMICOLON. { mc->dbg_lvl = (int) strtol(LevelString,NULL,10); } dbglevel_default ::= LEVEL_KW INTEGER(LevelString) SEMICOLON. { mc->dbg_lvl = (int) strtol(LevelString,NULL,10); }

View File

@ -42,7 +42,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include "mate.h" #include "mate.h"
#include "mate_grammar.h" #include "mate_grammar.h"
@ -173,7 +173,7 @@ blk_cmnt_stop "*/"
g_error("dtd_preparse: include files nested to deeply"); g_error("dtd_preparse: include files nested to deeply");
include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER; include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
yyin = eth_fopen( yytext, "r" ); yyin = ws_fopen( yytext, "r" );
if (!yyin) { if (!yyin) {
yy_delete_buffer( YY_CURRENT_BUFFER ); yy_delete_buffer( YY_CURRENT_BUFFER );
@ -289,7 +289,7 @@ extern gboolean mate_load_config(const gchar* filename, mate_config* matecfg) {
volatile gboolean state = TRUE; volatile gboolean state = TRUE;
mc = matecfg; mc = matecfg;
yyin = eth_fopen(filename,"r"); yyin = ws_fopen(filename,"r");
if (!yyin) { if (!yyin) {
g_string_append_printf(mc->config_error,"Mate parser: Could not open file: '%s', error: %s", filename, strerror(errno) ); g_string_append_printf(mc->config_error,"Mate parser: Could not open file: '%s', error: %s", filename, strerror(errno) );

View File

@ -27,7 +27,7 @@
#include "mate.h" #include "mate.h"
#include "mate_util.h" #include "mate_util.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
/*************************************************************************** /***************************************************************************
* dbg_print * dbg_print
@ -1630,7 +1630,7 @@ extern LoAL* loal_from_file(gchar* filename) {
state = START; state = START;
if (( fp = eth_fopen(filename,"r") )) { if (( fp = ws_fopen(filename,"r") )) {
while(( c = (gchar) fgetc(fp) )){ while(( c = (gchar) fgetc(fp) )){
if ( feof(fp) ) { if ( feof(fp) ) {

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -9,7 +9,7 @@ include <win32.mak>
LEMON=..\..\tools\lemon LEMON=..\..\tools\lemon
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) /I$(LEMON)\ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) /I$(LEMON)\
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::

View File

@ -10,7 +10,7 @@ include ..\..\Makefile.nmake.inc
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
@ -19,7 +19,7 @@ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib ..\..\wsutil\libwsutil.lib
CFLAGS=/DHAVE_WIN32_LIBWIRESHARK_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS) CFLAGS=/DHAVE_WIN32_LIBWIRESHARK_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS)
DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj)

View File

@ -65,7 +65,7 @@
#include <epan/emem.h> #include <epan/emem.h>
#include <epan/value_string.h> #include <epan/value_string.h>
#include <epan/packet.h> /* array_length */ #include <epan/packet.h> /* array_length */
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include "wimaxasncp_dict.h" #include "wimaxasncp_dict.h"
#include "wimaxasncp_dict_lex.h" #include "wimaxasncp_dict_lex.h"
@ -592,7 +592,7 @@ static FILE *wimaxasncp_dict_open(
fname = g_strdup(filename); fname = g_strdup(filename);
} }
fh = eth_fopen(fname,"r"); fh = ws_fopen(fname,"r");
D(("fname: %s fh: %p\n",fname,fh)); D(("fname: %s fh: %p\n",fname,fh));

View File

@ -40,7 +40,7 @@
#include "packet-range.h" #include "packet-range.h"
#include "print.h" #include "print.h"
#include "ps.h" #include "ps.h"
#include "file_util.h" #include <wsutil/file_util.h>
#include <epan/charsets.h> #include <epan/charsets.h>
#include <epan/dissectors/packet-data.h> #include <epan/dissectors/packet-data.h>
#include <epan/dissectors/packet-frame.h> #include <epan/dissectors/packet-frame.h>
@ -103,7 +103,7 @@ open_print_dest(int to_file, const char *dest)
/* Open the file or command for output */ /* Open the file or command for output */
if (to_file) if (to_file)
fh = eth_fopen(dest, "w"); fh = ws_fopen(dest, "w");
else else
fh = popen(dest, "w"); fh = popen(dest, "w");

View File

@ -73,7 +73,7 @@
#include <epan/epan.h> #include <epan/epan.h>
#include <epan/filesystem.h> #include <epan/filesystem.h>
#include <epan/privileges.h> #include <epan/privileges.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include "globals.h" #include "globals.h"
#include <epan/packet.h> #include <epan/packet.h>
@ -268,7 +268,7 @@ raw_pipe_open(const char *pipe_name)
#endif /* _WIN32 */ #endif /* _WIN32 */
} else { } else {
#ifndef _WIN32 #ifndef _WIN32
if (eth_stat(pipe_name, &pipe_stat) < 0) { if (ws_stat(pipe_name, &pipe_stat) < 0) {
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG,
"The capture session could not be initiated " "The capture session could not be initiated "
"due to error on pipe: %s", strerror(errno)); "due to error on pipe: %s", strerror(errno));
@ -288,7 +288,7 @@ raw_pipe_open(const char *pipe_name)
} }
return -1; return -1;
} }
rfd = eth_open(pipe_name, O_RDONLY | O_NONBLOCK, 0000 /* no creation so don't matter */); rfd = ws_open(pipe_name, O_RDONLY | O_NONBLOCK, 0000 /* no creation so don't matter */);
if (rfd == -1) { if (rfd == -1) {
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG,
"The capture session could not be initiated " "The capture session could not be initiated "

View File

@ -67,7 +67,7 @@
#include "pcapio.h" #include "pcapio.h"
#include "ringbuffer.h" #include "ringbuffer.h"
#include "file_util.h" #include <wsutil/file_util.h>
/* Ringbuffer file structure */ /* Ringbuffer file structure */
@ -105,7 +105,7 @@ static int ringbuf_open_file(rb_file *rfile, int *err)
if (rfile->name != NULL) { if (rfile->name != NULL) {
if (rb_data.unlimited == FALSE) { if (rb_data.unlimited == FALSE) {
/* remove old file (if any, so ignore error) */ /* remove old file (if any, so ignore error) */
eth_unlink(rfile->name); ws_unlink(rfile->name);
} }
g_free(rfile->name); g_free(rfile->name);
} }
@ -125,7 +125,7 @@ static int ringbuf_open_file(rb_file *rfile, int *err)
return -1; return -1;
} }
rb_data.fd = eth_open(rfile->name, O_RDWR|O_BINARY|O_TRUNC|O_CREAT, 0600); rb_data.fd = ws_open(rfile->name, O_RDWR|O_BINARY|O_TRUNC|O_CREAT, 0600);
if (rb_data.fd == -1 && err != NULL) { if (rb_data.fd == -1 && err != NULL) {
*err = errno; *err = errno;
@ -255,7 +255,7 @@ ringbuf_switch_file(FILE **pdh, gchar **save_file, int *save_file_fd,
/* close current file */ /* close current file */
if (!libpcap_dump_close(rb_data.pdh, err)) { if (!libpcap_dump_close(rb_data.pdh, err)) {
eth_close(rb_data.fd); /* XXX - the above should have closed this already */ ws_close(rb_data.fd); /* XXX - the above should have closed this already */
rb_data.pdh = NULL; /* it's still closed, we just got an error while closing */ rb_data.pdh = NULL; /* it's still closed, we just got an error while closing */
rb_data.fd = -1; rb_data.fd = -1;
return FALSE; return FALSE;
@ -298,7 +298,7 @@ ringbuf_libpcap_dump_close(gchar **save_file, int *err)
/* close current file, if it's open */ /* close current file, if it's open */
if (rb_data.pdh != NULL) { if (rb_data.pdh != NULL) {
if (!libpcap_dump_close(rb_data.pdh, err)) { if (!libpcap_dump_close(rb_data.pdh, err)) {
eth_close(rb_data.fd); ws_close(rb_data.fd);
ret_val = FALSE; ret_val = FALSE;
} }
@ -359,14 +359,14 @@ ringbuf_error_cleanup(void)
/* XXX - it shouldn't still be open; "libpcap_dump_close()" should leave the /* XXX - it shouldn't still be open; "libpcap_dump_close()" should leave the
file closed even if it fails */ file closed even if it fails */
if (rb_data.fd != -1) { if (rb_data.fd != -1) {
eth_close(rb_data.fd); ws_close(rb_data.fd);
rb_data.fd = -1; rb_data.fd = -1;
} }
if (rb_data.files != NULL) { if (rb_data.files != NULL) {
for (i=0; i < rb_data.num_files; i++) { for (i=0; i < rb_data.num_files; i++) {
if (rb_data.files[i].name != NULL) { if (rb_data.files[i].name != NULL) {
eth_unlink(rb_data.files[i].name); ws_unlink(rb_data.files[i].name);
} }
} }
} }

View File

@ -37,14 +37,13 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include "file_util.h"
#ifdef HAVE_WINDOWS_H #ifdef HAVE_WINDOWS_H
#include <windows.h> #include <windows.h>
#endif #endif
#include "tempfile.h" #include "tempfile.h"
#include "mkstemp.h" #include "mkstemp.h"
#include <wsutil/file_util.h>
static const char * static const char *
setup_tmpdir(const char *dir) setup_tmpdir(const char *dir)

View File

@ -97,7 +97,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include <time.h> #include <time.h>
#include <glib.h> #include <glib.h>
@ -1264,7 +1264,7 @@ parse_options (int argc, char *argv[])
if (strcmp(argv[optind], "-")) { if (strcmp(argv[optind], "-")) {
input_filename = g_strdup(argv[optind]); input_filename = g_strdup(argv[optind]);
input_file = eth_fopen(input_filename, "rb"); input_file = ws_fopen(input_filename, "rb");
if (!input_file) { if (!input_file) {
fprintf(stderr, "Cannot open file [%s] for reading: %s\n", fprintf(stderr, "Cannot open file [%s] for reading: %s\n",
input_filename, strerror(errno)); input_filename, strerror(errno));
@ -1277,7 +1277,7 @@ parse_options (int argc, char *argv[])
if (strcmp(argv[optind+1], "-")) { if (strcmp(argv[optind+1], "-")) {
output_filename = g_strdup(argv[optind+1]); output_filename = g_strdup(argv[optind+1]);
output_file = eth_fopen(output_filename, "wb"); output_file = ws_fopen(output_filename, "wb");
if (!output_file) { if (!output_file) {
fprintf(stderr, "Cannot open file [%s] for writing: %s\n", fprintf(stderr, "Cannot open file [%s] for writing: %s\n",
output_filename, strerror(errno)); output_filename, strerror(errno));

View File

@ -76,7 +76,7 @@ my @prohibitedAPIs=
'g_strdown', 'g_strdown',
'g_string_up', 'g_string_up',
'g_string_down', 'g_string_down',
# Use the eth_* version of these: # Use the ws_* version of these:
# (Necessary because on Windows we use UTF8 for throughout the code # (Necessary because on Windows we use UTF8 for throughout the code
# so we must tweak that to UTF16 before operating on the file. Code # so we must tweak that to UTF16 before operating on the file. Code
# using these functions will work unless the file/path name contains # using these functions will work unless the file/path name contains

View File

@ -63,7 +63,6 @@
#include <epan/epan.h> #include <epan/epan.h>
#include <epan/filesystem.h> #include <epan/filesystem.h>
#include <epan/privileges.h> #include <epan/privileges.h>
#include <wiretap/file_util.h>
#include "globals.h" #include "globals.h"
#include <epan/timestamp.h> #include <epan/timestamp.h>

View File

@ -41,7 +41,7 @@
#include "capture-pcap-util.h" #include "capture-pcap-util.h"
#endif #endif
#include "file_util.h" #include <wsutil/file_util.h>
#include <wininet.h> #include <wininet.h>
#include "nio-ie5.h" #include "nio-ie5.h"
@ -74,7 +74,7 @@ download_file(const char *url, const char *filename) {
/* open output file */ /* open output file */
fd = eth_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); fd = ws_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
if(fd == -1) { if(fd == -1) {
g_warning("Couldn't open output file %s!", filename); g_warning("Couldn't open output file %s!", filename);
return -1; return -1;
@ -94,7 +94,7 @@ download_file(const char *url, const char *filename) {
chunk_len = netio_ie5_read (conn, buf, sizeof(buf)); chunk_len = netio_ie5_read (conn, buf, sizeof(buf));
/* write bytes to the output file */ /* write bytes to the output file */
stream_len = eth_write( fd, buf, chunk_len); stream_len = ws_write( fd, buf, chunk_len);
if(stream_len != chunk_len) { if(stream_len != chunk_len) {
g_warning("output failed: stream_len %u != chunk_len %u", stream_len, chunk_len); g_warning("output failed: stream_len %u != chunk_len %u", stream_len, chunk_len);
ret = -1; ret = -1;
@ -104,7 +104,7 @@ download_file(const char *url, const char *filename) {
netio_ie5_disconnect(conn); netio_ie5_disconnect(conn);
eth_close(fd); ws_close(fd);
return ret; return ret;
} }
@ -226,7 +226,7 @@ update_check_wireshark(const char *local_file)
update_info->version_installed = g_strdup(VERSION); update_info->version_installed = g_strdup(VERSION);
update_info->prefix = "wireshark.setup."; update_info->prefix = "wireshark.setup.";
pf = eth_fopen(local_file, "r"); pf = ws_fopen(local_file, "r");
if(pf != NULL) { if(pf != NULL) {
/* read in update_info of Wireshark */ /* read in update_info of Wireshark */
read_prefs_file(local_file, pf, update_pref, update_info); read_prefs_file(local_file, pf, update_pref, update_info);
@ -259,7 +259,7 @@ update_check_winpcap(const char *local_file)
update_info->prefix = "winpcap."; update_info->prefix = "winpcap.";
pf = eth_fopen(local_file, "r"); pf = ws_fopen(local_file, "r");
if(pf != NULL) { if(pf != NULL) {
/* read in update_info of WinPcap */ /* read in update_info of WinPcap */
read_prefs_file(local_file, pf, update_pref, update_info); read_prefs_file(local_file, pf, update_pref, update_info);

View File

@ -87,7 +87,6 @@ NONGENERATED_HEADER_FILES = \
erf.h \ erf.h \
etherpeek.h \ etherpeek.h \
eyesdn.h \ eyesdn.h \
file_util.h \
file_wrappers.h \ file_wrappers.h \
hcidump.h \ hcidump.h \
i4btrace.h \ i4btrace.h \

View File

@ -17,7 +17,7 @@ CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL
.c.obj:: .c.obj::
$(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $< $(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $<
OBJECTS=$(NONGENERATED_C_FILES:.c=.obj) $(GENERATED_C_FILES:.c=.obj) file_util.obj OBJECTS=$(NONGENERATED_C_FILES:.c=.obj) $(GENERATED_C_FILES:.c=.obj)
wiretap_LIBS = \ wiretap_LIBS = \
$(GLIB_LIBS) \ $(GLIB_LIBS) \

View File

@ -28,7 +28,7 @@
#include "ascend.h" #include "ascend.h"
#include "ascend-int.h" #include "ascend-int.h"
#include "file_wrappers.h" #include "file_wrappers.h"
#include "file_util.h" #include <wsutil/file_util.h>
#include <errno.h> #include <errno.h>

View File

@ -38,7 +38,7 @@
#include <errno.h> #include <errno.h>
#include "file_util.h" #include <wsutil/file_util.h>
#include "wtap-int.h" #include "wtap-int.h"
#include "file_wrappers.h" #include "file_wrappers.h"
@ -223,7 +223,7 @@ wtap* wtap_open_offline(const char *filename, int *err, char **err_info,
return NULL; return NULL;
} }
} else { } else {
if (eth_stat(filename, &statb) < 0) { if (ws_stat(filename, &statb) < 0) {
*err = errno; *err = errno;
return NULL; return NULL;
} }
@ -285,12 +285,12 @@ wtap* wtap_open_offline(const char *filename, int *err, char **err_info,
* an fclose or gzclose of wth->fh closing the standard * an fclose or gzclose of wth->fh closing the standard
* input of the process. * input of the process.
*/ */
wth->fd = eth_dup(0); wth->fd = ws_dup(0);
#ifdef _WIN32 #ifdef _WIN32
_setmode(wth->fd, O_BINARY); _setmode(wth->fd, O_BINARY);
#endif #endif
} else } else
wth->fd = eth_open(filename, O_RDONLY|O_BINARY, 0000 /* no creation so don't matter */); wth->fd = ws_open(filename, O_RDONLY|O_BINARY, 0000 /* no creation so don't matter */);
if (wth->fd < 0) { if (wth->fd < 0) {
*err = errno; *err = errno;
g_free(wth); g_free(wth);
@ -298,7 +298,7 @@ wtap* wtap_open_offline(const char *filename, int *err, char **err_info,
} }
if (!(wth->fh = filed_open(wth->fd, "rb"))) { if (!(wth->fh = filed_open(wth->fd, "rb"))) {
*err = errno; *err = errno;
eth_close(wth->fd); ws_close(wth->fd);
g_free(wth); g_free(wth);
return NULL; return NULL;
} }
@ -755,7 +755,7 @@ wtap_dumper* wtap_dump_open(const char *filename, int filetype, int encap,
opening it. */ opening it. */
if (wdh->fh != stdout) { if (wdh->fh != stdout) {
wtap_dump_file_close(wdh); wtap_dump_file_close(wdh);
eth_unlink(filename); ws_unlink(filename);
} }
g_free(wdh); g_free(wdh);
return NULL; return NULL;
@ -953,7 +953,7 @@ static FILE *wtap_dump_file_open(wtap_dumper *wdh, const char *filename)
} else } else
#endif #endif
{ {
return eth_fopen(filename, "wb"); return ws_fopen(filename, "wb");
} }
} }

View File

@ -113,7 +113,7 @@
#endif /* HAVE_LIBZ */ #endif /* HAVE_LIBZ */
#include "wtap-int.h" #include "wtap-int.h"
#include "file_wrappers.h" #include "file_wrappers.h"
#include "file_util.h" #include <wsutil/file_util.h>
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
@ -149,13 +149,13 @@ file_open(const char *path, const char *mode)
oflag |= O_BINARY; oflag |= O_BINARY;
#endif #endif
/* open file and do correct filename conversions */ /* open file and do correct filename conversions */
if ((fd = eth_open(path, oflag, 0666)) == -1) if ((fd = ws_open(path, oflag, 0666)) == -1)
return NULL; return NULL;
/* open zlib file handle */ /* open zlib file handle */
ft = gzdopen(fd, mode); ft = gzdopen(fd, mode);
if (ft == NULL) { if (ft == NULL) {
eth_close(fd); ws_close(fd);
return NULL; return NULL;
} }

Some files were not shown because too many files have changed in this diff Show More