Clean up the word wrap stuff a bit. (Arguably, that should be done in
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 19 Oct 2006 21:17:23 +0000 (21:17 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 19 Oct 2006 21:17:23 +0000 (21:17 +0000)
the code that displays it - we might, for example, be able to have the
About dialog word-wrap to the appropriate size, and word-wrap text
printed to the standard output to the terminal width if it's going to a
terminal and to 80 or whatever columns otherwise.)

Don't report anything in dumpcap about libraries not used by dumpcap.
(It was printing a blank, which looked a bit weird.)

Fix the handling of _MSC_VER as per Gerald's fix for _MSC_FULL_VER.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@19618 f5534014-38df-0310-8fa8-9805f1628bb7

gtk/main.c
tshark.c
version_info.c
version_info.h

index cc78a274f0feac0bb7cd56ebdd49de9a870e9ca0..7ddf4baa8d3ff6e8df5008e32a79d1123cef25ba 100644 (file)
@@ -2003,9 +2003,12 @@ static void main_cf_callback(gint event, gpointer data, gpointer user_data _U_)
 }
 
 static void
-portaudio_info(GString *str)
+get_epan_and_portaudio_version_info(GString *str)
 {
+  get_epan_compiled_version_info(str);
+
 #ifdef HAVE_LIBPORTAUDIO
+  g_string_append(str, ", ");
 #ifdef PORTAUDIO_API_1
   g_string_append(str, "with PortAudio <= V18");
 #else /* PORTAUDIO_API_1 */
@@ -2120,7 +2123,7 @@ main(int argc, char *argv[])
 #endif
   g_string_append(comp_info_str, ", ");
 
-  get_compiled_version_info(comp_info_str, portaudio_info);
+  get_compiled_version_info(comp_info_str, get_epan_and_portaudio_version_info);
 
   /* Assemble the run-time version information string */
   runtime_info_str = g_string_new("Running ");
index 16973eebe8ca61ff6746fa08e6f281e83f45e0b8..c877b119b969401607eb0a39780865ed188dd5ea 100644 (file)
--- a/tshark.c
+++ b/tshark.c
@@ -882,7 +882,7 @@ main(int argc, char *argv[])
 
   /* Assemble the compile-time version information string */
   comp_info_str = g_string_new("Compiled ");
-  get_compiled_version_info(comp_info_str, NULL);
+  get_compiled_version_info(comp_info_str, get_epan_compiled_version_info);
 
   /* Assemble the run-time version information string */
   runtime_info_str = g_string_new("Running ");
index 71ab85e53eca37d4ca869613308cd37c273b61e6..d16a588914ba9adf1e363bf6b5978b2262cd6a92 100644 (file)
 #endif
 
 /*
- * See whether the last line in the string goes past column 80; if so,
- * replace the blank at the specified point with a newline.
+ * Add a word wrap break point, and return its index.
+ */
+static gint
+add_word_wrap_break_point(GString *str)
+{
+       g_string_append(str, " ");
+       return str->len - 1;
+}
+
+/*
+ * Add punctuation at the end of a phrase, and see whether the last line in
+ * the string goes past column 80; if so, replace the blank at the specified
+ * point with a newline.
  */
 static void
-do_word_wrap(GString *str, gint point)
+end_item_and_break(GString *str, char *punct, gint point)
 {
        char *line_begin;
 
+       g_string_append(str, punct);
        line_begin = strrchr(str->str, '\n');
        if (line_begin == NULL)
                line_begin = str->str;
@@ -145,15 +157,12 @@ get_compiled_version_info(GString *str, void (*additional_info)(GString *))
            "GLib (version unknown),");
 #endif
 
-       g_string_append(str, " ");
-       break_point = str->len - 1;
+       break_point = add_word_wrap_break_point(str);
        get_compiled_pcap_version(str);
-       g_string_append(str, ",");
-       do_word_wrap(str, break_point);
+       end_item_and_break(str, ",", break_point);
 
         /* LIBZ */
-       g_string_append(str, " ");
-       break_point = str->len - 1;
+       break_point = add_word_wrap_break_point(str);
 #ifdef HAVE_LIBZ
        g_string_append(str, "with libz ");
 #ifdef ZLIB_VERSION
@@ -164,11 +173,35 @@ get_compiled_version_info(GString *str, void (*additional_info)(GString *))
 #else /* HAVE_LIBZ */
        g_string_append(str, "without libz");
 #endif /* HAVE_LIBZ */
-       g_string_append(str, ",");
-       do_word_wrap(str, break_point);
+
+       /* Additional application-dependent information */
+       if (additional_info) {
+               end_item_and_break(str, ",", break_point);
+               break_point = add_word_wrap_break_point(str);
+               (*additional_info)(str);
+       }
+       end_item_and_break(str, ".", break_point);
+
+#ifndef HAVE_LIBPCRE
+       break_point = str->len - 1;
+       g_string_append(str,
+       "\nNOTE: this build doesn't support the \"matches\" operator for Wireshark filter syntax");
+       end_item_and_break(str, ".", break_point);
+#endif /* HAVE_LIBPCRE */
+
+       end_string(str);
+}
+
+/*
+ * Get compile-time information used only by applications that use
+ * libethereal.
+ */
+void
+get_epan_compiled_version_info(GString *str)
+{
+       gint break_point;
 
         /* PCRE */
-       g_string_append(str, " ");
        break_point = str->len - 1;
 #ifdef HAVE_LIBPCRE
        g_string_append(str, "with libpcre ");
@@ -185,14 +218,12 @@ get_compiled_version_info(GString *str, void (*additional_info)(GString *))
        g_string_append(str, "without libpcre");
 #endif /* HAVE_LIBPCRE */
 
-       g_string_append(str, ",");
-       do_word_wrap(str, break_point);
+       end_item_and_break(str, ",", break_point);
 
         /* SNMP */
 /* Oh, this is pretty. */
 /* Oh, ha.  you think that was pretty.  Try this:! --Wes */
-       g_string_append(str, " ");
-       break_point = str->len - 1;
+       break_point = add_word_wrap_break_point(str);
 #ifdef HAVE_SOME_SNMP
 
 #ifdef HAVE_UCD_SNMP
@@ -208,58 +239,48 @@ get_compiled_version_info(GString *str, void (*additional_info)(GString *))
 #else /* no SNMP library */
        g_string_append(str, "without UCD-SNMP or Net-SNMP");
 #endif /* HAVE_SOME_SNMP */
-       g_string_append(str, ",");
-       do_word_wrap(str, break_point);
+       end_item_and_break(str, ",", break_point);
 
         /* ADNS */
-       g_string_append(str, " ");
-       break_point = str->len - 1;
+       break_point = add_word_wrap_break_point(str);
 #ifdef HAVE_GNU_ADNS
        g_string_append(str, "with ADNS");
 #else
        g_string_append(str, "without ADNS");
 #endif /* HAVE_GNU_ADNS */
-       g_string_append(str, ",");
-       do_word_wrap(str, break_point);
+       end_item_and_break(str, ",", break_point);
 
         /* LUA */
-       g_string_append(str, " ");
-       break_point = str->len - 1;
+       break_point = add_word_wrap_break_point(str);
 #ifdef HAVE_LUA
        g_string_append(str, "with ");
        g_string_append(str, LUA_VERSION);
 #else
        g_string_append(str, "without Lua");
 #endif /* HAVE_LUA */
-       g_string_append(str, ",");
-       do_word_wrap(str, break_point);
+       end_item_and_break(str, ",", break_point);
 
         /* GnuTLS */
-       g_string_append(str, " ");
-       break_point = str->len - 1;
+       break_point = add_word_wrap_break_point(str);
 #ifdef HAVE_LIBGNUTLS
        g_string_append(str, "with GnuTLS " LIBGNUTLS_VERSION);
 #else
        g_string_append(str, "without GnuTLS");
 #endif /* HAVE_LIBGNUTLS */
-       g_string_append(str, ",");
-       do_word_wrap(str, break_point);
+       end_item_and_break(str, ",", break_point);
 
         /* Gcrypt */
-       g_string_append(str, " ");
-       break_point = str->len - 1;
+       break_point = add_word_wrap_break_point(str);
 #ifdef HAVE_LIBGCRYPT
        g_string_append(str, "with Gcrypt " GCRYPT_VERSION);
 #else
        g_string_append(str, "without Gcrypt");
 #endif /* HAVE_LIBGCRYPT */
-       g_string_append(str, ",");
-       do_word_wrap(str, break_point);
+       end_item_and_break(str, ",", break_point);
 
         /* Kerberos */
         /* XXX - I don't see how to get the version number, at least for KfW */
-       g_string_append(str, " ");
-       break_point = str->len - 1;
+       break_point = add_word_wrap_break_point(str);
 #ifdef HAVE_KERBEROS
 #ifdef HAVE_MIT_KERBEROS
        g_string_append(str, "with MIT Kerberos");
@@ -270,27 +291,6 @@ get_compiled_version_info(GString *str, void (*additional_info)(GString *))
 #else
        g_string_append(str, "without Kerberos");
 #endif /* HAVE_KERBEROS */
-
-       /* Additional application-dependent information */
-       if (additional_info) {
-               g_string_append(str, ",");
-               do_word_wrap(str, break_point);
-               g_string_append(str, " ");
-               break_point = str->len - 1;
-               (*additional_info)(str);
-       }
-       g_string_append(str, ".");
-       do_word_wrap(str, break_point);
-
-#ifndef HAVE_LIBPCRE
-       break_point = str->len - 1;
-       g_string_append(str,
-                       "\nNOTE: this build doesn't support the \"matches\" operator for Wireshark filter"
-                       "\nsyntax.");
-       do_word_wrap(str, break_point);
-#endif /* HAVE_LIBPCRE */
-
-       end_string(str);
 }
 
 /*
@@ -524,7 +524,7 @@ get_runtime_version_info(GString *str)
 #elif defined(_MSC_VER)
        /* _MSC_FULL_VER not defined, but _MSC_VER defined */
        g_string_sprintfa(str, "\n\nBuilt using Microsoft Visual C++ %d.%d\n",
-           (_MSC_VER / 100) - 7, _MSC_VER % 100);
+           (_MSC_VER / 100) - 6, _MSC_VER % 100);
 #elif defined(__SUNPRO_C)
        g_string_sprintfa(str, "\n\nBuilt using Sun C %d.%d",
            (__SUNPRO_C >> 8) & 0xF, (__SUNPRO_C >> 4) & 0xF);
index 565ca44f0a765805662e47de71fe3c288a73973d..7203eac27ed8e77e527da861230f14c4b0c3e13b 100644 (file)
@@ -47,6 +47,12 @@ const gchar *svnversion;
 void get_compiled_version_info(GString *str,
     void (*additional_info)(GString *));
 
+/*
+ * Get compile-time information used only by applications that use
+ * libethereal.
+ */
+void get_epan_compiled_version_info(GString *str);
+
 /*
  * Get various library run-time versions, and the OS version, and append
  * them to the specified GString.