Improve th error message: add the failing option's name.

This commit is contained in:
Holger Vogt 2026-02-25 14:14:25 +01:00
parent cd568e37bc
commit b1f215149e
1 changed files with 9 additions and 5 deletions

View File

@ -67,10 +67,14 @@ INPdoOpts(
}
continue;
}
errmsg = TMALLOC(char, 100);
(void) strcpy(errmsg," Error: unknown option - ignored\n");
optCard->error = INPerrCat(optCard->error,errmsg);
fprintf(stderr, "%s\n", optCard->error);
/* print err message only if it is not just a number */
char* ctoken = token;
while (*ctoken && strchr("0123456789.e+-", *ctoken))
ctoken++;
if (*ctoken) {
errmsg = tprintf("Error: unknown option %s - ignored\n", token);
optCard->error = INPerrCat(optCard->error, errmsg);
fprintf(stderr, "%s\n", optCard->error);
}
}
}