Merge branch 'master' of github.com:Themaister/SSNES into ssnes-consoles

This commit is contained in:
Themaister 2011-12-02 22:25:37 +01:00
commit c18dce4783
2 changed files with 9 additions and 7 deletions

View File

@ -148,16 +148,18 @@ int getopt_long(int argc, char *argv[],
// Non-POSIXy, but that's what getopt does by default. // Non-POSIXy, but that's what getopt does by default.
if ((short_index > 0) && ((short_index < long_index) || (long_index == -1))) if ((short_index > 0) && ((short_index < long_index) || (long_index == -1)))
{ {
char *tmp = argv[optind]; char *tmp[short_index];
argv[optind] = argv[optind + short_index]; memcpy(tmp, &argv[optind], sizeof(tmp));
argv[optind + short_index] = tmp; memmove(&argv[optind], &argv[optind + short_index], (argc - short_index) * sizeof(char*));
memcpy(&argv[argc - short_index], tmp, sizeof(tmp));
short_index = 0; short_index = 0;
} }
else if ((long_index > 0) && ((long_index < short_index) || (short_index == -1))) else if ((long_index > 0) && ((long_index < short_index) || (short_index == -1)))
{ {
char *tmp = argv[optind]; char *tmp[long_index];
argv[optind] = argv[optind + long_index]; memcpy(tmp, &argv[optind], sizeof(tmp));
argv[optind + long_index] = tmp; memmove(&argv[optind], &argv[optind + long_index], (argc - long_index) * sizeof(char*));
memcpy(&argv[argc - long_index], tmp, sizeof(tmp));
long_index = 0; long_index = 0;
} }

View File

@ -281,7 +281,7 @@ static void parse_config_file(void)
{ {
config_file_t *conf = NULL; config_file_t *conf = NULL;
if (strlen(g_extern.config_path) > 0) if (*g_extern.config_path)
{ {
conf = config_file_new(g_extern.config_path); conf = config_file_new(g_extern.config_path);
if (!conf) if (!conf)