@@ -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 <<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 {
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@linux.intel.com> --- 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(-)