On Sat, 16 Jul 2011 01:06:40 +0200 Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net wrote:
if (find_romentry(tempstr)) {
fprintf(stderr, "Error: image %s not found in "
"layout file or -i specified before "
"-l\n", tempstr);
cli_classic_abort_usage();
}
find_romentry does return the index of the (first matching) rom entry (>=0) on success, or -1 on failure:
int find_romentry(char *name) { int i;
if (!romimages) return -1;
msg_ginfo("Looking for "%s"... ", name);
for (i = 0; i < romimages; i++) { if (!strcmp(rom_entries[i].name, name)) { rom_entries[i].included = 1; msg_ginfo("found.\n"); return i; } } msg_ginfo("not found.\n"); // Not found. Error.
return -1; }
the attached patch fixes this. thanks to Florian Zumbiehl for reporting this (http://paste.flashrom.org/view.php?id=707).
carldani: you wrote you did not fix the -l/-i ordering problem "because the new layout code may have different requirements anyway". the first step to fix this is to extract the needed file and region names from the command line (to use them after the parsing loop has finished). this is somewhat independent from whatever we do with the arguments then. if you agree i would like to fix this now (i did not look for what is needed exactly yet), if not you can just ack the patch.