From patchwork Fri Jul 23 04:23:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 13105 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 73E34C322B for ; Fri, 23 Jul 2021 04:24:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E4D26687A6; Fri, 23 Jul 2021 06:23:59 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="C6WIEwKV"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3898F687A6 for ; Fri, 23 Jul 2021 06:23:58 +0200 (CEST) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C31FD255 for ; Fri, 23 Jul 2021 06:23:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1627014237; bh=RWDsT67eaptEDPfQx4cO+5u+fnwxsmMawAlPNAY/7e0=; h=From:To:Subject:Date:From; b=C6WIEwKVmY3OCvixovfVAEAO/cWwz9gUbYLYC+Vb/Dei6BS1rbMDl8QzExf6HZW1w aNLqf0x8dY5sMH/LoL6kmJ+EsmbeBMc0GFgDQvfu1oAyCE0nUuBCDlWBdtdFb8/f2a agmJJxbEDT/PHuGIaV3069Ppxank0MsLcMPut03U= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 23 Jul 2021 07:23:53 +0300 Message-Id: <20210723042353.6616-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] cam: options: Restore std::cerr adjustement field X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The std::cerr adjustment is set to std::left to print the usage text. Restore it to its original value when done, to avoid affecting the caller. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- src/cam/options.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cam/options.cpp b/src/cam/options.cpp index 33bc512e6571..4f7e869144c8 100644 --- a/src/cam/options.cpp +++ b/src/cam/options.cpp @@ -453,7 +453,7 @@ void KeyValueParser::usage(int indent) argument += "]"; } - std::cerr << std::setw(indent) << std::left << argument; + std::cerr << std::setw(indent) << argument; for (const char *help = option.help, *end = help; end;) { end = strchr(help, '\n'); @@ -994,7 +994,12 @@ void OptionsParser::usage() std::cerr << "Options:" << std::endl; + std::ios_base::fmtflags f(std::cerr.flags()); + std::cerr << std::left; + usageOptions(options_, indent); + + std::cerr.flags(f); } void OptionsParser::usageOptions(const std::list