aboutsummaryrefslogtreecommitdiff
path: root/src/rc
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2013-09-01 17:36:37 -0500
committerWilliam Hubbs <w.d.hubbs@gmail.com>2013-09-03 19:05:13 -0500
commit445b297360b85c03b4509458f194a0d964c1d71a (patch)
tree8845eb4391b06df5792ebd8890960a094888eab1 /src/rc
parent2590bf7a2bc40e2fcd5cbe1f4f063d820c2c5438 (diff)
rc: add support for suppressing error messages
Add support for suppressing error messages with --quiet specified twice on the command line. X-Gentoo-Bug: 482396 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=482396
Diffstat (limited to 'src/rc')
-rw-r--r--src/rc/_usage.c15
-rw-r--r--src/rc/_usage.h4
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 \