diff options
-rw-r--r-- | src/rc/_usage.c | 15 | ||||
-rw-r--r-- | src/rc/_usage.h | 4 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/rc/_usage.c b/src/rc/_usage.c index 96c2d1a1..a95e93f5 100644 --- a/src/rc/_usage.c +++ b/src/rc/_usage.c @@ -35,6 +35,21 @@ # define _noreturn #endif +static void set_quiet_options(void) +{ + static int qcount = 0; + + qcount ++; + switch (qcount) { + case 1: + setenv ("EINFO_QUIET", "YES", 1); + break; + case 2: + setenv ("EERROR_QUIET", "YES", 1); + break; + } +} + _noreturn static void show_version(void) { diff --git a/src/rc/_usage.h b/src/rc/_usage.h index 84b66b96..0560e89f 100644 --- a/src/rc/_usage.h +++ b/src/rc/_usage.h @@ -38,13 +38,13 @@ "Disable color output", \ "Display software version", \ "Run verbosely", \ - "Run quietly" + "Run quietly (repeat to suppress errors)" #define case_RC_COMMON_getopt_case_C setenv ("EINFO_COLOR", "NO", 1); #define case_RC_COMMON_getopt_case_h usage (EXIT_SUCCESS); #define case_RC_COMMON_getopt_case_V if (argc == 2) show_version(); #define case_RC_COMMON_getopt_case_v setenv ("EINFO_VERBOSE", "YES", 1); -#define case_RC_COMMON_getopt_case_q setenv ("EINFO_QUIET", "YES", 1); +#define case_RC_COMMON_getopt_case_q set_quiet_options(); #define case_RC_COMMON_getopt_default usage (EXIT_FAILURE); #define case_RC_COMMON_GETOPT \ |