jw@sics.se (Johan Widen) (02/05/89)
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 <<EOF X g/[ ]_IO[A-Z]*(/s/(\(.\),/('\1',/ X g/#define._IO/s/'x'/x/g X g/[^A-Z]CTRL[ ]*(/s/\(.\))/'\1')/ X g/#define.CTRL/s/'c'/c/g X wq XEOF X if cmp $file $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 <<EOF X g/[ ]_IO[A-Z]*(/s/(\(.\),/('\1',/ X g/#define._IO/s/'x'/x/g X g/[^A-Z]CTRL[ ]*(/s/\(.\))/'\1')/ X g/#define.CTRL/s/'c'/c/g X wq XEOF X if cmp $file $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 <<EOF X g/doesn't/s/doesn't/doesn''t/ X wq XEOF Xfi SHAR_EOF chmod 0775 fixincludes.link || echo "restore of fixincludes.link fails" exit 0 -- Johan Widen SICS, PO Box 1263, S-164 28 KISTA, SWEDEN Tel: +46 8 752 15 32 Ttx: 812 61 54 SICS S Fax: +46 8 751 72 30 Internet: jw@sics.se or {mcvax,munnari,ukc,unido}!enea!sics.se!jw