From f1f1ae8efa4cdcaef5c2677f36c85ad20df5d2a3 Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Sun, 12 Jul 1992 21:33:47 +0000 Subject: [PATCH] Replace the code that finds all directories so that it looks for subdirs of dir reached via symlinks. From-SVN: r1579 --- gcc/fixincludes | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/gcc/fixincludes b/gcc/fixincludes index 21e5fc79cc2..8ccd05b6f7f 100755 --- a/gcc/fixincludes +++ b/gcc/fixincludes @@ -44,8 +44,38 @@ fi echo 'Making directories:' cd ${INPUT} # Find all directories and all symlinks that point to directories. -files=` find . -type d -print | sed '/^.$/d' - $LINKS && find . -type l -exec test -d '{}' \; -print` +# Put the list in $files. +# Each time we find a symlink, add it to newdirs +# so that we do another find within the dir the link points to. +# Note that $files may have duplicates in it; +# later parts of this file are supposed to ignore them. +dirs="." +prevdirs="." +while [ -n "$dirs" ] +do + newdirs= + for d in $prevdirs + 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|/\.$||'`" + $LINKS && \ + newdirs="$newdirs `find $d -type l -exec test -d '{}' \; -print`" + done + + dirs="$newdirs" + prevdirs="$newdirs" +done + +dirs= +echo all directories: +echo $files + for file in $files; do rm -rf $LIB/$file if [ ! -d $LIB/$file ]