Change the version messages to put the "compiled with" stuff on a

separate line, and to put the "running with" info on a separate line
from that, to make the output narrower.

svn path=/trunk/; revision=7344
This commit is contained in:
Guy Harris 2003-03-12 00:07:46 +00:00
parent 50899dad38
commit ab84d8be6e
4 changed files with 55 additions and 32 deletions

View File

@ -1,6 +1,6 @@
/* main.c
*
* $Id: main.c,v 1.285 2003/03/08 07:00:48 guy Exp $
* $Id: main.c,v 1.286 2003/03/12 00:07:46 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -138,7 +138,7 @@ guint m_font_height, m_font_width;
PangoFontDescription *m_r_font, *m_b_font;
#endif
static guint main_ctx, file_ctx, help_ctx;
static GString *comp_info_str;
static GString *comp_info_str, *runtime_info_str;
gchar *ethereal_path = NULL;
gchar *last_open_dir = NULL;
gint root_x = G_MAXINT, root_y = G_MAXINT, top_width, top_height;
@ -172,13 +172,13 @@ about_ethereal( GtkWidget *w _U_, gpointer data _U_ ) {
simple_dialog(ESD_TYPE_INFO, NULL,
"Ethereal - Network Protocol Analyzer\n"
"Version " VERSION " (C) 1998-2002 Gerald Combs <gerald@ethereal.com>\n"
"Compiled %s\n\n"
"%s\n%s\n\n"
"Check the man page for complete documentation and\n"
"for the list of contributors.\n"
"\nSee http://www.ethereal.com/ for more information.",
comp_info_str->str);
comp_info_str->str, runtime_info_str->str);
}
#if GTK_MAJOR_VERSION < 2
@ -1174,8 +1174,8 @@ static void
print_usage(gboolean print_ver) {
if (print_ver) {
fprintf(stderr, "This is GNU " PACKAGE " " VERSION ", compiled %s\n",
comp_info_str->str);
fprintf(stderr, "This is GNU " PACKAGE " " VERSION "\n%s\n%s\n",
comp_info_str->str, runtime_info_str->str);
}
#ifdef HAVE_LIBPCAP
fprintf(stderr, "\n%s [ -vh ] [ -klpQS ] [ -a <capture autostop condition> ] ...\n",
@ -1204,7 +1204,8 @@ show_version(void)
create_console();
#endif
printf("%s %s, %s\n", PACKAGE, VERSION, comp_info_str->str);
printf("%s %s\n%s\n%s\n", PACKAGE, VERSION, comp_info_str->str,
runtime_info_str->str);
}
static int
@ -1577,9 +1578,8 @@ main(int argc, char *argv[])
init_cap_file(&cfile);
/* Assemble the compile-time options */
comp_info_str = g_string_new("");
/* Assemble the compile-time version information string */
comp_info_str = g_string_new("Compiled ");
g_string_append(comp_info_str, "with ");
g_string_sprintfa(comp_info_str,
#ifdef GTK_MAJOR_VERSION
@ -1590,7 +1590,11 @@ main(int argc, char *argv[])
#endif
g_string_append(comp_info_str, ", ");
get_version_info(comp_info_str);
get_compiled_version_info(comp_info_str);
/* Assemble the run-time version information string */
runtime_info_str = g_string_new("Running ");
get_runtime_version_info(runtime_info_str);
/* Now get our args */
while ((opt = getopt(argc, argv, optstring)) != -1) {

View File

@ -1,6 +1,6 @@
/* tethereal.c
*
* $Id: tethereal.c,v 1.177 2003/03/08 07:00:46 guy Exp $
* $Id: tethereal.c,v 1.178 2003/03/12 00:07:32 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -104,7 +104,7 @@
static guint32 firstsec, firstusec;
static guint32 prevsec, prevusec;
static GString *comp_info_str;
static GString *comp_info_str, *runtime_info_str;
static gboolean quiet;
static gboolean decode;
static gboolean verbose;
@ -214,8 +214,8 @@ print_usage(gboolean print_ver)
int i;
if (print_ver) {
fprintf(stderr, "This is GNU t%s %s, compiled %s\n", PACKAGE, VERSION,
comp_info_str->str);
fprintf(stderr, "This is GNU t%s %s\n%s\n%s\n", PACKAGE, VERSION,
comp_info_str->str, runtime_info_str->str);
}
#ifdef HAVE_LIBPCAP
fprintf(stderr, "\nt%s [ -DvVhqSlp ] [ -a <capture autostop condition> ] ...\n",
@ -433,10 +433,13 @@ main(int argc, char *argv[])
init_cap_file(&cfile);
/* Assemble the compile-time options */
comp_info_str = g_string_new("");
/* Assemble the compile-time version information string */
comp_info_str = g_string_new("Compiled ");
get_compiled_version_info(comp_info_str);
get_version_info(comp_info_str);
/* Assemble the run-time version information string */
runtime_info_str = g_string_new("Running ");
get_runtime_version_info(runtime_info_str);
/* Now get our args */
while ((opt = getopt(argc, argv, "a:b:c:Df:F:hi:lnN:o:pqr:R:s:St:vw:Vxz:")) != -1) {
@ -618,7 +621,8 @@ main(int argc, char *argv[])
}
break;
case 'v': /* Show version and exit */
printf("t%s %s, %s\n", PACKAGE, VERSION, comp_info_str->str);
printf("t%s %s\n%s\n%s\n", PACKAGE, VERSION, comp_info_str->str,
runtime_info_str->str);
exit(0);
break;
case 'w': /* Write to capture file xxx */

29
util.c
View File

@ -1,7 +1,7 @@
/* util.c
* Utility routines
*
* $Id: util.c,v 1.59 2003/03/08 11:15:49 guy Exp $
* $Id: util.c,v 1.60 2003/03/12 00:07:32 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -81,22 +81,17 @@ typedef int mode_t; /* for win32 */
#include "util.h"
/*
* Get various library version and the OS version and append them to
* Get various library compile-time versions and append them to
* the specified GString.
*/
void
get_version_info(GString *str)
get_compiled_version_info(GString *str)
{
#ifdef HAVE_LIBPCAP
#ifdef HAVE_PCAP_VERSION
extern char pcap_version[];
#endif /* HAVE_PCAP_VERSION */
#endif /* HAVE_LIBPCAP */
#if defined(WIN32)
OSVERSIONINFO info;
#elif defined(HAVE_SYS_UTSNAME_H)
struct utsname name;
#endif
g_string_append(str, "with ");
g_string_sprintfa(str,
@ -146,8 +141,22 @@ get_version_info(GString *str)
#else /* no SNMP library */
g_string_append(str, ", without UCD-SNMP or Net-SNMP");
#endif /* HAVE_SOME_SNMP */
}
g_string_append(str, ", running on ");
/*
* Get various library run-time versions, and the OS version, and append
* them to the specified GString.
*/
void
get_runtime_version_info(GString *str)
{
#if defined(WIN32)
OSVERSIONINFO info;
#elif defined(HAVE_SYS_UTSNAME_H)
struct utsname name;
#endif
g_string_append(str, "on ");
#if defined(WIN32)
info.dwOSVersionInfoSize = sizeof info;
if (!GetVersionEx(&info)) {
@ -278,7 +287,7 @@ get_version_info(GString *str)
g_string_sprintfa(str, "%s %s", name.sysname, name.release);
}
#else
g_string_append("an unknown OS");
g_string_append(str, "an unknown OS");
#endif
}

12
util.h
View File

@ -1,7 +1,7 @@
/* util.h
* Utility definitions
*
* $Id: util.h,v 1.27 2003/03/08 07:00:46 guy Exp $
* $Id: util.h,v 1.28 2003/03/12 00:07:32 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -30,10 +30,16 @@ extern "C" {
#endif /* __cplusplus */
/*
* Get various library version and the OS version and append them to
* Get various library compile-time versions and append them to
* the specified GString.
*/
void get_version_info(GString *str);
void get_compiled_version_info(GString *str);
/*
* Get various library run-time versions, and the OS version, and append
* them to the specified GString.
*/
void get_runtime_version_info(GString *str);
int create_tempfile(char *, int, const char *);