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.orglaforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-remsim/+/16479 ) Change subject: Add "--version" to all executables to print compile-time version info ...................................................................... Add "--version" to all executables to print compile-time version info Change-Id: I9ae504ff95beeefb9e90e02a576861351ea9e143 --- M src/bankd/bankd_main.c M src/server/remsim_server.c M src/simtrace2-remsim_client.c 3 files changed, 62 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/79/16479/1 diff --git a/src/bankd/bankd_main.c b/src/bankd/bankd_main.c index 530ecf2..6a1ac5f 100644 --- a/src/bankd/bankd_main.c +++ b/src/bankd/bankd_main.c @@ -236,6 +236,7 @@ { printf( " -h --help Print this help message\n" +" -V --version Print the version of the program\n" " -i --server-host A.B.C.D remsim-server IP address (default: 127.0.0.1)\n" " -p --server-port <1-65535> remsim-server TCP port (default: 9998)\n" " -b --bank-id <1-65535> Bank Identifier of this SIM bank (default: 1)\n" @@ -256,6 +257,7 @@ int option_index = 0, c; static const struct option long_options[] = { { "help", 0, 0, 'h' }, + { "version", 0, 0, 'V' }, { "server-host", 1, 0, 'i' }, { "server-port", 1, 0, 'p' }, { "bank-id", 1, 0, 'b' }, @@ -266,7 +268,7 @@ { 0, 0, 0, 0 } }; - c = getopt_long(argc, argv, "hi:o:b:n:N:I:P:", long_options, &option_index); + c = getopt_long(argc, argv, "hVi:o:b:n:N:I:P:", long_options, &option_index); if (c == -1) break; @@ -275,6 +277,10 @@ printf_help(); exit(0); break; + case 'V': + printf("osmo-remsim-bankd version %s\n", VERSION); + exit(0); + break; case 'i': g_bankd->srvc.server_host = optarg; break; diff --git a/src/server/remsim_server.c b/src/server/remsim_server.c index 70cbedc..9d3268f 100644 --- a/src/server/remsim_server.c +++ b/src/server/remsim_server.c @@ -1,6 +1,9 @@ #include <unistd.h> #include <signal.h> +#define _GNU_SOURCE +#include <getopt.h> + #include <sys/eventfd.h> #include <osmocom/core/utils.h> @@ -25,6 +28,49 @@ talloc_report_full(g_tall_ctx, stderr); } +static void print_help() +{ + printf( " Some useful help...\n" + " -h --help This text\n" + " -V --version Print version of the program\n" + ); +} + +static void handle_options(int argc, char **argv) +{ + while (1) { + int option_index = 0, c; + static struct option long_options[] = { + { "help", 0, 0, 'h' }, + { "version", 0, 0, 'V' }, + {0, 0, 0, 0} + }; + + c = getopt_long(argc, argv, "hV", long_options, &option_index); + if (c == -1) + break; + + switch (c) { + case 'h': + print_help(); + exit(0); + break; + case 'V': + printf("osmo-resmim-server version %s\n", VERSION); + exit(0); + break; + default: + /* ignore */ + break; + } + } + + if (argc > optind) { + fprintf(stderr, "Unsupported extra positional arguments in command line\n"); + exit(2); + } +} + int main(int argc, char **argv) { void *talloc_rest_ctx; @@ -37,6 +83,8 @@ osmo_init_logging2(g_tall_ctx, &log_info); + handle_options(argc, argv); + g_rps = rspro_server_create(g_tall_ctx, "0.0.0.0", 9998); if (!g_rps) exit(1); diff --git a/src/simtrace2-remsim_client.c b/src/simtrace2-remsim_client.c index e97ed9d..69d6a04 100644 --- a/src/simtrace2-remsim_client.c +++ b/src/simtrace2-remsim_client.c @@ -696,6 +696,7 @@ "\t-c\t--client-id <0-65535>\n" "\t-n\t--client-slot <0-65535>\n" "\t-h\t--help\n" + "\t-v\t--version\n" "\t-i\t--gsmtap-ip\tA.B.C.D\n" "\t-k\t--keep-running\n" "\t-V\t--usb-vendor\tVENDOR_ID\n" @@ -716,6 +717,7 @@ { "client-id", 1, 0, 'c' }, { "client-slot", 1, 0, 'n' }, { "help", 0, 0, 'h' }, + { "version", 0, 0, 'v' }, { "gsmtap-ip", 1, 0, 'i' }, { "keep-running", 0, 0, 'k' }, { "usb-vendor", 1, 0, 'V' }, @@ -751,7 +753,7 @@ while (1) { int option_index = 0; - c = getopt_long(argc, argv, "s:p:c:n:hi:kV:P:C:I:S:A:H:a:", opts, &option_index); + c = getopt_long(argc, argv, "s:p:c:n:hvi:kV:P:C:I:S:A:H:a:", opts, &option_index); if (c == -1) break; switch (c) { @@ -771,6 +773,10 @@ print_help(); exit(0); break; + case 'v': + printf("osmo-remsim-client version %s\n", VERSION); + exit(0); + break; case 'i': gsmtap_host = optarg; break; -- To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/16479 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-remsim Gerrit-Branch: master Gerrit-Change-Id: I9ae504ff95beeefb9e90e02a576861351ea9e143 Gerrit-Change-Number: 16479 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/20191204/82c63c38/attachment.htm>