diff options
author | Jörg Mayer <jmayer@loplof.de> | 2004-01-18 02:12:59 +0000 |
---|---|---|
committer | Jörg Mayer <jmayer@loplof.de> | 2004-01-18 02:12:59 +0000 |
commit | 82cf1b015db43dc176242ebf766329be76143aac (patch) | |
tree | bfc012619b5147626bc18fc38da868d68045439c | |
parent | 8db6fb47cdc5827cce492a0ca226117d876645f0 (diff) | |
download | wireshark-82cf1b015db43dc176242ebf766329be76143aac.tar.gz |
Output the result of -h to stdout, not stderr
svn path=/trunk/; revision=9702
-rw-r--r-- | mergecap.c | 36 | ||||
-rw-r--r-- | tethereal.c | 42 |
2 files changed, 41 insertions, 37 deletions
diff --git a/mergecap.c b/mergecap.c index 30bd1dbfab..4e92993ba1 100644 --- a/mergecap.c +++ b/mergecap.c @@ -1,6 +1,6 @@ /* Combine two dump files, either by appending or by merging by timestamp * - * $Id: mergecap.c,v 1.13 2004/01/18 01:41:14 obiot Exp $ + * $Id: mergecap.c,v 1.14 2004/01/18 02:12:59 jmayer Exp $ * * Written by Scott Renfro <scott@renfro.org> based on * editcap by Richard Sharpe and Guy Harris @@ -355,29 +355,29 @@ usage() int i; const char *string; - fprintf(stderr, "Usage: mergecap [-hva] [-s <snaplen>] [-T <encap type>]\n"); - fprintf(stderr, " [-F <capture type>] -w <outfile> <infile> [...]\n\n"); - fprintf(stderr, " where\t-h produces this help listing.\n"); - fprintf(stderr, " \t-v verbose operation, default is silent\n"); - fprintf(stderr, " \t-a files should be concatenated, not merged\n"); - fprintf(stderr, " \t Default merges based on frame timestamps\n"); - fprintf(stderr, " \t-s <snaplen>: truncate packets to <snaplen> bytes of data\n"); - fprintf(stderr, " \t-w <outfile>: sets output filename to <outfile>\n"); - fprintf(stderr, " \t-T <encap type> encapsulation type to use:\n"); + printf("Usage: mergecap [-hva] [-s <snaplen>] [-T <encap type>]\n"); + printf(" [-F <capture type>] -w <outfile> <infile> [...]\n\n"); + printf(" where\t-h produces this help listing.\n"); + printf(" \t-v verbose operation, default is silent\n"); + printf(" \t-a files should be concatenated, not merged\n"); + printf(" \t Default merges based on frame timestamps\n"); + printf(" \t-s <snaplen>: truncate packets to <snaplen> bytes of data\n"); + printf(" \t-w <outfile>: sets output filename to <outfile>\n"); + printf(" \t-T <encap type> encapsulation type to use:\n"); for (i = 0; i < WTAP_NUM_ENCAP_TYPES; i++) { string = wtap_encap_short_string(i); if (string != NULL) - fprintf(stderr, " \t %s - %s\n", + printf(" \t %s - %s\n", string, wtap_encap_string(i)); } - fprintf(stderr, " \t default is the same as the first input file\n"); - fprintf(stderr, " \t-F <capture type> capture file type to write:\n"); + printf(" \t default is the same as the first input file\n"); + printf(" \t-F <capture type> capture file type to write:\n"); for (i = 0; i < WTAP_NUM_FILE_TYPES; i++) { if (wtap_dump_can_open(i)) - fprintf(stderr, " \t %s - %s\n", + printf(" \t %s - %s\n", wtap_file_type_short_string(i), wtap_file_type_string(i)); } - fprintf(stderr, " \t default is libpcap\n"); + printf(" \t default is libpcap\n"); } @@ -445,13 +445,13 @@ main(int argc, char *argv[]) break; case 'h': - fprintf(stderr, "mergecap version %s" + printf("mergecap version %s" #ifdef CVSVERSION " (cvs " CVSVERSION ")" #endif "\n", VERSION); usage(); - exit(1); + exit(0); break; case '?': /* Bad options if GNU getopt */ @@ -469,7 +469,7 @@ main(int argc, char *argv[]) in_file_count = argc - optind; if (!out_file.filename) { fprintf(stderr, "mergecap: an output filename must be set with -w\n"); - usage(); + fprintf(stderr, " run with -h for help\n"); exit(1); } diff --git a/tethereal.c b/tethereal.c index ee0125dca7..619d0d9ec8 100644 --- a/tethereal.c +++ b/tethereal.c @@ -1,6 +1,6 @@ /* tethereal.c * - * $Id: tethereal.c,v 1.219 2004/01/18 01:41:13 obiot Exp $ + * $Id: tethereal.c,v 1.220 2004/01/18 02:12:59 jmayer Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -234,40 +234,44 @@ static void print_usage(gboolean print_ver) { int i; + FILE *output; if (print_ver) { - fprintf(stderr, "This is GNU t" PACKAGE " " VERSION + output = stdout; + fprintf(output, "This is GNU t" PACKAGE " " VERSION #ifdef CVSVERSION " (cvs " CVSVERSION ")" #endif "\n%s\n%s\n", comp_info_str->str, runtime_info_str->str); + } else { + output = stderr; } #ifdef HAVE_LIBPCAP - fprintf(stderr, "\nt%s [ -vh ] [ -DlLnpqSVx ] [ -a <capture autostop condition> ] ...\n", + fprintf(output, "\nt%s [ -vh ] [ -DlLnpqSVx ] [ -a <capture autostop condition> ] ...\n", PACKAGE); - fprintf(stderr, "\t[ -b <number of ring buffer files>[:<duration>] ] [ -c <count> ]\n"); - fprintf(stderr, "\t[ -d %s ] ...\n", decode_as_arg_template); - fprintf(stderr, "\t[ -f <capture filter> ] [ -F <output file type> ] [ -i <interface> ]\n"); - fprintf(stderr, "\t[ -N <resolving> ] [ -o <preference setting> ] ... [ -r <infile> ]\n"); - fprintf(stderr, "\t[ -R <read filter> ] [ -s <snaplen> ] [ -t <time stamp format> ]\n"); - fprintf(stderr, "\t[ -T pdml|ps|text ] [ -w <savefile> ] [ -y <link type> ]\n"); - fprintf(stderr, "\t[ -z <statistics string> ]\n"); + fprintf(output, "\t[ -b <number of ring buffer files>[:<duration>] ] [ -c <count> ]\n"); + fprintf(output, "\t[ -d %s ] ...\n", decode_as_arg_template); + fprintf(output, "\t[ -f <capture filter> ] [ -F <output file type> ] [ -i <interface> ]\n"); + fprintf(output, "\t[ -N <resolving> ] [ -o <preference setting> ] ... [ -r <infile> ]\n"); + fprintf(output, "\t[ -R <read filter> ] [ -s <snaplen> ] [ -t <time stamp format> ]\n"); + fprintf(output, "\t[ -T pdml|ps|text ] [ -w <savefile> ] [ -y <link type> ]\n"); + fprintf(output, "\t[ -z <statistics string> ]\n"); #else - fprintf(stderr, "\nt%s [ -vh ] [ -lnVx ]\n", PACKAGE); - fprintf(stderr, "\t[ -d %s ] ...\n", decode_as_arg_template); - fprintf(stderr, "\t[ -F <output file type> ] [ -N <resolving> ]\n"); - fprintf(stderr, "\t[ -o <preference setting> ] ... [ -r <infile> ] [ -R <read filter> ]\n"); - fprintf(stderr, "\t[ -t <time stamp format> ] [ -T pdml|ps|text ] [ -w <savefile> ]\n"); - fprintf(stderr, "\t[ -z <statistics string> ]\n"); + fprintf(output, "\nt%s [ -vh ] [ -lnVx ]\n", PACKAGE); + fprintf(output, "\t[ -d %s ] ...\n", decode_as_arg_template); + fprintf(output, "\t[ -F <output file type> ] [ -N <resolving> ]\n"); + fprintf(output, "\t[ -o <preference setting> ] ... [ -r <infile> ] [ -R <read filter> ]\n"); + fprintf(output, "\t[ -t <time stamp format> ] [ -T pdml|ps|text ] [ -w <savefile> ]\n"); + fprintf(output, "\t[ -z <statistics string> ]\n"); #endif - fprintf(stderr, "Valid file type arguments to the \"-F\" flag:\n"); + fprintf(output, "Valid file type arguments to the \"-F\" flag:\n"); for (i = 0; i < WTAP_NUM_FILE_TYPES; i++) { if (wtap_dump_can_open(i)) - fprintf(stderr, "\t%s - %s\n", + fprintf(output, "\t%s - %s\n", wtap_file_type_short_string(i), wtap_file_type_string(i)); } - fprintf(stderr, "\tdefault is libpcap\n"); + fprintf(output, "\tdefault is libpcap\n"); } #ifdef HAVE_LIBPCAP |