I was starting to add blurbs to the hf_register_info fields for my
protocol dissector, but I couldn't figure out how they were actually
used. I grepped the source and found that the answer is that many
places they aren't.
Attached is a quick patch to use the blurb (if available) for in
display filter help. I swapped the order of the columns make the
display more readable (some of the blurbs are rather long). Probably
the right thing to do is actually use a table or tree widget. An
expandable tree would be nice so that by default there would just be
the relatively short list of protocols. I suppose with the tree you
could combine "Protocols" and "Display Filters" into a single tab.
Index: help_dlg.c
===================================================================
RCS file: /cvsroot/ethereal/gtk/help_dlg.c,v
retrieving revision 1.18
diff -u -r1.18 help_dlg.c
--- help_dlg.c 2001/08/21 06:39:18 1.18
+++ help_dlg.c 2001/11/06 21:36:21
@@ -367,15 +367,13 @@
case DFILTER_HELP :
- /* XXX we should display hinfo->blurb instead of name (if not empty) */
-
/* first pass to know the maximum length of first and second fields */
for (i = 0; i < proto_registrar_n() ; i++) {
if (!proto_registrar_is_protocol(i)) {
hfinfo = proto_registrar_get_nth(i);
if ((len = strlen(hfinfo->abbrev)) > maxlen)
maxlen = len;
- if ((len = strlen(hfinfo->name)) > maxlen2)
+ if ((len = strlen(ftype_pretty_name(hfinfo->type))) > maxlen2)
maxlen2 = len;
}
}
@@ -387,20 +385,26 @@
set_text(w, dfilter_help, maxlen3);
for (i = 0; i < proto_registrar_n() ; i++) {
+ char *name_or_blurb = 0;
hfinfo = proto_registrar_get_nth(i);
+ if(hfinfo->blurb && hfinfo->blurb[0])
+ name_or_blurb = hfinfo->blurb;
+ else
+ name_or_blurb = hfinfo->name;
+
if (proto_registrar_is_protocol(i)) {
- snprintf(buffer, BUFF_LEN, "\n%s:\n", hfinfo->name);
+ snprintf(buffer, BUFF_LEN, "\n%s:\n", name_or_blurb);
set_text(w, buffer, strlen(buffer));
nb_lines += 2;
} else {
type_name = ftype_pretty_name(hfinfo->type);
- snprintf(buffer, BUFF_LEN, "%s%s%s%s(%s)\n",
+ snprintf(buffer, BUFF_LEN, "%s%s(%s)%s%s\n",
hfinfo->abbrev,
&blanks[B_LEN - (maxlen - strlen(hfinfo->abbrev)) - 2],
- hfinfo->name,
- &blanks[B_LEN - (maxlen2 - strlen(hfinfo->name)) - 2],
- type_name);
+ type_name,
+ &blanks[B_LEN - (maxlen2 - strlen(type_name)) - 2],
+ name_or_blurb);
if ((len = strlen(buffer)) > maxlen3) {
maxlen3 = len;
if ((len = gdk_string_width(m_r_font, buffer)) > width)
--
-Andrew Feren
Cetacean Networks, Inc.
Portsmouth, NH