From Martin Mathieson:
[obnox/wireshark/wip.git] / version_info.c
index 954b05379e02bb72b60be657b87c780e42873585..b9cfde4552945877a0ce6bf0daeb4134e71137af 100644 (file)
 # include "config.h"
 #endif
 
-#ifdef HAVE_LIBPCAP
-#include <pcap.h>
-#endif /* HAVE_LIBPCAP */
-
 #include <glib.h>
 
 #include <stdlib.h>
 #include <pcre.h>      /* to get the libpcre version number */
 #endif /* HAVE_LIBPCRE */
 
-/*
- * This has to come after the include of <pcap.h>, as the include of
- * <pcap.h> might cause <winsock2.h> to be included, and if we've
- * already included <winsock.h> as a result of including <windows.h>,
- * we get a bunch of redefinitions.
- */
-#ifdef HAVE_WINDOWS_H
-#include <windows.h>
-#endif
-
 #ifdef HAVE_SOME_SNMP
 
 #ifdef HAVE_NET_SNMP
 
 #include "svnversion.h"
 
+#ifdef HAVE_WINDOWS_H
+#include <windows.h>
+#endif
+
+#ifdef HAVE_LUA
+#include <lua.h>
+#endif
+
 #ifdef SVNVERSION
        const char *svnversion = " (" SVNVERSION ")";
 #else
        const char *svnversion = "";
 #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.
@@ -102,6 +95,19 @@ do_word_wrap(GString *str, gint point)
        }
 }      
 
+/*
+ * If the string doesn't end with a newline, append one.
+ */
+static void
+end_string(GString *str)
+{
+       size_t point;
+
+       point = strlen(str->str);
+       if (point == 0 || str->str[point - 1] != '\n')
+               g_string_append(str, "\n");
+}      
+
 /*
  * Get various library compile-time versions and append them to
  * the specified GString.
@@ -190,6 +196,16 @@ get_compiled_version_info(GString *str)
 #else
        g_string_append(str, "without ADNS");
 #endif /* HAVE_GNU_ADNS */
+       g_string_append(str, ",");
+
+       g_string_append(str, " ");
+       break_point = str->len - 1;
+#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);
@@ -201,6 +217,8 @@ get_compiled_version_info(GString *str)
                        "\nsyntax.");
        do_word_wrap(str, break_point);
 #endif /* HAVE_LIBPCRE */
+
+       end_string(str);
 }
 
 /*
@@ -373,4 +391,18 @@ get_runtime_version_info(GString *str)
        g_string_append(str, "an unknown OS");
 #endif
        g_string_append(str, ".");
+
+       end_string(str);
+}
+
+/*
+ * Get copyright information.
+ */
+const char *
+get_copyright_info(void)
+{
+       return
+"Copyright 1998-2006 Gerald Combs <gerald@ethereal.com> and contributors.\n"
+"This is free software; see the source for copying conditions. There is NO\n"
+"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
 }