From: Richard Stallman Date: Sat, 1 Aug 1992 18:11:28 +0000 (+0000) Subject: Find the links to directories by finding each link and testing it with test. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=165b39415786da06b03b0c802b1d7b1eff826d67;p=gcc.git Find the links to directories by finding each link and testing it with test. From-SVN: r1740 --- diff --git a/gcc/fixincludes b/gcc/fixincludes index e621c70c07c..8de664e87e3 100755 --- a/gcc/fixincludes +++ b/gcc/fixincludes @@ -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"