#include "arg-handler.hpp" #include "game-settings.hpp" #include #include void PkeArgs_Parse(int argc, char *argv[]) { while (1) { static struct option long_options[] = { {"level", required_argument, 0, 'l'}, {"plugin", required_argument, 0, 'p'}, {"project", required_argument, 0, 'r'}, {"scene", required_argument, 0, 's'}, {0, 0, 0, 0}, }; int optionIndex = 0; int c = getopt_long(argc, argv, "", long_options, &optionIndex); if (c == -1) { break; } switch (c) { case 0: break; case 'l': pkeSettings.args.levelName = optarg; break; case 'p': pkeSettings.args.pluginPath = optarg; break; case 'r': pkeSettings.args.projectPath = optarg; break; case 's': pkeSettings.args.sceneName = 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 }