Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!xanth!uunet!mcvax!kth!osiris!sics.se!jw From: jw@sics.se (Johan Widen) Newsgroups: gnu.gcc.bug Subject: fixincludes does not handle symbolically linked directories Message-ID: Date: 5 Feb 89 14:15:07 GMT Sender: news@osiris.sics.se Distribution: gnu Organization: Swedish Institute of Computer Science, Kista Lines: 125 On the Sequent Symmetry several of the directories in /usr/include are symbolically linked: lrwxr-xr-x 1 root 11 Jan 16 22:30 /usr/include/sys -> ../../sys/h/ The current version of fixincludes does not follow symbolic links. Here is a version that follows symbolically linked directories. A minor problem with the script is that links as follows machine -> i386/ i386 -> sys/../i386/ will produce directories gcc-include/machine and gcc-include/i386 rather than gcc-include/i386 and gcc-include/machine -> i386/ #!/bin/sh # shar: Shell Archiver (v1.22) # # Run the following text with /bin/sh to create: # fixincludes.link # sed 's/^X//' << 'SHAR_EOF' > fixincludes.link && X#! /bin/sh X# Install modified versions of certain ANSI-incompatible system header files X# which are fixed to work correctly with ANSI C X# and placed in a directory that GNU C will search. X# This works properly on a Sun in system version 3.4; X# for other versions, you had better check. X X# Directory in which to store the results. XLIB=/usr/local/lib/gcc-include X Xecho 'Making directories:' Xcd /usr/include Xfiles=`find . -type d -print` Xlinks=`find . -type l ! -name '*.h' -print` Xfor file in $files $links; do X mkdir $LIB/$file > /dev/null 2>&1 Xdone X Xecho 'Finding header files:' Xcd /usr/include Xfiles=`find . -type f -print` Xecho 'Checking header files:' Xfor file in $files; do X if egrep -s '[ ]_IO[A-Z]*\(|#define._IO|CTRL' $file; then X echo Fixing $file X if [ -r $file ]; then X newfile=${LIB}/$file X cp $file $newfile >/dev/null 2>&1 \ X || echo "Can't copy $file" X chmod +w $newfile X ex $newfile </dev/null 2>&1; then X echo Deleting $newfile\; no fixes were needed. X rm $newfile X fi X fi X fi Xdone X Xecho 'Finding header files in symbolically linked directories:' Xfor link in $links; do X cd /usr/include/$link X files=`find . -type f -print` X echo 'Checking header files in' $link':' X for file in $files; do X if egrep -s '[ ]_IO[A-Z]*\(|#define._IO|CTRL' $file; then X echo Fixing $file X if [ -r $file ]; then X newfile=${LIB}/$link/$file X cp $file $newfile >/dev/null 2>&1 \ X || echo "Can't copy $file" X chmod +w $newfile X ex $newfile </dev/null 2>&1; then X echo Deleting $newfile\; no fixes were needed. X rm $newfile X fi X fi X fi X done Xdone X X# Fix one other error in this file: a mismatched quote not inside a C comment. Xfile=sundev/vuid_event.h Xif [ -r $file ]; then X if [ ! -r ${LIB}/$file ]; then X cp $file ${LIB}/$file >/dev/null 2>&1 \ X || echo "Can't copy $file" X chmod +w ${LIB}/$file X fi Xfi X Xif [ -r ${LIB}/sundev/vuid_event.h ]; then X echo Fixing sundev/vuid_event.h comment X ex ${LIB}/sundev/vuid_event.h <