diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-06-21 18:02:27 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-06-22 01:06:25 +0000 |
commit | c46329c27b8c31729d2d51dc4f69da9b3923de04 (patch) | |
tree | 196522550c36225b4248bc8c6ed2fb86d5b0ddab /wsutil | |
parent | a70dea195625f32a026d10d937345d177f81aead (diff) | |
download | wireshark-c46329c27b8c31729d2d51dc4f69da9b3923de04.tar.gz wireshark-c46329c27b8c31729d2d51dc4f69da9b3923de04.tar.bz2 wireshark-c46329c27b8c31729d2d51dc4f69da9b3923de04.zip |
Add a routine to return a version string including VCS information.
Add a routine get_ws_vcs_version_info() that, for builds from a tree
checked out from Wireshark's version control system, returns a string
that includes both the Wireshark version number and an indication of
what particular VCS version was checked out, and just returns
Wireshark's version number for other builds.
Use that routine rather than manually gluing VERSION and the Git version
number together.
("vcs", not "git", just in case we do something bizarre or mercurial
some day. :-))
Change-Id: Ie5c6dc83b9d3f56655eaef30fec3ec9916b6320d
Reviewed-on: https://code.wireshark.org/review/2529
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/CMakeLists.txt | 1 | ||||
-rw-r--r-- | wsutil/Makefile.common | 7 | ||||
-rw-r--r-- | wsutil/ws_version_info.c | 44 | ||||
-rw-r--r-- | wsutil/ws_version_info.h | 44 |
4 files changed, 93 insertions, 3 deletions
diff --git a/wsutil/CMakeLists.txt b/wsutil/CMakeLists.txt index f392972a59..2c80a56c17 100644 --- a/wsutil/CMakeLists.txt +++ b/wsutil/CMakeLists.txt @@ -83,6 +83,7 @@ set(WSUTIL_FILES unicode-utils.c ws_mempbrk.c ws_mempbrk_sse42.c + ws_version_info.c nghttp2/nghttp2_buf.c nghttp2/nghttp2_hd.c nghttp2/nghttp2_hd_huffman.c diff --git a/wsutil/Makefile.common b/wsutil/Makefile.common index 0d5232bd0b..4bb8dea86b 100644 --- a/wsutil/Makefile.common +++ b/wsutil/Makefile.common @@ -69,7 +69,8 @@ LIBWSUTIL_SRC = \ type_util.c \ ws_mempbrk.c \ u3.c \ - unicode-utils.c + unicode-utils.c \ + ws_version_info.c # Header files that are not generated from other files LIBWSUTIL_INCLUDES = \ @@ -119,8 +120,8 @@ LIBWSUTIL_INCLUDES = \ u3.h \ unicode-utils.h \ ws_cpuid.h \ - ws_mempbrk.h - + ws_mempbrk.h \ + ws_version_info.h # # Editor modelines - http://www.wireshark.org/tools/modelines.html diff --git a/wsutil/ws_version_info.c b/wsutil/ws_version_info.c new file mode 100644 index 0000000000..c9a680eb83 --- /dev/null +++ b/wsutil/ws_version_info.c @@ -0,0 +1,44 @@ +/* ws_version_info.c + * Routines to report version information for Wireshark programs + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" + +#include <glib.h> + +#include "version.h" + +#include <wsutil/ws_version_info.h> + +/* + * Return a version number string for Wireshark, including, for builds + * from a tree checked out from Wireshark's version control system, + * something identifying what version was checked out. + */ +const char * +get_ws_vcs_version_info(void) +{ +#ifdef GITVERSION + return VERSION " (" GITVERSION " from " GITBRANCH ")"; +#else + return VERSION; +#endif +} diff --git a/wsutil/ws_version_info.h b/wsutil/ws_version_info.h new file mode 100644 index 0000000000..e9e718e10e --- /dev/null +++ b/wsutil/ws_version_info.h @@ -0,0 +1,44 @@ +/* ws_version_info.h + * Declarations of routines to report version information for Wireshark + * programs + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __WSUTIL_WS_VERSION_INFO_H__ +#define __WSUTIL_WS_VERSION_INFO_H__ + +#include "ws_symbol_export.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * Return a version number string for Wireshark, including, for builds + * from a tree checked out from Wireshark's version control system, + * something identifying what version was checked out. + */ +WS_DLL_PUBLIC const char *get_ws_vcs_version_info(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __WSUTIL_WS_VERSION_INFO_H__ */ |