diff options
| author | Alexander Couzens | 2026-02-10 13:06:02 +0000 |
|---|---|---|
| committer | Alexander Couzens | 2026-03-12 22:32:29 +0000 |
| commit | b17c31f8a2fd5e788c2a9d3246d6ff1091902360 (patch) | |
| tree | c179fb660b117b5f6e92239ea6796eb856c692f7 | |
| parent | e086664e6a570630e8feba889482f174a9a8715e (diff) | |
| download | jsonpath-b17c31f8a2fd5e788c2a9d3246d6ff1091902360.tar.gz | |
main: exit 1 on getopt() errors
When getopt() encounter an invalid or unknown argument,
it prints an error. However jsonpath ignored those and continued
anyways.
getopt() will print the error message to stderr.
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
| -rw-r--r-- | main.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -533,6 +533,10 @@ int main(int argc, char **argv) case 'q': fclose(stderr); break; + case '?': + /* invalid or unknown. getopt() prints the error to stderr */ + rv = 1; + goto out; } } |