diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2014-01-29 03:40:37 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2014-01-30 04:12:00 +0100 |
commit | aabb7c3cddf5e97d1b1ebb3548664f1af85c1392 (patch) | |
tree | 6a63a4ee459fdb191d02d471232737a6285609ba /src | |
parent | 7ae25ac67fd4dd087791be55fa3c4997be7aac52 (diff) | |
download | pacman-aabb7c3cddf5e97d1b1ebb3548664f1af85c1392.tar.gz pacman-aabb7c3cddf5e97d1b1ebb3548664f1af85c1392.tar.xz |
pacman: use exit status 0 for --help and --version
The user requesting usage or version information is not an error.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/pacman/pacman.c | 4 | ||||
-rw-r--r-- | src/util/pacsort.c | 9 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 71443394..8c76987e 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -889,11 +889,11 @@ static int parseargs(int argc, char *argv[]) } if(config->help) { usage(config->op, mbasename(argv[0])); - return 2; + cleanup(0); } if(config->version) { version(); - return 2; + cleanup(0); } /* parse all other options */ diff --git a/src/util/pacsort.c b/src/util/pacsort.c index 948b03d3..2d53a1cc 100644 --- a/src/util/pacsort.c +++ b/src/util/pacsort.c @@ -45,6 +45,7 @@ static struct options_t { int sortkey; int null; int filemode; + int help; char delim; } opts; @@ -374,7 +375,8 @@ static int parse_options(int argc, char **argv) opts.filemode = 1; break; case 'h': - return 1; + opts.help = 1; + return 0; case 'k': opts.sortkey = (int)strtol(optarg, NULL, 10); if(opts.sortkey <= 0) { @@ -420,6 +422,11 @@ int main(int argc, char *argv[]) return 2; } + if(opts.help) { + usage(); + return 0; + } + list = list_new(100); buffer = buffer_new(BUFSIZ * 3); |