diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2006-01-06 01:06:46 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2006-01-06 01:06:46 +0000 |
commit | 161d4d7efd09333b28a207a4f746102e2f92a1f5 (patch) | |
tree | 61ec173024a018147abc378475475a3b6f244779 /tethereal.c | |
parent | 6919c9c80f971c57aab1f85aad049d08221c40b7 (diff) |
code cleanup: use "-" for all places, where stdin/stdout is meant
tethereal internally converted the stdout capture filename "-" into "" which doesn't make any real sense and only complicated things.
To make things even more confusing, wiretap expected "" for dump output and "-" for offline reading ...
svn path=/trunk/; revision=16962
Diffstat (limited to 'tethereal.c')
-rw-r--r-- | tethereal.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/tethereal.c b/tethereal.c index c3d892763c..ed447a40e6 100644 --- a/tethereal.c +++ b/tethereal.c @@ -598,7 +598,7 @@ output_file_description(const char *fname) char *save_file_string; /* Get a string that describes what we're writing to */ - if (*fname == '\0') { + if (strcmp(fname, "-") == 0) { /* We're writing to the standard output */ save_file_string = g_strdup("standard output"); } else { @@ -1039,6 +1039,11 @@ main(int argc, char *argv[]) } } + /* If we're not writing to a file and "-q" wasn't specified + we should print packet information */ + if (save_file == NULL && !quiet) + print_packet_info = TRUE; + /* See if we're writing a capture file and the file is a pipe */ #ifdef HAVE_LIBPCAP ld.output_to_pipe = FALSE; @@ -1053,11 +1058,9 @@ main(int argc, char *argv[]) output and have either of them be useful. */ if (print_packet_info) { cmdarg_err("You can't write both raw packet data and dissected packets" - " to the standard error."); + " to the standard output."); exit(1); } - g_free(save_file); - save_file = g_strdup(""); #ifdef HAVE_LIBPCAP /* XXX - should we check whether it's a pipe? It's arguably silly to do "-w - >output_file" rather than "-w output_file", @@ -1068,6 +1071,7 @@ main(int argc, char *argv[]) } #ifdef HAVE_LIBPCAP else { + /* not a capture file, test for a FIFO (aka named pipe) */ err = test_for_fifo(save_file); switch (err) { @@ -1087,11 +1091,6 @@ main(int argc, char *argv[]) } } #endif - } else { - /* We're not writing to a file, so we should print packet information - unless "-q" was specified. */ - if (!quiet) - print_packet_info = TRUE; } #ifndef HAVE_LIBPCAP @@ -1161,7 +1160,7 @@ main(int argc, char *argv[]) "the capture isn't being saved to a file."); exit(1); } - if (strcmp(save_file, "") == 0) { + if (strcmp(save_file, "-") == 0) { cmdarg_err("Multiple capture files requested, but " "the capture is being written to the standard output."); exit(1); |