aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-09-15 20:53:56 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-09-15 20:53:56 +0800
commit4bbfa274a455b4bf70bd0233c1b0c2bc288d1715 (patch)
tree102c13a2a7c9e5148ad0867f45b3e370a75e745d
parenta1f0a69b2a73927b829aea37a2eaa50d57a9f8b2 (diff)
Add a command to ask for the version number, generate a config file
-rw-r--r--configure.ac2
-rw-r--r--src/main.c17
2 files changed, 17 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index f6bc334..de760fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,6 +35,8 @@ AC_ARG_ENABLE([uniporte], [AS_HELP_STRING([--enable-uniporte], [Build with unipo
AC_SUBST(UNIPORTE, [-DNO_UNIPORTE])
])
+AM_CONFIG_HEADER(cellmgr_config.h)
+
AC_OUTPUT(
include/Makefile
include/mgcp/Makefile
diff --git a/src/main.c b/src/main.c
index 5d63ff4..25039b7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -53,6 +53,13 @@
#endif
#include <getopt.h>
+#undef PACKAGE_NAME
+#undef PACKAGE_VERSION
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_TARNAME
+#undef PACKAGE_STRING
+#include <cellmgr_config.h>
+
static struct log_target *stderr_target;
static int dpc = 1;
static int opc = 0;
@@ -67,7 +74,7 @@ static struct timer_list flood_timer;
static struct vty_app_info vty_info = {
.name = "Cellmgr-ng",
- .version = "0.0.1",
+ .version = VERSION,
.go_parent_cb = NULL,
};
@@ -748,6 +755,7 @@ static void print_help()
printf(" -p --pcap=FILE. Write MSUs to the PCAP file.\n");
printf(" -c --once. Send the SLTM msg only once.\n");
printf(" -f --flood. Send flood of paging requests to the BSC.\n");
+ printf(" -v --version. Print the version number\n");
}
static void handle_options(int argc, char **argv)
@@ -759,10 +767,11 @@ static void handle_options(int argc, char **argv)
{"config", 1, 0, 'c'},
{"pcap", 1, 0, 'p'},
{"flood", 0, 0, 'f'},
+ {"version", 0, 0, 0},
{0, 0, 0, 0},
};
- c = getopt_long(argc, argv, "hc:p:f",
+ c = getopt_long(argc, argv, "hc:p:fv",
long_options, &option_index);
if (c == -1)
break;
@@ -788,6 +797,10 @@ static void handle_options(int argc, char **argv)
case 'f':
flood = 1;
break;
+ case 'v':
+ printf("This is %s version %s.\n", PACKAGE, VERSION);
+ exit(0);
+ break;
default:
fprintf(stderr, "Unknown option.\n");
break;