Annotation of gcc/fixincludes, revision 1.1.1.10

1.1.1.2   root        1: #! /bin/sh
1.1       root        2: # Install modified versions of certain ANSI-incompatible system header files
                      3: # which are fixed to work correctly with ANSI C
                      4: # and placed in a directory that GNU C will search.
                      5: # This works properly on a Sun in system version 3.4;
                      6: # for other versions, you had better check.
                      7: 
1.1.1.3   root        8: # Directory in which to store the results.
                      9: LIB=/usr/local/lib/gcc-include
                     10: 
1.1.1.10! root       11: # Determine whether this system has symbolic links.
        !            12: if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
        !            13:   rm -f $LIB/ShouldNotExist
        !            14:   LINKS=true
        !            15: else
        !            16:   LINKS=false
        !            17: fi
        !            18: 
1.1.1.9   root       19: echo 'Making directories:'
                     20: cd /usr/include
1.1.1.10! root       21: mkdir $LIB > /dev/null 2>&1
        !            22: if $LINKS; then
        !            23:   files=`ls -LR | sed -n s/:$//p`
        !            24: else
        !            25:   files=`find . -type d -print`
        !            26: fi
1.1.1.9   root       27: for file in $files; do
                     28:   mkdir $LIB/$file > /dev/null 2>&1
                     29: done
1.1.1.6   root       30: 
1.1.1.10! root       31: # treetops gets an alternating list
        !            32: # of old directories to copy
        !            33: # and the new directories to copy to.
        !            34: treetops="/usr/include ${LIB}"
        !            35: 
        !            36: if $LINKS; then
        !            37:   echo 'Making internal symbolic directory links'
        !            38:   for file in $files; do
        !            39:     dest=`ls -ld $file | sed -n 's/.*-> //p'`
        !            40:     if [ "$dest" ]; then    
        !            41:       if expr $dest : '[^/].*' > /dev/null; then
        !            42:        rmdir ${LIB}/$file > /dev/null 2>&1
        !            43:        rm -f ${LIB}/$file > /dev/null 2>&1
        !            44:        ln -s $dest ${LIB}/$file > /dev/null 2>&1
        !            45:       else                             # dont make links outside /usr/include
        !            46:        treetops="$treetops $dest ${LIB}/$file"
        !            47:       fi
        !            48:     fi
        !            49:   done
        !            50: fi
        !            51: 
        !            52: set - $treetops
        !            53: while [ $# != 0 ]; do
        !            54:   # $1 is an old directory to copy, and $2 is the new directory to copy to.
        !            55:   echo 'Finding header files in $1:'
        !            56:   cd $1
        !            57:   files=`find . -type f -print`
        !            58:   echo 'Checking header files:'
        !            59:   for file in $files; do
        !            60:     if egrep -s '[     ]_IO[A-Z]*\(|#define._IO|CTRL' $file; then
        !            61:       echo Fixing $file
        !            62:       if [ -r $file ]; then
        !            63:        cp $file $2/$file >/dev/null 2>&1       \
        !            64:        || echo "Can't copy $file"
        !            65:        chmod +w $2/$file
        !            66:        ex $2/$file <<EOF
        !            67:        g/[     ]_IO[A-Z]*(/s/(\(.\),/('\1',/
        !            68:         g/[    ]_IO[A-Z]*(.*\\$/.,+1s/(\(.\),/('\1',/
        !            69:        g/#define._IO/s/'x'/x/g
        !            70:         g/#define._IO.*\\$/.,+1s/'x'/x/g
        !            71:        g/[^A-Z]CTRL[   ]*(/s/\(.\))/'\1')/
        !            72:        g/#define.CTRL/s/'c'/c/g
        !            73:        wq
1.1.1.5   root       74: EOF
1.1.1.10! root       75:        if cmp $file $2/$file >/dev/null 2>&1; then
        !            76:           echo Deleting $2/$file\; no fixes were needed.
        !            77:           rm $2/$file
        !            78:        fi
1.1.1.8   root       79:       fi
1.1.1.5   root       80:     fi
1.1.1.10! root       81:   done
        !            82:   shift; shift
1.1.1.2   root       83: done
                     84: 
1.1.1.5   root       85: # Fix one other error in this file: a mismatched quote not inside a C comment.
                     86: file=sundev/vuid_event.h
                     87: if [ -r $file ]; then
                     88:   if [ ! -r ${LIB}/$file ]; then
                     89:     cp $file ${LIB}/$file >/dev/null 2>&1      \
                     90:     || echo "Can't copy $file"
1.1.1.3   root       91:     chmod +w ${LIB}/$file
1.1.1.2   root       92:   fi
1.1.1.5   root       93: fi
1.1.1.4   root       94: 
1.1.1.5   root       95: if [ -r ${LIB}/sundev/vuid_event.h ]; then
                     96:   echo Fixing sundev/vuid_event.h comment
                     97:   ex ${LIB}/sundev/vuid_event.h <<EOF
                     98:   g/doesn't/s/doesn't/doesn''t/
                     99:   wq
1.1       root      100: EOF
1.1.1.8   root      101: fi
1.1.1.10! root      102: 
        !           103: echo 'Removing unneeded directories:'
        !           104: cd $LIB
        !           105: files=`find . -type d -print | sort -r`
        !           106: for file in $files; do
        !           107:   rmdir $LIB/$file > /dev/null 2>&1
        !           108: done
        !           109: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.