From c8ed6357974d97f440d6c0fe4b5842a0b9bb97d2 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 2 Feb 2021 18:41:03 +0000 Subject: [PATCH] Add version information Signed-off-by: Michael Tremer --- src/main.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 8dc9dcd..531f117 100644 --- a/src/main.c +++ b/src/main.c @@ -127,6 +127,7 @@ static int parse_argv(int argc, char* argv[], struct fireperf_config* conf) { {"port", required_argument, 0, 'p'}, {"server", no_argument, 0, 's'}, {"timeout", required_argument, 0, 't'}, + {"version", no_argument, 0, 'V'}, {"zero", no_argument, 0, 'z'}, {0, 0, 0, 0}, }; @@ -135,7 +136,7 @@ static int parse_argv(int argc, char* argv[], struct fireperf_config* conf) { int done = 0; while (!done) { - int c = getopt_long(argc, argv, "c:dkp:st:zP:", long_options, &option_index); + int c = getopt_long(argc, argv, "c:dkp:st:zP:V", long_options, &option_index); // End if (c == -1) @@ -158,6 +159,17 @@ static int parse_argv(int argc, char* argv[], struct fireperf_config* conf) { // getopt_long already printed the error message return 1; + case 'V': + printf("%s %s\n", PACKAGE_NAME, PACKAGE_VERSION); + printf("Copyright (C) 2021 The IPFire Project (https://www.ipfire.org/)\n"); + printf("License GPLv3+: GNU GPL version 3 or later \n"); + printf("This is free software: you are free to change and redistribute it\n"); + printf("There is NO WARRANTY, to the extent permitted by law.\n\n"); + printf("Written by Michael Tremer\n"); + + exit(0); + break; + case 'c': conf->mode = FIREPERF_MODE_CLIENT; -- 2.47.2