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
Wed Dec 4 11:22:07 UTC 2019


laforge has submitted this change. ( 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(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/e1_recorder.c b/src/e1_recorder.c
index 07fd4a6..d77c0ff 100644
--- a/src/e1_recorder.c
+++ b/src/e1_recorder.c
@@ -15,6 +15,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) {
@@ -84,8 +86,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;
@@ -104,16 +106,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;
@@ -122,6 +134,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: 3
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191204/c2509a2e/attachment.htm>


More information about the gerrit-log mailing list