[FFmpeg-devel] [PATCH 3/8] doc/texi2pod: Use GCC implementation of -I flag

Timothy Gu timothygu99 at gmail.com
Thu Jan 23 05:04:01 CET 2014


Changed to GCC r105780, r113462, and r114271.

Signed-off-by: Timothy Gu <timothygu99 at gmail.com>
---
 doc/texi2pod.pl | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl
index ef2f7bc..d684ba4 100755
--- a/doc/texi2pod.pl
+++ b/doc/texi2pod.pl
@@ -38,7 +38,8 @@ $shift = "";
 %defs = ();
 $fnno = 1;
 $inf = "";
- at ibase = ();
+$ibase = "";
+ at ipath = ();
 
 while ($_ = shift) {
     if (/^-D(.*)$/) {
@@ -55,7 +56,12 @@ while ($_ = shift) {
             unless $flag =~ /^[a-zA-Z0-9_-]+$/;
         $defs{$flag} = $value;
     } elsif (/^-I(.*)$/) {
-        push @ibase, $1 ne "" ? $1 : shift;
+        if ($1 ne "") {
+            $flag = $1;
+        } else {
+	        $flag = shift;
+	    }
+        push (@ipath, $flag);
     } elsif (/^-/) {
         usage();
     } else {
@@ -65,12 +71,10 @@ while ($_ = shift) {
     }
 }
 
-push @ibase, ".";
-
 if (defined $in) {
     $inf = gensym();
     open($inf, "<$in") or die "opening \"$in\": $!\n";
-    push @ibase, $1 if $in =~ m|^(.+)/[^/]+$|;
+    $ibase = $1 if $in =~ m|^(.+)/[^/]+$|;
 } else {
     $inf = \*STDIN;
 }
@@ -109,11 +113,17 @@ INF: while(<$inf>) {
     /^\@include\s+(.+)$/ and do {
         push @instack, $inf;
         $inf = gensym();
-
-        for (@ibase) {
-            open($inf, "<" . $_ . "/" . $1) and next INF;
+        $file = postprocess($1);
+
+        # Try cwd and $ibase, then explicit -I paths.
+        $done = 0;
+        foreach $path ("", $ibase, @ipath) {
+            $mypath = $file;
+            $mypath = $path . "/" . $mypath if ($path ne "");
+            open($inf, "<" . $mypath) and ($done = 1, last);
         }
-        die "cannot open $1: $!\n";
+        die "cannot find $file" if !$done;
+        next;
     };
 
     /^\@chapter\s+([A-Za-z ]+)/ and do {
-- 
1.8.3.2



More information about the ffmpeg-devel mailing list