Change in osmo-e1-recorder[master]: e1_recorder: Add --help and --version command line arguments

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Tue Dec 3 21:14:56 UTC 2019


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-recorder/+/16451 )


Change subject: e1_recorder: Add --help and --version command line arguments
......................................................................

e1_recorder: Add --help and --version command line arguments

Change-Id: Ie676466e5406243cf4205948cddd95426e2b8c10
---
M src/e1_recorder.c
1 file changed, 23 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-e1-recorder refs/changes/51/16451/1

diff --git a/src/e1_recorder.c b/src/e1_recorder.c
index 4887c3d..1afd40d 100644
--- a/src/e1_recorder.c
+++ b/src/e1_recorder.c
@@ -14,6 +14,8 @@
 #include "storage.h"
 #include "recorder.h"
 
+#include "config.h"
+
 static enum osmo_e1cap_capture_mode ts2cap_mode(struct e1inp_ts *ts)
 {
 	switch (ts->type) {
@@ -111,8 +113,8 @@
 
 struct vty_app_info vty_info = {
 	.name = "osmo-e1-recorder",
-	.version = "0",
-	.copyright = "(C) 2016 by Harald Welte <laforge at gnumonks.org>\n",
+	.version = PACKAGE_VERSION,
+	.copyright = "(C) 2016-2019 by Harald Welte <laforge at gnumonks.org>\n",
 };
 
 static void *rec_tall_ctx;
@@ -131,16 +133,26 @@
 	}
 }
 
+static void print_help(void)
+{
+	printf( "  -h --help		This help\n"
+		"  -V --version		Print version of the program\n"
+		"  -c --config FILE	Specify configuration file\n"
+		);
+}
+
 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' },
+			{ "help", 0, 0, 'h' },
+			{ "version", 0, 0, 'V' },
 			{ 0, 0, 0, 0 }
 		};
 
-		c = getopt_long(argc, argv, "c:",
+		c = getopt_long(argc, argv, "c:hV",
 				long_options, &option_index);
 		if (c == -1)
 			break;
@@ -149,6 +161,14 @@
 		case 'c':
 			g_config_file = optarg;
 			break;
+		case 'h':
+			print_help();
+			exit(0);
+			break;
+		case 'V':
+			print_version(1);
+			exit(0);
+			break;
 		}
 	}
 }

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-e1-recorder/+/16451
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-e1-recorder
Gerrit-Branch: master
Gerrit-Change-Id: Ie676466e5406243cf4205948cddd95426e2b8c10
Gerrit-Change-Number: 16451
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191203/3531bed3/attachment.htm>


More information about the gerrit-log mailing list