aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2006-10-19 18:43:12 +0000
committerGuy Harris <guy@alum.mit.edu>2006-10-19 18:43:12 +0000
commit00d8ca2d4567d0c0e9b837a065a786e9076ad893 (patch)
tree7a2417a3d23f01ebec8ab5f177e6cdc1bb527abe
parent85a34375499dd6e9dd90679ea9ffbbdd038ebcf9 (diff)
Fix up the changes to put the Portaudio information at the end of the
version string, so the information comes out right for applications that don't use Portaudio. Get rid of an extra "with" in the version string for dumpcap. Get rid of an extra blank after the libpcap version string, and get rid of an extra newline before it. Attempt to add more compiler version information and to prettify the MSVC++ version information (both untested). svn path=/trunk/; revision=19613
-rw-r--r--capture-pcap-util-unix.c1
-rw-r--r--capture-wpcap.c2
-rw-r--r--dumpcap.c3
-rw-r--r--gtk/main.c30
-rw-r--r--tshark.c2
-rw-r--r--version_info.c92
-rw-r--r--version_info.h8
7 files changed, 105 insertions, 33 deletions
diff --git a/capture-pcap-util-unix.c b/capture-pcap-util-unix.c
index 255c33fc15..bfb124c538 100644
--- a/capture-pcap-util-unix.c
+++ b/capture-pcap-util-unix.c
@@ -312,7 +312,6 @@ get_runtime_pcap_version(GString *str)
#else
g_string_append(str, "libpcap (version unknown)");
#endif
- g_string_append(str, " ");
}
#else /* HAVE_LIBPCAP */
diff --git a/capture-wpcap.c b/capture-wpcap.c
index 169ee2a957..dcbb1adef6 100644
--- a/capture-wpcap.c
+++ b/capture-wpcap.c
@@ -700,8 +700,6 @@ get_runtime_pcap_version(GString *str)
}
} else
g_string_append(str, "without WinPcap");
-
- /*g_string_append(str, " ");*/
}
#else /* HAVE_LIBPCAP */
diff --git a/dumpcap.c b/dumpcap.c
index a19db204b1..410353618c 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -270,8 +270,7 @@ main(int argc, char *argv[])
/* Assemble the compile-time version information string */
comp_info_str = g_string_new("Compiled ");
- g_string_append(comp_info_str, "with ");
- get_compiled_version_info(comp_info_str);
+ get_compiled_version_info(comp_info_str, NULL);
/* Assemble the run-time version information string */
runtime_info_str = g_string_new("Running ");
diff --git a/gtk/main.c b/gtk/main.c
index d6f3aabfd5..cc78a274f0 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -2002,6 +2002,21 @@ static void main_cf_callback(gint event, gpointer data, gpointer user_data _U_)
}
}
+static void
+portaudio_info(GString *str)
+{
+#ifdef HAVE_LIBPORTAUDIO
+#ifdef PORTAUDIO_API_1
+ g_string_append(str, "with PortAudio <= V18");
+#else /* PORTAUDIO_API_1 */
+ g_string_append(str, "with PortAudio ");
+ g_string_append(str, Pa_GetVersionText());
+#endif /* PORTAUDIO_API_1 */
+#else /* HAVE_LIBPORTAUDIO */
+ g_string_append(str, "without PortAudio");
+#endif /* HAVE_LIBPORTAUDIO */
+}
+
/* And now our feature presentation... [ fade to music ] */
int
main(int argc, char *argv[])
@@ -2105,20 +2120,7 @@ main(int argc, char *argv[])
#endif
g_string_append(comp_info_str, ", ");
- get_compiled_version_info(comp_info_str);
-
-#ifdef HAVE_LIBPORTAUDIO
- g_string_append(comp_info_str, " ");
-#ifdef PORTAUDIO_API_1
- g_string_append(comp_info_str, "with PortAudio <= V18");
-#else
- g_string_append(comp_info_str, "with PortAudio ");
- g_string_append(comp_info_str, Pa_GetVersionText());
-#endif
-#else
- g_string_append(comp_info_str, "without PortAudio");
-#endif /* HAVE_LIBPORTAUDIO */
- g_string_append(comp_info_str, ".");
+ get_compiled_version_info(comp_info_str, portaudio_info);
/* Assemble the run-time version information string */
runtime_info_str = g_string_new("Running ");
diff --git a/tshark.c b/tshark.c
index ad55fceae6..16973eebe8 100644
--- 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);
+ get_compiled_version_info(comp_info_str, NULL);
/* Assemble the run-time version information string */
runtime_info_str = g_string_new("Running ");
diff --git a/version_info.c b/version_info.c
index f0be768fef..750f066176 100644
--- a/version_info.c
+++ b/version_info.c
@@ -124,9 +124,14 @@ end_string(GString *str)
/*
* Get various library compile-time versions and append them to
* the specified GString.
+ *
+ * "additional_info" is called at the end to append any additional
+ * information; this is required in order to, for example, put the
+ * Portaudio information at the end of the string, as we currently
+ * don't use Portaudio in TShark.
*/
void
-get_compiled_version_info(GString *str)
+get_compiled_version_info(GString *str, void (*additional_info)(GString *))
{
gint break_point;
@@ -265,18 +270,27 @@ get_compiled_version_info(GString *str)
#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"
+ "\nNOTE: this build doesn't support the \"matches\" operator for Wireshark filter"
"\nsyntax.");
-#else
- g_string_append(str, ",");
-#endif /* HAVE_LIBPCRE */
do_word_wrap(str, break_point);
+#endif /* HAVE_LIBPCRE */
+ end_string(str);
}
/*
@@ -448,21 +462,75 @@ get_runtime_version_info(GString *str)
g_string_append(str, "an unknown OS");
#endif
- g_string_append(str, "\n");
+ g_string_append(str, " ");
get_runtime_pcap_version(str);
- g_string_append(str, ".");
+ g_string_append(str, ".");
/* Compiler info */
+ /*
+ * See http://predef.sourceforge.net/precomp.html for
+ * information on various defined strings.
+ *
+ * GCC's __VERSION__ is a nice text string for humans to
+ * read. The page at predef.sourceforge.net largely
+ * describes numeric #defines that encode the version;
+ * if the compiler doesn't also offer a nice printable
+ * string, we should probably prettify the number somehow.
+ */
#if defined(__GNUC__) && defined(__VERSION__)
g_string_sprintfa(str, "\nBuilt using gcc %s.\n", __VERSION__);
-#elif defined (_MSC_FULL_VER)
- /* Documented at http://predef.sourceforge.net/precomp.html */
- /* This should probably be prettified somehow */
- g_string_sprintfa(str, "\nBuilt using Microsoft Visual C++ %d\n",
- _MSC_FULL_VER);
+#elif defined(__HP_aCC)
+ g_string_sprintfa(str, "\nBuilt using HP aCC %d.\n", __HP_aCC);
+#elif defined(__xlC__)
+ g_string_sprintfa(str, "\nBuilt using IBM XL C %d.%d\n",
+ (__xlC__ >> 8) & 0xFF, __xlC__ & 0xFF);
+#ifdef __IBMC__
+ if ((__IBMC__ % 10) != 0)
+ g_string_sprintfa(str, " patch %d", __IBMC__ % 10);
+#endif /* IBMC */
+ g_string_sprintfa(str, "\n");
+#elif defined(__INTEL_COMPILER)
+ g_string_sprintfa(str, "\nBuilt using Intel C %d.%d",
+ __INTEL_COMPILER / 100, (__INTEL_COMPILER / 10) % 10);
+ if ((__INTEL_COMPILER % 10) != 0)
+ g_string_sprintfa(str, " patch %d", __INTEL_COMPILER % 10);
+#ifdef __INTEL_COMPILER_BUILD_DATE
+ g_string_sprinta(str, ", compiler built %04d-%02d-%02d",
+ __INTEL_COMPILER_BUILD_DATE / 10000,
+ (__INTEL_COMPILER_BUILD_DATE / 100) % 100,
+ __INTEL_COMPILER_BUILD_DATE % 100);
+#endif /* __INTEL_COMPILER_BUILD_DATE */
+ g_string_sprintfa(str, "\n");
+#elif defined(_MSC_FULL_VER)
+ if (_MSC_FULL_VER > 99999999) {
+ g_string_sprintfa(str, "\nBuilt using Microsoft Visual C++ %d.%d",
+ (_MSC_FULL_VER / 1000000000) - 7,
+ (_MSC_FULL_VER / 10000000) % 100);
+ if ((_MSC_FULL_VER % 100000) != 0
+ g_string_sprintfa(str, " patch %d",
+ _MSC_FULL_VER % 100000);
+ } else {
+ g_string_sprintfa(str, "\nBuilt using Microsoft Visual C++ %d.%d",
+ (_MSC_FULL_VER / 100000000) - 7,
+ (_MSC_FULL_VER / 1000000) % 100);
+ if ((_MSC_FULL_VER % 10000) != 0
+ g_string_sprintfa(str, " patch %d",
+ _MSC_FULL_VER % 10000);
+ }
+ g_string_sprintfa(str, "\n");
+#elif defined(_MSC_VER)
+ /* _MSC_FULL_VER not defined, but _MSC_VER defined */
+ g_string_sprintfa(str, "\nBuilt using Microsoft Visual C++ %d.%d\n",
+ (_MSC_VER / 100) - 7, _MSC_VER % 100);
+#elif defined(__SUNPRO_C)
+ g_string_sprintfa(str, "\nBuilt using Sun C %d.%d",
+ (__SUNPRO_C >> 8) & 0xF, (__SUNPRO_C >> 4) & 0xF);
+ if ((__SUNPRO_C & 0xF) != 0)
+ g_string_sprintfa(str, " patch %d", __SUNPRO_C & 0xF);
+ g_string_sprintfa(str, "\n");
#endif
end_string(str);
diff --git a/version_info.h b/version_info.h
index b7e15483c4..565ca44f0a 100644
--- a/version_info.h
+++ b/version_info.h
@@ -38,8 +38,14 @@ const gchar *svnversion;
/*
* Get various library compile-time versions and append them to
* the specified GString.
+ *
+ * "additional_info" is called at the end to append any additional
+ * information; this is required in order to, for example, put the
+ * Portaudio information at the end of the string, as we currently
+ * don't use Portaudio in TShark.
*/
-void get_compiled_version_info(GString *str);
+void get_compiled_version_info(GString *str,
+ void (*additional_info)(GString *));
/*
* Get various library run-time versions, and the OS version, and append