aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/mgcp/mgcp_main.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-03-23 00:09:32 +0800
committerHarald Welte <laforge@gnumonks.org>2010-03-23 00:09:32 +0800
commit5a29c7fa895a14112a1ac65e541f4b87ae9dba04 (patch)
treeebe00528c9d0b992406de8c30ab2a3e99eccdd0a /openbsc/src/mgcp/mgcp_main.c
parent351ec2a1784fbdb2ce688f50a9134532f3bf0723 (diff)
automatically include program version and print it from vty and --version
Diffstat (limited to 'openbsc/src/mgcp/mgcp_main.c')
-rw-r--r--openbsc/src/mgcp/mgcp_main.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/openbsc/src/mgcp/mgcp_main.c b/openbsc/src/mgcp/mgcp_main.c
index cea0ba427..e45a1e981 100644
--- a/openbsc/src/mgcp/mgcp_main.c
+++ b/openbsc/src/mgcp/mgcp_main.c
@@ -40,6 +40,8 @@
#include <openbsc/mgcp.h>
#include <openbsc/telnet_interface.h>
+#include "../../bscconfig.h"
+
/* this is here for the vty... it will never be called */
void subscr_put() { abort(); }
@@ -51,6 +53,14 @@ void subscr_put() { abort(); }
static struct bsc_fd bfd;
static int first_request = 1;
static struct mgcp_config *cfg;
+const char *openbsc_version = "OpenBSC MGCP " PACKAGE_VERSION;
+const char *openbsc_copyright =
+ "Copyright (C) 2009-2010 Holger Freyther and On-Waves\n"
+ "Contributions by Daniel Willmann, Jan Lübbe,Stefan Schmidt\n"
+ "Dieter Spaar, Andreas Eversberg, Harald Welte\n\n"
+ "License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>\n"
+ "This is free software: you are free to change and redistribute it.\n"
+ "There is NO WARRANTY, to the extent permitted by law.\n";
static char *config_file = "mgcp.cfg";
@@ -64,6 +74,12 @@ static void print_help()
printf(" -c --config-file filename The config file to use.\n");
}
+static void print_version()
+{
+ printf("%s\n\n", openbsc_version);
+ printf(openbsc_copyright);
+}
+
static void handle_options(int argc, char** argv)
{
while (1) {
@@ -71,10 +87,11 @@ static void handle_options(int argc, char** argv)
static struct option long_options[] = {
{"help", 0, 0, 'h'},
{"config-file", 1, 0, 'c'},
+ {"version", 0, 0, 'V'},
{0, 0, 0, 0},
};
- c = getopt_long(argc, argv, "hc:", long_options, &option_index);
+ c = getopt_long(argc, argv, "hc:V", long_options, &option_index);
if (c == -1)
break;
@@ -87,6 +104,10 @@ static void handle_options(int argc, char** argv)
case 'c':
config_file = talloc_strdup(tall_bsc_ctx, optarg);
break;
+ case 'V':
+ print_version();
+ exit(0);
+ break;
default:
/* ignore */
break;