]> git.ipfire.org Git - fireperf.git/commitdiff
Add version information
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 2 Feb 2021 18:41:03 +0000 (18:41 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 2 Feb 2021 18:41:03 +0000 (18:41 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/main.c

index 8dc9dcd0dbbf676b27b4cf8c98dd5add1252de7f..531f117ed0e3d0ca431571d5667e8cf2cc97c818 100644 (file)
@@ -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 <https://gnu.org/licenses/gpl.html>\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;