Find the links to directories by finding each link and testing it with test.
authorRichard Stallman <rms@gnu.org>
Sat, 1 Aug 1992 18:11:28 +0000 (18:11 +0000)
committerRichard Stallman <rms@gnu.org>
Sat, 1 Aug 1992 18:11:28 +0000 (18:11 +0000)
From-SVN: r1740

gcc/fixincludes

index e621c70c07c0b7a5ec90569b1131b13362afbe4e..8de664e87e31a2ed3114951ae366b0b4cba756fe 100755 (executable)
@@ -68,9 +68,24 @@ do
        fi
 
        # Find all directories under $d, relative to $d, excluding $d itself.
-        files="$files `find $d -type d -print | sed '|/\.$|d'`"
+        files="$files `find $d -type d -print | \
+                      sed -e '/\/\.$/d' -e '/^\.$/d'`"
+       # Find all links to directories.
+       # Using `-exec test -d' in find fails on some systems,
+       # and trying to run test via sh fails on others,
+       # so this is the simplest alternative left.
+       # First find all the links, then test each one.
+       theselinks=
        $LINKS && \
-         newdirs="$newdirs `find $d -type l -exec test -d '{}' \; -print`"
+         theselinks=`find $d -type l -print`
+       for d1 in $theselinks --dummy--
+       do
+           # If it is a directory, add it to $newdirs
+           if [ -d $d1 ]
+           then
+               newdirs="$newdirs $d1"
+           fi
+       done
     done
 
     files="$files $newdirs"