aboutsummaryrefslogtreecommitdiffstats
path: root/src/e1_recorder.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/e1_recorder.c')
-rw-r--r--src/e1_recorder.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/e1_recorder.c b/src/e1_recorder.c
index 11ec93e..9110ccb 100644
--- a/src/e1_recorder.c
+++ b/src/e1_recorder.c
@@ -1,4 +1,5 @@
#include <signal.h>
+#include <getopt.h>
#include <osmocom/core/signal.h>
#include <osmocom/core/logging.h>
@@ -88,6 +89,7 @@ struct vty_app_info vty_info = {
static void *rec_tall_ctx;
struct e1_recorder g_recorder;
+static char *g_config_file = "osmo-e1-recorder.cfg";
static void signal_handler(int signo)
{
@@ -101,6 +103,28 @@ static void signal_handler(int signo)
}
}
+static void handle_options(int argc, char **argv)
+{
+ while (1) {
+ int option_index = 0, c;
+ static const struct option long_options[] = {
+ { "config-file", 1, 0, 'c' },
+ { 0, 0, 0, 0 }
+ };
+
+ c = getopt_long(argc, argv, "c:",
+ long_options, &option_index);
+ if (c == -1)
+ break;
+
+ switch (c) {
+ case 'c':
+ g_config_file = optarg;
+ break;
+ }
+ }
+}
+
int main(int argc, char **argv)
{
int rc;
@@ -118,7 +142,9 @@ int main(int argc, char **argv)
signal(SIGHUP, &signal_handler);
signal(SIGUSR1, &signal_handler);
- rc = vty_read_config_file("osmo-e1-recorder.cfg", NULL);
+ handle_options(argc, argv);
+
+ rc = vty_read_config_file(g_config_file, NULL);
if (rc < 0)
exit(1);