瀏覽代碼

[media] docs-rst: parse-headers.pl: make debug a command line option

Add a parser for the --debug option, in order to allow
seeing what the parser is doing.

Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab 9 年之前
父節點
當前提交
bcec7c218d
共有 1 個文件被更改,包括 10 次插入4 次删除
  1. 10 4
      Documentation/sphinx/parse-headers.pl

+ 10 - 4
Documentation/sphinx/parse-headers.pl

@@ -2,12 +2,18 @@
 use strict;
 use strict;
 use Text::Tabs;
 use Text::Tabs;
 
 
-# Uncomment if debug is needed
-#use Data::Dumper;
-
-# change to 1 to generate some debug prints
 my $debug = 0;
 my $debug = 0;
 
 
+while ($ARGV[0] =~ m/^-(.*)/) {
+	my $cmd = shift @ARGV;
+	if ($cmd eq "--debug") {
+		require Data::Dumper;
+		$debug = 1;
+		next;
+	}
+	die "argument $cmd unknown";
+}
+
 if (scalar @ARGV < 2 || scalar @ARGV > 3) {
 if (scalar @ARGV < 2 || scalar @ARGV > 3) {
 	die "Usage:\n\t$0 <file in> <file out> [<exceptions file>]\n";
 	die "Usage:\n\t$0 <file in> <file out> [<exceptions file>]\n";
 }
 }