diff options
author | Bruce Korb <autogen@linuxbox.com> | 1999-01-27 09:06:42 +0000 |
---|---|---|
committer | Bruce Korb <autogen@linuxbox.com> | 1999-01-27 09:06:42 +0000 |
commit | 5505dbd04b6698b6fdddd2be28246e2259899fe5 (patch) | |
tree | e2f702f999979600af1225efea4af21ed8ec1a13 /gcc/fixinc/inclhack.tpl | |
parent | 598c7b0ba28cecf2c0589714b83930287a225b60 (diff) |
Added a protection around a '[ -r xx ]' test.fixincl-branch
This fails with a file-not-found error on some systems??
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/fixincl-branch@24885 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fixinc/inclhack.tpl')
-rw-r--r-- | gcc/fixinc/inclhack.tpl | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/gcc/fixinc/inclhack.tpl b/gcc/fixinc/inclhack.tpl index 537b1e188c5..06b49aeabe9 100644 --- a/gcc/fixinc/inclhack.tpl +++ b/gcc/fixinc/inclhack.tpl @@ -338,18 +338,20 @@ while [ $# != 0 ]; do # cd ${INPUT} cd $1 - if [ -r $2 ] && [ ! -r $3 ]; then - cp $2 $3 >/dev/null 2>&1 || echo "Can't copy $2" >&2 - chmod +w $3 2>/dev/null - chmod a+r $3 2>/dev/null - echo Copied $2 - for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 | + if [ -f $2 ] ; then + if [ -r $2 ] && [ ! -r $3 ]; then + cp $2 $3 >/dev/null 2>&1 || echo "Can't copy $2" >&2 + chmod +w $3 2>/dev/null + chmod a+r $3 2>/dev/null + echo Copied $2 + for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'` - do - dir=`echo $2 | sed -e s'|/[^/]*$||'` - dir2=`echo $3 | sed -e s'|/[^/]*$||'` - newreq="$newreq $1 $dir/$include $dir2/$include" - done + do + dir=`echo $2 | sed -e s'|/[^/]*$||'` + dir2=`echo $3 | sed -e s'|/[^/]*$||'` + newreq="$newreq $1 $dir/$include $dir2/$include" + done + fi fi shift; shift; shift done |