[PATCH] pactree: Improve command line validation
Sebastian Jakubiak
jakseb.dev at gmail.com
Fri Mar 6 02:10:37 UTC 2020
Exit with non-zero status when the command line specifies more
than one package or an unknown option.
Fixes FS#64589.
Signed-off-by: Sebastian Jakubiak <jakseb.dev at gmail.com>
---
If I may, I would like to use this occasion to suggest a feature: the
ability to process multiple packages by pactree. I am sending a patch
for that in reply to this email.
src/pactree.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/pactree.c b/src/pactree.c
index 5bc0032..9f074fe 100644
--- a/src/pactree.c
+++ b/src/pactree.c
@@ -346,7 +346,6 @@ static int parse_options(int argc, char *argv[])
version();
cleanup(0);
case 'h':
- case '?':
usage();
cleanup(0);
default:
@@ -355,7 +354,8 @@ static int parse_options(int argc, char *argv[])
}
}
- if(!argv[optind]) {
+ if(!argv[optind] || argv[optind + 1]) {
+ usage();
return 1;
}
--
2.25.0
More information about the pacman-contrib
mailing list