aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-07-29 04:44:02 +0000
committerRichard Stallman <rms@gnu.org>1992-07-29 04:44:02 +0000
commitfd297e33f553d9936d2c15728a417f0b7632ca52 (patch)
tree43a7174fd5c0cd7c5e5a31ab6ba8c28119fdd70d
parentef57b1e9f0820bcb629249aad4f514d235f268c7 (diff)
downloadgcc-fd297e33f553d9936d2c15728a417f0b7632ca52.zip
gcc-fd297e33f553d9936d2c15728a417f0b7632ca52.tar.gz
gcc-fd297e33f553d9936d2c15728a417f0b7632ca52.tar.bz2
Don't repeat the directory-link-chasing loop more than twice.
Combine $prevdirs with $dirs--they had same value. Properly discard $d itself from the output of find. From-SVN: r1712
-rwxr-xr-xgcc/fixincludes13
1 files changed, 6 insertions, 7 deletions
diff --git a/gcc/fixincludes b/gcc/fixincludes
index eecc3dd..592d0fc 100755
--- a/gcc/fixincludes
+++ b/gcc/fixincludes
@@ -55,26 +55,25 @@ cd ${INPUT}
# Note that $files may have duplicates in it;
# later parts of this file are supposed to ignore them.
dirs="."
-prevdirs="."
-while [ -n "$dirs" ]
+levels=2
+while [ -n "$dirs" ] && [ $levels -gt 0 ]
do
+ levels=`expr $levels - 1`
newdirs=
- for d in $prevdirs
+ for d in $dirs
do
if [ "$d" != . ]
then
d=$d/.
fi
- # Find all directories under $d, relative to $d, including $d itself.
- # Get rid of ./ at the end!
- files="$files `find $d -type d -print | sed '/^.$/d' | sed '/\/\.$/ s|/\.$||'`"
+ # Find all directories under $d, relative to $d, excluding $d itself.
+ files="$files `find $d -type d -print | sed '|/\.$|d'`"
$LINKS && \
newdirs="$newdirs `find $d -type l -exec test -d '{}' \; -print`"
done
dirs="$newdirs"
- prevdirs="$newdirs"
done
dirs=