|
12345678910111213141516171819202122232425262728293031 |
- #include "IZ_config.h"
-
- void IZ_ConfigGetDefaultPath(const char* config_path, size_t string_size) {
- //const char* config_path_dir = SDL_GetPrefPath("Modal Studios", IZ_APP_NAME);
- const char* config_path_dir = SDL_GetBasePath();
- memcpy_s(config_path, string_size, config_path_dir, 128);
- strcat_s(config_path, string_size, "config-server.ini");
- }
-
- const char* IZ_ConfigGetCommandlineOption(u8 argc, const char* argv[], const char* val) {
- size_t n = strlen(val);
- int c = argc;
-
- while (--c > 0) {
-
- if (!strncmp(argv[c], val, n)) {
- if (!*(argv[c] + n) && c < argc - 1) {
- /* coverity treats unchecked argv as "tainted" */
- if (!argv[c + 1] || strlen(argv[c + 1]) > 1024)
- return NULL;
- return argv[c + 1];
- }
-
- if (argv[c][n] == '=')
- return &argv[c][n + 1];
- return argv[c] + n;
- }
- }
-
- return NULL;
- }
|