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
This commit is contained in:
William Hubbs 2013-09-01 17:36:37 -05:00
parent 2590bf7a2b
commit 445b297360
2 changed files with 17 additions and 2 deletions

View File

@ -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)
{

View File

@ -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 \