From patchwork Tue Feb 21 16:08:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 655882 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FB15C64EC7 for ; Tue, 21 Feb 2023 16:09:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233175AbjBUQJG (ORCPT ); Tue, 21 Feb 2023 11:09:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232992AbjBUQJF (ORCPT ); Tue, 21 Feb 2023 11:09:05 -0500 Received: from lahtoruutu.iki.fi (lahtoruutu.iki.fi [185.185.170.37]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85F58234F5 for ; Tue, 21 Feb 2023 08:09:02 -0800 (PST) Received: from hillosipuli.retiisi.eu (dkzbhx1tyyyyyyyyyyyyt-3.rev.dnainternet.fi [IPv6:2001:14ba:4502:69d6::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sailus) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 08B031B002A4; Tue, 21 Feb 2023 18:09:00 +0200 (EET) Received: from vihersipuli.localdomain (vihersipuli.localdomain [IPv6:fd35:1bc8:1a6:d3d5::84:2]) by hillosipuli.retiisi.eu (Postfix) with ESMTP id ED334634C91; Tue, 21 Feb 2023 18:08:49 +0200 (EET) Received: from sailus by vihersipuli.localdomain with local (Exim 4.94.2) (envelope-from ) id 1pUVCD-0000jb-JM; Tue, 21 Feb 2023 18:08:49 +0200 From: Sakari Ailus To: linux-media@vger.kernel.org Cc: laurent.pinchart@ideasonboard.com, gjasny@googlemail.com, hverkuil@xs4all.nl, kieran.bingham@ideasonboard.com, mchehab@kernel.org, nicolas@ndufresne.ca, p.zabel@pengutronix.de, rosenp@gmail.com, sean@mess.org, user.vdr@gmail.com, xavier.claessens@collabora.com, deborah.brouwer@collabora.com, ariel@vanguardiasur.com.ar, ezequiel@vanguardiasur.com.ar, tomi.valkeinen@ideasonboard.com Subject: [PATCH 1/1] utils: Add help text for v4l2-tracer-gen.pl Date: Tue, 21 Feb 2023 18:08:49 +0200 Message-Id: <20230221160849.2778-1-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230221143204.26591-1-laurent.pinchart@ideasonboard.com> References: <20230221143204.26591-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add help text for v4l2-tracer-gen.pl, via the '-h' option. Also add support for '--' to signal end of options, in case file names would begin with dash. Signed-off-by: Sakari Ailus --- Hi Laurent, Can you squash this to the utils patch? - Sakari utils/v4l2-tracer/v4l2-tracer-gen.pl | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/utils/v4l2-tracer/v4l2-tracer-gen.pl b/utils/v4l2-tracer/v4l2-tracer-gen.pl index 8192a5bf..53473ae1 100755 --- a/utils/v4l2-tracer/v4l2-tracer-gen.pl +++ b/utils/v4l2-tracer/v4l2-tracer-gen.pl @@ -8,8 +8,26 @@ my %outtype = ( "common" => 1, "trace" => 1, "retrace" => 1 ); while ($ARGV[0] =~ /^-/) { my $arg = shift @ARGV; - $outdir = shift @ARGV if $arg eq "-o"; - %outtype = (shift @ARGV => 1) if $arg eq '-t'; + ($outdir = shift @ARGV) && next if $arg eq "-o"; + (%outtype = (shift @ARGV => 1)) && next if $arg eq '-t'; + (help() && exit 0) if $arg eq '-h'; + last if $arg eq '--'; + + print stderr "invalid option $arg, use $0 -h for help\n"; + exit 0; +} + +sub help() { + print stderr <