From 200ff9dc5235d1465c5891e7eaa877a9978bc16a Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Fri, 29 Jul 2005 21:55:45 +0000 Subject: Pick up some fixes and enhancements from http://cvs.fedora.redhat.com/viewcvs/rpms/ethereal/FC-4/: In the LPD dissector, make lpd_client_code a value_string so that we don't segfault. Do the same for lpd_server_code, although it's not strictly necessary. Check to see if htmlview is installed, and use it as our HTML viewer. The Fedora RPM has other patches, but I'm not sure if they should be applied. svn path=/trunk/; revision=15143 --- config.h.win32 | 3 +++ configure.in | 8 ++++++++ epan/dissectors/packet-lpd.c | 39 ++++++++++++++++++++------------------- epan/prefs.c | 2 +- 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/config.h.win32 b/config.h.win32 index e45839a22e..8c5a007176 100644 --- a/config.h.win32 +++ b/config.h.win32 @@ -218,3 +218,6 @@ /* We don't know what the plugin installation directory will be. */ #define PLUGIN_DIR NULL + +/* We shouldn't need this under Windows but we'll define it anyway. */ +#define HTML_VIEWER "mozilla" diff --git a/configure.in b/configure.in index 0963612d5f..4d827c33fd 100644 --- a/configure.in +++ b/configure.in @@ -38,6 +38,14 @@ then # AC_MSG_ERROR(I couldn't find pod2html; make sure it's installed and in your path) fi +AC_PATH_PROG(HTML_VIEWER, htmlview) +if test "x$HTML_VIEWER" = x +then + AC_DEFINE_UNQUOTED(HTML_VIEWER, "mozilla", [HTML viewer, e.g. mozilla]) +else + AC_DEFINE_UNQUOTED(HTML_VIEWER, "htmlview", [HTML viewer, e.g. mozilla]) +fi + AC_PATH_PROG(LEX, flex) AC_PATH_PROG(PYTHON, python) diff --git a/epan/dissectors/packet-lpd.c b/epan/dissectors/packet-lpd.c index 8585c1d8a8..abe592d06c 100644 --- a/epan/dissectors/packet-lpd.c +++ b/epan/dissectors/packet-lpd.c @@ -57,23 +57,24 @@ dissect_lpd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* This information comes from the LPRng HOWTO, which also describes RFC 1179. http://www.astart.com/lprng/LPRng-HOWTO.html */ - static char *lpd_client_code[] = { - "Unknown command", - "LPC: start print / jobcmd: abort", - "LPR: transfer a printer job / jobcmd: receive control file", - "LPQ: print short form of queue status / jobcmd: receive data file", - "LPQ: print long form of queue status", - "LPRM: remove jobs", - "LPRng lpc: do control operation", - "LPRng lpr: transfer a block format print job", - "LPRng lpc: secure command transfer", - "LPRng lpq: verbose status information" + static value_string *lpd_client_code[] = { + { 1, "LPC: start print / jobcmd: abort" }, + { 2, "LPR: transfer a printer job / jobcmd: receive control file" }, + { 3, "LPQ: print short form of queue status / jobcmd: receive data file" }, + { 4, "LPQ: print long form of queue status" }, + { 5, "LPRM: remove jobs" }, + { 6, "LPRng lpc: do control operation" }, + { 7, "LPRng lpr: transfer a block format print job" }, + { 8, "LPRng lpc: secure command transfer" }, + { 9, "LPRng lpq: verbose status information" }, + { 0, NULL } }; - static char *lpd_server_code[] = { - "Success: accepted, proceed", - "Queue not accepting jobs", - "Queue temporarily full, retry later", - "Bad job format, do not retry" + static value_string *lpd_server_code[] = { + { 0, "Success: accepted, proceed" }, + { 1, "Queue not accepting jobs" }, + { 2, "Queue temporarily full, retry later" }, + { 3, "Bad job format, do not retry" }, + { 0, NULL } }; if (check_col(pinfo->cinfo, COL_PROTOCOL)) @@ -95,7 +96,7 @@ dissect_lpd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (check_col(pinfo->cinfo, COL_INFO)) { if (lpr_packet_type == request) { - col_set_str(pinfo->cinfo, COL_INFO, lpd_client_code[code]); + col_set_str(pinfo->cinfo, COL_INFO, val_to_str(code, lpd_client_code, "Unknown client code: %u")); } else if (lpr_packet_type == response) { col_set_str(pinfo->cinfo, COL_INFO, "LPD response"); @@ -122,7 +123,7 @@ dissect_lpd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (code <= 9 && printer_len != -1) { proto_tree_add_text(lpd_tree, tvb, 0, 1, - lpd_client_code[code]); + val_to_str(code, lpd_client_code, "Unknown client code: %u")); proto_tree_add_text(lpd_tree, tvb, 1, printer_len, "Printer/options: %s", tvb_format_text(tvb, 1, printer_len)); @@ -134,7 +135,7 @@ dissect_lpd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else if (lpr_packet_type == response) { if (code <= 3) { proto_tree_add_text(lpd_tree, tvb, 0, 1, - "Response: %s", lpd_server_code[code]); + "Response: %s", val_to_str(code, lpd_server_code, "Unknown server code: %u")); } else { call_dissector(data_handle,tvb, pinfo, lpd_tree); diff --git a/epan/prefs.c b/epan/prefs.c index 9280ec54c0..1be85e2fa1 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -1028,7 +1028,7 @@ init_prefs() { prefs.gui_fileopen_preview = 3; prefs.gui_ask_unsaved = TRUE; prefs.gui_find_wrap = TRUE; - prefs.gui_webbrowser = g_strdup("mozilla %s"); + prefs.gui_webbrowser = g_strdup(HTML_VIEWER " %s"); prefs.gui_window_title = g_strdup(""); prefs.gui_layout_type = layout_type_5; prefs.gui_layout_content_1 = layout_pane_content_plist; -- cgit v1.2.1