1
0
Fork 0

simplify error handling

This commit is contained in:
Lukas Wurzinger 2021-03-02 18:25:50 +01:00
parent 8aa1920213
commit 77394a61dc
3 changed files with 100 additions and 104 deletions

View file

@ -116,14 +116,14 @@ main(int argc, char **argv)
}
);
struct readopt_answer answer = readopt_parse_all(&rp);
while (readopt_parse(&rp));
fputs("status: ", stderr);
readopt_put_status(answer.status, &(struct readopt_write_context){
fputs("error: ", stderr);
readopt_put_error(rp.error, &(struct readopt_write_context){
.dest.stream = stderr
});
fputc('\n', stderr);
if (answer.status != READOPT_STATUS_SUCCESS) {
if (rp.error != READOPT_ERROR_SUCCESS) {
return EXIT_FAILURE;
}