Improve exitspecs (-E) parsing
Use the same implementation as linuxspi does, instead of the one suggested in #733
This commit is contained in:
parent
521155c1c2
commit
01ccab08b4
23
src/flip2.c
23
src/flip2.c
|
@ -506,17 +506,26 @@ int flip2_paged_write(const PROGRAMMER *pgm, const AVRPART *part, const AVRMEM *
|
||||||
return (result == 0) ? n_bytes : -1;
|
return (result == 0) ? n_bytes : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Parse the -E option flag
|
// Parse the -E option flag
|
||||||
int flip2_parseexitspecs(PROGRAMMER* pgm, const char *s) {
|
int flip2_parseexitspecs(PROGRAMMER *pgm, const char *sp) {
|
||||||
if (strcmp(s, "reset") == 0) {
|
char *cp, *s, *str = cfg_strdup("flip2_parseextitspecs()", sp);
|
||||||
pgm->exit_reset = EXIT_RESET_ENABLED;
|
|
||||||
} else if (strcmp(s, "noreset") == 0) {
|
s = str;
|
||||||
pgm->exit_reset = EXIT_RESET_DISABLED;
|
while ((cp = strtok(s, ","))) {
|
||||||
} else {
|
s = NULL;
|
||||||
|
if (!strcmp(cp, "reset")) {
|
||||||
|
pgm->exit_reset = EXIT_RESET_ENABLED;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!strcmp(cp, "noreset")) {
|
||||||
|
pgm->exit_reset = EXIT_RESET_DISABLED;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
free(str);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(str);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue