Skip to content

Commit

Permalink
Merge pull request #41 from zevweiss/cli-errors
Browse files Browse the repository at this point in the history
Improve handling of command-line usage errors

Signed-off-by: Andrew Jeffery <[email protected]>
  • Loading branch information
amboar authored Nov 8, 2023
2 parents 882eda0 + 69f40c9 commit 5b60f09
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/cmd/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ int cmd_probe(const char *name, int argc, char *argv[])
}
break;
}
case '?':
rc = EXIT_FAILURE;
goto done;
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/cmd/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int cmd_write(const char *name __unused, int argc, char *argv[])
}

if (strcmp("firmware", argv[0])) {
loge("Unsupported write type '%s'", argv[0]);
loge("Unsupported write type '%s'\n", argv[0]);
return -EINVAL;
}

Expand All @@ -63,6 +63,8 @@ int cmd_write(const char *name __unused, int argc, char *argv[])
case 'l':
/* no-op flag retained for backwards compatibility */
break;
case '?':
exit(EXIT_FAILURE);
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/culvert.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ int main(int argc, char *argv[])
case 'q':
quiet = true;
break;
case '?':
exit(EXIT_FAILURE);
default:
continue;
}
Expand Down

0 comments on commit 5b60f09

Please sign in to comment.