From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-625034-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 204BB1381F3
	for <garchives@archives.gentoo.org>; Wed,  4 Sep 2013 00:46:46 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id A78AFE1564;
	Wed,  4 Sep 2013 00:46:45 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 4B077E1564
	for <gentoo-commits@lists.gentoo.org>; Wed,  4 Sep 2013 00:46:45 +0000 (UTC)
Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 6545C33E942
	for <gentoo-commits@lists.gentoo.org>; Wed,  4 Sep 2013 00:46:44 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by hornbill.gentoo.org (Postfix) with ESMTP id 19ABAE468F
	for <gentoo-commits@lists.gentoo.org>; Wed,  4 Sep 2013 00:46:43 +0000 (UTC)
From: "William Hubbs" <williamh@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" <williamh@gentoo.org>
Message-ID: <1378253113.445b297360b85c03b4509458f194a0d964c1d71a.WilliamH@OpenRC>
Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/
X-VCS-Repository: proj/openrc
X-VCS-Files: src/rc/_usage.c src/rc/_usage.h
X-VCS-Directories: src/rc/
X-VCS-Committer: WilliamH
X-VCS-Committer-Name: William Hubbs
X-VCS-Revision: 445b297360b85c03b4509458f194a0d964c1d71a
X-VCS-Branch: master
Date: Wed,  4 Sep 2013 00:46:43 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 0a8c5013-bbe3-42f8-8963-8fce6c05e881
X-Archives-Hash: 8b980e24f5765770af74ee23b397529e

commit:     445b297360b85c03b4509458f194a0d964c1d71a
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Sun Sep  1 22:36:37 2013 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Sep  4 00:05:13 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=445b2973

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

---
 src/rc/_usage.c | 15 +++++++++++++++
 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 96c2d1a..a95e93f 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 84b66b9..0560e89 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						      \