diff options
author | Timo Teräs <timo.teras@iki.fi> | 2019-06-05 09:56:13 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2019-06-05 09:56:13 +0300 |
commit | 366d0ee371ac6fc00617324c122e058dc8e5bea3 (patch) | |
tree | 025e37a043e65ef06575a599f610e2079651124b /src/apk.c | |
parent | c3a93a4aa588f237690953fc74011c3bd00ed2ae (diff) | |
download | apk-tools-366d0ee371ac6fc00617324c122e058dc8e5bea3.tar.gz apk-tools-366d0ee371ac6fc00617324c122e058dc8e5bea3.tar.bz2 apk-tools-366d0ee371ac6fc00617324c122e058dc8e5bea3.tar.xz apk-tools-366d0ee371ac6fc00617324c122e058dc8e5bea3.zip |
print usage and exit with error on invalid arguments
Add also some testing to make sure help, long help and handling
of invalid arguments works as expected.
Based on pull request #19 originally by Laurent Arnoud (@spk).
Diffstat (limited to 'src/apk.c')
-rw-r--r-- | src/apk.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -588,11 +588,11 @@ int main(int argc, char **argv) help_requested = 1; break; } - if (r != -ENOTSUP) goto err_and_usage; + if (r != -ENOTSUP) goto err; } } - if (help_requested) { + if (help_requested || r == -ENOTSUP) { r = usage(applet); goto err; } @@ -686,12 +686,9 @@ int main(int argc, char **argv) r = 0; #endif -err_and_usage: - if (r == -EINVAL) - r = usage(applet); +err: if (r == -ESHUTDOWN) r = 0; -err: if (ctx) free(ctx); |