diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-05-14 10:15:12 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-05-14 10:15:12 +0000 |
commit | e390d7e0cc3cb6247f5198bc81baff90b754051c (patch) | |
tree | 1a25f5a6711676f4ad9ee3967225728d2895601e /tethereal.c | |
parent | eb4f9a696cd794274ba34f2a54f30272855dd0d7 (diff) | |
download | wireshark-e390d7e0cc3cb6247f5198bc81baff90b754051c.tar.gz wireshark-e390d7e0cc3cb6247f5198bc81baff90b754051c.tar.bz2 wireshark-e390d7e0cc3cb6247f5198bc81baff90b754051c.zip |
Make the "-G" flag take an argument. If no arugment is specified, or if
the argument is "fields", dump out a table of the fields, as we
currently do; if the argument is "protocols", dump out a table of the
protocols.
svn path=/trunk/; revision=5462
Diffstat (limited to 'tethereal.c')
-rw-r--r-- | tethereal.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/tethereal.c b/tethereal.c index 3e0f726a3c..83369ef45f 100644 --- a/tethereal.c +++ b/tethereal.c @@ -1,6 +1,6 @@ /* tethereal.c * - * $Id: tethereal.c,v 1.135 2002/03/31 20:56:59 guy Exp $ + * $Id: tethereal.c,v 1.136 2002/05/14 10:15:09 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -321,22 +321,31 @@ main(int argc, char *argv[]) char badopt; /* Register all dissectors; we must do this before checking for the - "-G" flag, as the "-G" flag dumps a list of fields registered - by the dissectors, and we must do it before we read the preferences, - in case any dissectors register preferences. */ + "-G" flag, as the "-G" flag dumps information registered by the + dissectors, and we must do it before we read the preferences, in + case any dissectors register preferences. */ epan_init(PLUGIN_DIR,register_all_protocols,register_all_protocol_handoffs); /* Now register the preferences for any non-dissector modules. We must do that before we read the preferences as well. */ prefs_register_modules(); - /* If invoked with the "-G" flag, we dump out a glossary of - display filter symbols. + /* If invoked with the "-G" flag, we dump out information based on + the argument to the "-G" flag; if no argument is specified, + for backwards compatibility we dump out a glossary of display + filter symbols. We do this here to mirror what happens in the GTK+ version, although it's not necessary here. */ if (argc >= 2 && strcmp(argv[1], "-G") == 0) { - proto_registrar_dump(); + if (argc == 2) + proto_registrar_dump_fields(); + else { + if (strcmp(argv[2], "fields") == 0) + proto_registrar_dump_fields(); + else if (strcmp(argv[2], "protocols") == 0) + proto_registrar_dump_protocols(); + } exit(0); } |