aboutsummaryrefslogtreecommitdiffstats
path: root/print.c
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>1999-07-15 15:33:52 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>1999-07-15 15:33:52 +0000
commit0d36ec8de2e587337c8d8bc787e40de23cda644a (patch)
treef039dce320dbc82cf7724400ce75c8afc499f1c7 /print.c
parentc1bfe4a1a84e4fdae4e28476a4fe23318f12a025 (diff)
Modified the proto_register_field_array usage again. Thanks to Guy's
suggestion, this new method using a static array should use less memory and be faster. It also has a nice side-effect of making the source-code more readble, IMHO. Changed the print routines to look for protocol proto_data instead of looking at the text label as they did before, hoping that the data hex dump field item starts with "Data (". Added the -G keyword to ethereal to make it dump a glossary of display filter keywords to stdout and exit. This data is then formatted with the doc/dfilter2pod perl program to pod format, which is combined with doc/ethereal.pod.template to create doc/ethereal.pod, from which the ethereal manpage is created. This way we can keep the manpage up-to-date with a list of fields that can be filtered on. svn path=/trunk/; revision=364
Diffstat (limited to 'print.c')
-rw-r--r--print.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/print.c b/print.c
index 924d2dfe73..68ba00762f 100644
--- a/print.c
+++ b/print.c
@@ -1,7 +1,7 @@
/* print.c
* Routines for printing packet analysis trees.
*
- * $Id: print.c,v 1.12 1999/07/13 04:38:13 guy Exp $
+ * $Id: print.c,v 1.13 1999/07/15 15:32:43 gram Exp $
*
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
@@ -57,6 +57,7 @@ static void ps_clean_string(unsigned char *out, const unsigned char *in,
static void dumpit_ps (FILE *fh, register const u_char *cp, register u_int length);
extern e_prefs prefs;
+extern int proto_data; /* in packet-data.c */
/* #include "ps.c" */
@@ -343,9 +344,8 @@ void proto_tree_print_node_text(GNode *node, gpointer data)
/* Print the text */
fprintf(pdata->fh, "%s%s\n", space, label_ptr);
- /* If it's uninterpreted data, dump it.
- XXX - have a better way of doing this than looking for "Data (" */
- if (strncmp("Data (", label_ptr, 6) == 0)
+ /* If it's uninterpreted data, dump it. */
+ if (fi->hfinfo->id == proto_data)
dumpit(pdata->fh, &pdata->pd[fi->start], fi->length);
/* Recurse into the subtree, if it exists */
@@ -420,9 +420,8 @@ void proto_tree_print_node_ps(GNode *node, gpointer data)
ps_clean_string(psbuffer, label_ptr, MAX_LINE_LENGTH);
fprintf(pdata->fh, "%d (%s) putline\n", pdata->level, psbuffer);
- /* If it's uninterpreted data, dump it.
- XXX - have a better way of doing this than looking for "Data (" */
- if (strncmp("Data (", label_ptr, 6) == 0) {
+ /* If it's uninterpreted data, dump it. */
+ if (fi->hfinfo->id == proto_data) {
print_ps_hex(pdata->fh);
dumpit_ps(pdata->fh, &pdata->pd[fi->start], fi->length);
}