49 lines
1.2 KiB
Diff
49 lines
1.2 KiB
Diff
From 006fd942abd78d3128d427f1ede9786abe14c65f Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
|
|
Date: Thu, 12 Apr 2018 08:07:29 +0300
|
|
Subject: [PATCH] usage: Exit with status code 0 for --help
|
|
|
|
---
|
|
src/scrub.c | 10 ++++++----
|
|
1 file changed, 6 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/scrub.c b/src/scrub.c
|
|
index 0a325cb..fceb639 100644
|
|
--- a/src/scrub.c
|
|
+++ b/src/scrub.c
|
|
@@ -110,7 +110,7 @@ static struct option longopts[] = {
|
|
char *prog;
|
|
|
|
static void
|
|
-usage(void)
|
|
+usage(int rc)
|
|
{
|
|
fprintf(stderr,
|
|
"Usage: %s [OPTIONS] file [file...]\n"
|
|
@@ -132,7 +132,7 @@ usage(void)
|
|
|
|
fprintf(stderr, "Available patterns are:\n");
|
|
seq_list ();
|
|
- exit(1);
|
|
+ exit(rc);
|
|
}
|
|
|
|
int
|
|
@@ -225,12 +225,14 @@ main(int argc, char *argv[])
|
|
nopt = true;
|
|
break;
|
|
case 'h': /* --help */
|
|
+ usage(0);
|
|
+ break;
|
|
default:
|
|
- usage();
|
|
+ usage(1);
|
|
}
|
|
}
|
|
if (argc == optind)
|
|
- usage();
|
|
+ usage(1);
|
|
if (Xopt && argc - optind > 1) {
|
|
fprintf(stderr, "%s: -X only takes one directory name\n", prog);
|
|
exit(1);
|