[makerom] Fix parsing of -content option

This commit is contained in:
Timothy Redaelli
2016-04-13 18:57:45 +02:00
parent 02159e17ee
commit 65e6974494
+9 -1
View File
@@ -614,7 +614,15 @@ int SetArgument(int argc, int i, char *argv[], user_settings *set)
PrintArgReqParam(argv[i], 1); PrintArgReqParam(argv[i], 1);
return USR_ARG_REQ_PARAM; return USR_ARG_REQ_PARAM;
} }
char *pos = strstr(argv[i + 1], ":"); int count = 0;
char *pos = argv[i + 1];
while ((pos = strstr(pos + 1, ":")))
count++;
pos = argv[i + 1];
while (count-- > 1)
pos = strstr(pos + 1, ":");
if (!pos || strlen(pos) < 2) { if (!pos || strlen(pos) < 2) {
fprintf(stderr, "[SETTING ERROR] Bad argument '%s %s', correct format:\n", argv[i], argv[i + 1]); fprintf(stderr, "[SETTING ERROR] Bad argument '%s %s', correct format:\n", argv[i], argv[i + 1]);
fprintf(stderr, " %s <CONTENT PATH>:<INDEX>\n", argv[i]); fprintf(stderr, " %s <CONTENT PATH>:<INDEX>\n", argv[i]);