Re: [PATCH 1/1] utils: Add help text for v4l2-tracer-gen.pl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sakari,

On Wed, Feb 22, 2023 at 09:11:04AM +0200, Sakari Ailus wrote:
> On Tue, Feb 21, 2023 at 06:08:49PM +0200, Sakari Ailus wrote:
> > 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 <sakari.ailus@xxxxxxxxxxxxxxx>
> > ---
> > 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;
> 
> This should have been:
> 
> 	exit 1;
> 
> to signal an error if an invalid option is given. The build process should
> stop here in that case.
> 
> Could you change that while squashing it?

Sure. I've done so in my tree.

> > +}
> > +
> > +sub help() {
> > +	print stderr <<EOF;
> > +$0 - Generate files for V4L2 tracer
> > +
> > +usage: $0 [-o dir] [-t (common|trace|retrace)] [-h] header [header2] ...
> > +
> > +	-o dir	set output directory
> > +	-t x	generate particular trace files, the default is to generate
> > +		them all
> > +	-h	print this help text and quit
> > +EOF
> >  }
> >  
> >  sub convert_type_to_json_type {

-- 
Regards,

Laurent Pinchart



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux