1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#include "arg-handler.hpp"
#include "game-settings.hpp"
#include <cstdio>
#include <getopt.h>
void PkeArgs_Parse(int argc, char *argv[]) {
while (1) {
static struct option long_options[] = {
{"plugin", required_argument, 0, 'p'},
{0, 0, 0, 0},
};
int optionIndex = 0;
int c = getopt_long(argc, argv, "p:", long_options, &optionIndex);
if (c == -1) {
break;
}
switch (c) {
case 0:
break;
case 'p':
pkeSettings.pluginPath = optarg;
break;
default:
fprintf(stderr, "Unused parameter: %c\n", c);
}
}
#ifndef NDEBUG
if (optind < argc) {
fprintf(stdout, "non-option args:\n");
while (optind < argc) {
fprintf(stdout, "%s ", argv[optind++]);
}
fprintf(stdout, "\n");
}
#endif
}
|