Skip to content

Commit 621a819

Browse files
committed
snis_multiverse: add --version flag
Signed-off-by: Stephen M. Cameron <[email protected]>
1 parent 1690404 commit 621a819

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

snis_multiverse.c

+12-2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ persisted in a simple database by snis_multiverse.
7777
#include "snis_asset_dir.h"
7878
#include "snis_bin_dir.h"
7979
#include "snis_licenses.h"
80+
#include "snis_version.h"
81+
#include "build_info.h"
8082

8183
static char *asset_dir;
8284
static char *lobby, *nick, *location;
@@ -1296,6 +1298,7 @@ static struct option long_options[] = {
12961298
{ "lobby", required_argument, NULL, 'l'},
12971299
{ "servernick", required_argument, NULL, 'n'},
12981300
{ "location", required_argument, NULL, 'L'},
1301+
{ "version", no_argument, NULL, 'v' },
12991302
{ 0, 0, 0, 0 },
13001303
};
13011304

@@ -1309,11 +1312,13 @@ static void parse_options(int argc, char *argv[], char **lobby, char **nick, cha
13091312

13101313
if ((argc < 4) &&
13111314
(argc != 2 || (strcmp(argv[1], "--acknowledgments") != 0 &&
1312-
strcmp(argv[1], "--acknowledgements") != 0)))
1315+
strcmp(argv[1], "--acknowledgements") != 0 &&
1316+
strcmp(argv[1], "--version") != 0 &&
1317+
strcmp(argv[1], "-v") != 0)))
13131318
usage();
13141319
while (1) {
13151320
int option_index;
1316-
c = getopt_long(argc, argv, "ae:L:l:n:", long_options, &option_index);
1321+
c = getopt_long(argc, argv, "ae:L:l:n:v", long_options, &option_index);
13171322
if (c == -1)
13181323
break;
13191324
switch (c) {
@@ -1339,6 +1344,11 @@ static void parse_options(int argc, char *argv[], char **lobby, char **nick, cha
13391344
case 'n':
13401345
*nick = optarg;
13411346
break;
1347+
case 'v':
1348+
printf("snis_multiverse ");
1349+
printf("%s\n", BUILD_INFO_STRING1);
1350+
printf("%s\n", BUILD_INFO_STRING2);
1351+
exit(0);
13421352
default:
13431353
usage(); /* no return */
13441354
break;

0 commit comments

Comments
 (0)