Annotation of gcc/fixincludes, revision 1.1.1.2

1.1       root        1: #! /bin/sh
                      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: 
                      6: # See README-fixinc for more information.
                      7: 
                      8: # Directory containing the original header files.
                      9: # (This was named INCLUDES, but that conflicts with a name in Makefile.in.)
                     10: INPUT=${2-${INPUT-/usr/include}}
                     11: 
                     12: # This prevents /bin/ex from failing if the current terminal type is
                     13: # unrecognizable.
                     14: TERM=unknown
                     15: export TERM
                     16: 
                     17: # Directory in which to store the results.
                     18: LIB=${1-${LIB-/usr/local/lib/gcc-include}}
                     19: 
                     20: # Make sure it exists.
                     21: if [ ! -d $LIB ]; then
                     22:   mkdir $LIB || exit 1
                     23: fi
                     24: 
                     25: # Make LIB absolute.
                     26: cd $LIB; LIB=`pwd`
                     27: 
                     28: # Fail if no arg to specify a directory for the output.
                     29: if [ x$1 = x ]
                     30: then echo fixincludes: no output directory specified
                     31: exit 1
                     32: fi
                     33: 
                     34: echo 'Building fixincludes in ' ${LIB}
                     35: 
                     36: # Determine whether this system has symbolic links.
                     37: if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
                     38:   rm -f $LIB/ShouldNotExist
                     39:   LINKS=true
                     40: else
                     41:   LINKS=false
                     42: fi
                     43: 
                     44: echo 'Making directories:'
                     45: cd ${INPUT}
1.1.1.2 ! root       46: # Find all directories and all symlinks that point to directories.
        !            47: files=`        find . -type d -print | sed '/^.$/d'
        !            48:        $LINKS && find . -type l -exec test -d '{}' \; -print`
1.1       root       49: for file in $files; do
                     50:   rm -rf $LIB/$file
                     51:   if [ ! -d $LIB/$file ]
                     52:   then mkdir $LIB/$file
                     53:   fi
                     54: done
                     55: 
                     56: # treetops gets an alternating list
                     57: # of old directories to copy
                     58: # and the new directories to copy to.
                     59: treetops="${INPUT} ${LIB}"
                     60: 
                     61: if $LINKS; then
                     62:   echo 'Making internal symbolic directory links'
                     63:   for file in $files; do
                     64:     dest=`ls -ld $file | sed -n 's/.*-> //p'`
                     65:     if [ "$dest" ]; then    
                     66:       cwd=`pwd`
                     67:       # In case $dest is relative, get to $file's dir first.
                     68:       cd ${INPUT}
                     69:       cd `echo ./$file | sed -n 's&[^/]*$&&p'`
                     70:       # Check that the target directory exists.
                     71:       # Redirections changed to avoid bug in sh on Ultrix.
                     72:       (cd $dest) > /dev/null 2>&1
                     73:       if [ $? = 0 ]; then
                     74:        cd $dest
                     75:        # X gets the dir that the link actually leads to.
                     76:        x=`pwd`
                     77:        # If link leads back into ${INPUT},
                     78:        # make a similar link here.
                     79:        if expr $x : "${INPUT}/.*" > /dev/null; then
                     80:          # Y gets the actual target dir name, relative to ${INPUT}.
                     81:          y=`echo $x | sed -n "s&${INPUT}/&&p"`
                     82:          echo $file '->' $y ': Making link'
                     83:          rm -fr ${LIB}/$file > /dev/null 2>&1
                     84:          ln -s ${LIB}/$y ${LIB}/$file > /dev/null 2>&1
                     85:        else
                     86:          # If the link is to outside ${INPUT},
                     87:          # treat this directory as if it actually contained the files.
                     88: # This line used to have $dest instead of $x.
                     89: # $dest seemed to be wrong for links found in subdirectories
                     90: # of ${INPUT}.  Does this change break anything?
                     91:          treetops="$treetops $x ${LIB}/$file"
                     92:        fi
                     93:       fi
                     94:       cd $cwd
                     95:     fi
                     96:   done
                     97: fi
                     98: 
                     99: set - $treetops
                    100: while [ $# != 0 ]; do
                    101:   # $1 is an old directory to copy, and $2 is the new directory to copy to.
                    102:   echo "Finding header files in $1:"
                    103:   cd ${INPUT}
                    104:   cd $1
                    105:   files=`find . -name '*.h' -type f -print`
                    106:   echo 'Checking header files:'
                    107: # Note that BSD43_* are used on recent MIPS systems.
                    108:   for file in $files; do
                    109: # This call to egrep is essential, since checking a file with egrep
                    110: # is much faster than actually trying to fix it.
1.1.1.2 ! root      111: # It is also essential that most files *not* match!
        !           112: # Thus, matching every #endif is unacceptable.
1.1       root      113: # But the argument to egrep must be kept small, or many versions of egrep
                    114: # won't be able to handle it.
1.1.1.2 ! root      115: # rms: I removed `|#[el].*if.*[^/      ]' because it made egrep fail.
1.1       root      116:     if egrep '[        _]_IO|CTRL|#define.NULL|#[el]*if.*([0-9]|sparc|vax|sun|pyr)' $file > /dev/null; then
                    117:       echo Fixing $file
                    118:       if [ -r $file ]; then
                    119:        cp $file $2/$file >/dev/null 2>&1       \
                    120:        || echo "Can't copy $file"
                    121:        chmod +w $2/$file
1.1.1.2 ! root      122: # Following two lines removed.
        !           123: #        s%^\([        ]*#[    ]*endif[        ]*\)\([^/       ].*\)$%\1/* \2 */%
        !           124: #        s%^\([        ]*#[    ]*else[         ]*\)\([^/       ].*\)$%\1/* \2 */%
        !           125: 
1.1       root      126:        sed -e '
                    127:                                   :loop
                    128:          /\\$/                 N
                    129:          /\\$/                 b loop
                    130:          /[    ]_IO[A-Z]*[     ]*(/    s/(\(.\),/('\''\1'\'',/
                    131:          /[    ]BSD43__IO[A-Z]*[       ]*(/    s/(\(.\),/('\''\1'\'',/
                    132:          /#define._IO/         s/'\''x'\''/x/g
                    133:          /#define.BSD43__IO/           s/'\''x'\''/x/g
                    134:          /[^A-Z]CTRL[  ]*(/    s/\([^'\'']\))/'\''\1'\'')/
                    135:          /#define.CTRL/                s/'\''c'\''/c/g
                    136:          /#define._CTRL/               s/'\''c'\''/c/g
                    137:          /#define.BSD43_CTRL/          s/'\''c'\''/c/g
1.1.1.2 ! root      138:          /#[a-z]*if.*[  (]m68k/                s/\([^_]\)m68k/\1__m68k__/g
        !           139:          /#[a-z]*if.*[  (]__i386/      s/__i386/__i386__/g
        !           140:          /#[a-z]*if.*[  (]i386/                s/\([^_]\)i386/\1__i386__/g
        !           141:          /#[a-z]*if.*[  (]sparc/       s/\([^_]\)sparc/\1__sparc__/g
        !           142:          /#[a-z]*if.*[  (]mc68000/     s/\([^_]\)mc68000/\1__mc68000__/g
        !           143:          /#[a-z]*if.*[  (]vax/         s/\([^_]\)vax/\1__vax__/g
        !           144:          /#[a-z]*if.*[  (]sun/         s/\([^_]\)\(sun[a-z0-9]*\)\([^a-z0-9_]\)/\1__\2__\3/g
        !           145:          /#[a-z]*if.*[  (]sun/         s/\([^_]\)\(sun[a-z0-9]*\)$/\1__\2__/g
        !           146:          /#[a-z]*if.*[  (]ns32000/     s/\([^_]\)ns32000/\1__ns32000__/g
        !           147:          /#[a-z]*if.*[  (]pyr/         s/\([^_]\)pyr/\1__pyr__/g
        !           148:          /#[a-z]*if.*[  (]is68k/       s/\([^_]\)is68k/\1__is68k__/g
1.1       root      149:          /#define.NULL[        ]/      i\
                    150:                #undef NULL
                    151:        ' $2/$file > $2/$file.sed
                    152:        mv $2/$file.sed $2/$file
                    153:        if cmp $file $2/$file >/dev/null 2>&1; then
                    154:           echo Deleting $2/$file\; no fixes were needed.
                    155:           rm $2/$file
                    156:        fi
                    157:       fi
                    158:     fi
                    159:   done
                    160:   shift; shift
                    161: done
                    162: 
                    163: cd ${INPUT}
                    164: 
                    165: # Fix one other error in this file: a mismatched quote not inside a C comment.
                    166: file=sundev/vuid_event.h
1.1.1.2 ! root      167: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !           168:   mkdir ${LIB}/sundev 2>/dev/null
        !           169:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !           170:   chmod +w ${LIB}/$file 2>/dev/null
1.1       root      171: fi
                    172: 
                    173: if [ -r ${LIB}/$file ]; then
                    174:   echo Fixing $file comment
                    175:   ex ${LIB}/$file <<EOF
                    176:   g/doesn't/s/doesn't/does not/
                    177:   wq
                    178: EOF
                    179:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    180:     echo Deleting ${LIB}/$file\; no fixes were needed.
                    181:     rm ${LIB}/$file
                    182:   fi
                    183: fi
                    184: 
                    185: # Fix this Sun file to avoid intefering with stddef.h.
                    186: file=sys/stdtypes.h
1.1.1.2 ! root      187: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !           188:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !           189:   chmod +w ${LIB}/$file 2>/dev/null
1.1       root      190: fi
                    191: 
                    192: if [ -r ${LIB}/$file ]; then
1.1.1.2 ! root      193:   echo Fixing $file
1.1       root      194:   ex ${LIB}/$file <<EOF
                    195:   /size_t.*;/
                    196:   i
1.1.1.2 ! root      197: #ifndef _GCC_SIZE_T
        !           198: #define _GCC_SIZE_T
1.1       root      199: .
                    200:   /size_t/+1
                    201:   i
                    202: #endif
                    203: .
                    204:   /ptrdiff_t.*;/
                    205:   i
1.1.1.2 ! root      206: #ifndef _GCC_PTRDIFF_T
        !           207: #define _GCC_PTRDIFF_T
1.1       root      208: .
                    209:   /ptrdiff_t/+1
                    210:   i
                    211: #endif
                    212: .
                    213:   /wchar_t.*;/
                    214:   i
1.1.1.2 ! root      215: #ifndef _GCC_WCHAR_T
        !           216: #define _GCC_WCHAR_T
1.1       root      217: .
                    218:   /wchar_t/+1
                    219:   i
                    220: #endif
                    221: .
                    222:   wq
                    223: EOF
                    224:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    225:     echo Deleting ${LIB}/$file\; no fixes were needed.
                    226:     rm ${LIB}/$file
                    227:   fi
                    228: fi
                    229: 
                    230: # Fix this file to avoid intefering with stddef.h.
                    231: file=sys/types.h
1.1.1.2 ! root      232: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !           233:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !           234:   chmod +w ${LIB}/$file 2>/dev/null
1.1       root      235: fi
                    236: 
                    237: if [ -r ${LIB}/$file ]; then
1.1.1.2 ! root      238:   echo Fixing $file
1.1       root      239:   ex ${LIB}/$file <<EOF
                    240:   /size_t.*;/
                    241:   i
1.1.1.2 ! root      242: #ifndef _GCC_SIZE_T
        !           243: #define _GCC_SIZE_T
1.1       root      244: .
                    245:   /size_t/+1
                    246:   i
                    247: #endif
                    248: .
                    249:   wq
                    250: EOF
                    251:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    252:     echo Deleting ${LIB}/$file\; no fixes were needed.
                    253:     rm ${LIB}/$file
                    254:   fi
                    255: fi
                    256: 
                    257: # Fix an error in this file: a missing semi-colon at the end of the statsswtch
                    258: # structure definition.
                    259: file=rpcsvc/rstat.h
1.1.1.2 ! root      260: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !           261:   mkdir ${LIB}/rpcsvc 2>/dev/null
        !           262:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !           263:   chmod +w ${LIB}/$file 2>/dev/null
1.1       root      264: fi
                    265: 
                    266: if [ -r ${LIB}/$file ]; then
                    267:   echo Fixing $file, definition of statsswtch
                    268:   ex ${LIB}/$file <<EOF
                    269:   g/boottime$/s//&;/
                    270:   wq
                    271: EOF
                    272:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    273:     echo Deleting ${LIB}/$file\; no fixes were needed.
                    274:     rm ${LIB}/$file
                    275:   fi
                    276: fi
                    277: 
                    278: # Fix an error in this file: a missing semi-colon at the end of the nodeent
                    279: # structure definition.
                    280: file=netdnet/dnetdb.h
1.1.1.2 ! root      281: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !           282:   mkdir ${LIB}/netdnet 2>/dev/null
        !           283:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !           284:   chmod +w ${LIB}/$file 2>/dev/null
1.1       root      285: fi
                    286: 
                    287: if [ -r ${LIB}/$file ]; then
                    288:   echo Fixing $file, definition of nodeent
                    289:   ex ${LIB}/$file <<EOF
                    290:   g/na_addr/s//&;/
                    291:   wq
                    292: EOF
                    293:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    294:     echo Deleting ${LIB}/$file\; no fixes were needed.
                    295:     rm ${LIB}/$file
                    296:   fi
                    297: fi
                    298: 
                    299: # Check for bad #ifdef line (in Ultrix 4.1)
                    300: file=sys/file.h
1.1.1.2 ! root      301: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !           302:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !           303:   chmod +w ${LIB}/$file 2>/dev/null
1.1       root      304: fi
                    305: 
                    306: if [ -r ${LIB}/$file ]; then
                    307:   echo Fixing $file, bad \#ifdef line
                    308:   ex ${LIB}/$file <<EOF
                    309:   g/^#ifdef KERNEL && !defined/
                    310:   s/#ifdef KERNEL && !defined/#if defined(KERNEL) \&\& !defined/
                    311:   wq
                    312: EOF
                    313:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    314:     echo Deleting ${LIB}/$file\; no fixes were needed.
                    315:     rm ${LIB}/$file
                    316:   fi
                    317: fi
                    318: 
1.1.1.2 ! root      319: # Remove nested comments created by #endifs in a comment (Ultrix 4.1)
        !           320: # Only needed if commenting out junk after #endif.
        !           321: #file=signal.h
        !           322: #if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !           323: #  cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !           324: #  chmod +w ${LIB}/$file 2>/dev/null
        !           325: #fi
        !           326: #
        !           327: #if [ -r ${LIB}/$file ]; then
        !           328: #  echo Fixing $file, nested comments
        !           329: #  sed -e 's/#endif.*/#endif/' ${LIB}/$file > ${LIB}/${file}.sed
        !           330: #  rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !           331: #  if cmp $file ${LIB}/$file >/dev/null 2>&1; then
        !           332: #    echo Deleting ${LIB}/$file\; no fixes were needed.
        !           333: #    rm -f ${LIB}/$file
        !           334: #  fi
        !           335: #fi
1.1       root      336: 
1.1.1.2 ! root      337: # Check for superfluous `static' (in Ultrix 4.2)
1.1       root      338: file=machine/cpu.h
1.1.1.2 ! root      339: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !           340:   mkdir ${LIB}/machine 2>/dev/null
        !           341:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !           342:   chmod +w ${LIB}/$file 2>/dev/null
1.1       root      343: fi
                    344: 
                    345: if [ -r ${LIB}/$file ]; then
                    346:   echo Fixing $file, superfluous static
                    347:   ex ${LIB}/$file <<EOF
                    348:   g/^static struct tlb_pid_state/
                    349:   s/static//
                    350:   wq
                    351: EOF
                    352:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    353:     echo Deleting ${LIB}/$file\; no fixes were needed.
                    354:     rm ${LIB}/$file
                    355:   else
                    356: # This file has an alternative name, mips/cpu.h.  Fix that name, too.
                    357:     if cmp machine/cpu.h mips/cpu.h > /dev/null 2>& 1; then
                    358:       mkdir ${LIB}/mips 2>&-
                    359:       ln ${LIB}/$file ${LIB}/mips/cpu.h 
                    360:     fi
                    361:   fi
                    362: fi
                    363: 
1.1.1.2 ! root      364: # Incorrect sprintf declaration in X11/Xmu.h
1.1       root      365: file=X11/Xmu.h
1.1.1.2 ! root      366: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !           367:   mkdir ${LIB}/X11 2>/dev/null
        !           368:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !           369:   chmod +w ${LIB}/$file 2>/dev/null
1.1       root      370: fi
                    371: 
                    372: if [ -r ${LIB}/$file ]; then
                    373:   echo Fixing $file sprintf declaration
                    374:   ex ${LIB}/$file <<EOF
                    375:   /^extern char \*     sprintf();$/c
                    376: #ifndef __STDC__
                    377: extern char *  sprintf();
                    378: #endif /* !defined __STDC__ */
                    379: .
                    380:   wq
                    381: EOF
                    382:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    383:     echo Deleting ${LIB}/$file\; no fixes were needed.
                    384:     rm ${LIB}/$file
                    385:   fi
                    386: fi
                    387: 
                    388: # Check for missing ';' in struct
                    389: file=netinet/ip.h
1.1.1.2 ! root      390: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !           391:   mkdir ${LIB}/netinet 2>/dev/null
        !           392:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !           393:   chmod +w ${LIB}/$file 2>/dev/null
1.1       root      394: fi
                    395: 
1.1.1.2 ! root      396: if [ -r ${LIB}/$file ]; then
        !           397:   echo Fixing $file
        !           398:   sed -e '/^struct/,/^};/s/}$/};/' ${LIB}/$file > ${LIB}/${file}.sed
        !           399:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !           400:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
        !           401:     echo Deleting ${LIB}/$file\; no fixes were needed.
        !           402:     rm -f ${LIB}/$file
        !           403:   fi
        !           404: fi
1.1       root      405: 
1.1.1.2 ! root      406: # Fix the CAT macro in SunOS memvar.h.
1.1       root      407: file=pixrect/memvar.h
1.1.1.2 ! root      408: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !           409:   mkdir ${LIB}/pixrect 2>/dev/null
        !           410:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !           411:   chmod +w ${LIB}/$file 2>/dev/null
        !           412: fi
        !           413: 
        !           414: if [ -r ${LIB}/$file ]; then
        !           415:   echo Fixing $file
        !           416:   sed -e '/^#define.CAT(a,b)/ i\
1.1       root      417: #ifdef __STDC__ \
                    418: #define CAT(a,b) a##b\
                    419: #else
                    420: /^#define.CAT(a,b)/ a\
                    421: #endif
1.1.1.2 ! root      422: ' ${LIB}/$file > ${LIB}/${file}.sed
        !           423:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !           424:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
        !           425:     echo Deleting ${LIB}/$file\; no fixes were needed.
        !           426:     rm -f ${LIB}/$file
1.1       root      427:   fi
                    428: fi
                    429: 
                    430: # Check for yet more missing ';' in struct (in SunOS 4.0.x)
                    431: file=rpcsvc/rusers.h
1.1.1.2 ! root      432: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !           433:   mkdir ${LIB}/rpcsvc 2>/dev/null
        !           434:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !           435:   chmod +w ${LIB}/$file 2>/dev/null
        !           436: fi
        !           437: 
        !           438: if [ -r ${LIB}/$file ]; then
        !           439:   echo Fixing $file
        !           440:   sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' ${LIB}/$file > ${LIB}/${file}.sed
        !           441:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !           442:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
        !           443:     echo Deleting ${LIB}/$file\; no fixes were needed.
        !           444:     rm -f ${LIB}/$file
1.1       root      445:   fi
                    446: fi
                    447: 
                    448: # Fix return type of exit and abort in <stdlib.h> on SunOS 4.1.
                    449: file=stdlib.h
1.1.1.2 ! root      450: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !           451:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !           452:   chmod +w ${LIB}/$file 2>/dev/null
1.1       root      453: fi
1.1.1.2 ! root      454: 
        !           455: if [ -r ${LIB}/$file ]; then
        !           456:   echo Fixing $file
        !           457:   sed -e 's/int        abort/void      abort/g' \
        !           458:   -e 's/int    exit/void       exit/g' ${LIB}/$file > ${LIB}/${file}.sed
        !           459:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !           460:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
        !           461:     echo Deleting ${LIB}/$file\; no fixes were needed.
1.1       root      462:     rm -f ${LIB}/$file
                    463:   fi
                    464: fi
                    465: 
                    466: # Fix bogus comment in <locale.h> on SunOS 4.1.
                    467: file=locale.h
1.1.1.2 ! root      468: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !           469:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !           470:   chmod +w ${LIB}/$file 2>/dev/null
1.1       root      471: fi
1.1.1.2 ! root      472: 
        !           473: if [ -r ${LIB}/$file ]; then
        !           474:   echo Fixing $file
        !           475:   sed -e 's%#endif / \*%#endif /\* %g' ${LIB}/$file > ${LIB}/${file}.sed
        !           476:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !           477:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
        !           478:     echo Deleting ${LIB}/$file\; no fixes were needed.
1.1       root      479:     rm -f ${LIB}/$file
                    480:   fi
                    481: fi
                    482: 
                    483: # Fix bogus #ifdef in <hsfs/hsfs_spec.h> on SunOS 4.1.
                    484: file=hsfs/hsfs_spec.h
1.1.1.2 ! root      485: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !           486:   mkdir ${LIB}/hsfs 2>/dev/null
        !           487:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !           488:   chmod +w ${LIB}/$file 2>/dev/null
        !           489: fi
        !           490: 
1.1       root      491: if [ -r ${LIB}/$file ]; then
1.1.1.2 ! root      492:   echo Fixing $file
        !           493:   sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
        !           494:     ${LIB}/$file > ${LIB}/${file}.sed
        !           495:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !           496:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
        !           497:     echo Deleting ${LIB}/$file\; no fixes were needed.
1.1       root      498:     rm -f ${LIB}/$file
                    499:   fi
                    500: fi
                    501: 
                    502: # Fix bogus #ifdef in <hsfs/hsnode.h> on SunOS 4.1.
                    503: file=hsfs/hsnode.h
1.1.1.2 ! root      504: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !           505:   mkdir ${LIB}/hsfs 2>/dev/null
        !           506:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !           507:   chmod +w ${LIB}/$file 2>/dev/null
        !           508: fi
        !           509: 
1.1       root      510: if [ -r ${LIB}/$file ]; then
1.1.1.2 ! root      511:   echo Fixing $file
        !           512:   sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \
        !           513:     ${LIB}/$file > ${LIB}/${file}.sed
        !           514:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !           515:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
        !           516:     echo Deleting ${LIB}/$file\; no fixes were needed.
1.1       root      517:     rm -f ${LIB}/$file
                    518:   fi
                    519: fi
                    520: 
                    521: # Fix bogus #ifdef in <hsfs/iso_spec.h> on SunOS 4.1.
                    522: file=hsfs/iso_spec.h
1.1.1.2 ! root      523: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !           524:   mkdir ${LIB}/hsfs 2>/dev/null
        !           525:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !           526:   chmod +w ${LIB}/$file 2>/dev/null
        !           527: fi
        !           528: 
1.1       root      529: if [ -r ${LIB}/$file ]; then
1.1.1.2 ! root      530:   echo Fixing $file
        !           531:   sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
        !           532:     ${LIB}/$file > ${LIB}/${file}.sed
        !           533:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !           534:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
        !           535:     echo Deleting ${LIB}/$file\; no fixes were needed.
        !           536:     rm -f ${LIB}/$file
        !           537:   fi
        !           538: fi
        !           539: 
        !           540: # Incorrect #include in Sony News-OS 3.2.
        !           541: file=machine/machparam.h
        !           542: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !           543:   mkdir ${LIB}/machine 2>/dev/null
        !           544:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !           545:   chmod +w ${LIB}/$file 2>/dev/null
        !           546: fi
        !           547: 
        !           548: if [ -r ${LIB}/$file ]; then
        !           549:   echo Fixing $file, incorrect \#include
        !           550:   sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \
        !           551:     ${LIB}/$file > ${LIB}/${file}.sed
        !           552:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !           553:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
        !           554:     echo Deleting ${LIB}/$file\; no fixes were needed.
        !           555:     rm -f ${LIB}/$file
        !           556:   fi
        !           557: fi
        !           558: 
        !           559: # Multiline comment after typedef on IRIX 4.0.1.
        !           560: file=sys/types.h
        !           561: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !           562:   mkdir ${LIB}/sys 2>/dev/null
        !           563:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !           564:   chmod +w ${LIB}/$file 2>/dev/null
        !           565: fi
        !           566: 
        !           567: if [ -r ${LIB}/$file ]; then
        !           568:   echo Fixing $file, comment in the middle of \#ifdef
        !           569:   sed -e 's@type of the result@type of the result */@' \
        !           570:     -e 's@of the sizeof@/* of the sizeof@' \
        !           571:     ${LIB}/$file > ${LIB}/${file}.sed
        !           572:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !           573:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
        !           574:     echo Deleting ${LIB}/$file\; no fixes were needed.
1.1       root      575:     rm -f ${LIB}/$file
                    576:   fi
                    577: fi
                    578: 
                    579: echo 'Removing unneeded directories:'
                    580: cd $LIB
                    581: files=`find . -type d -print | sort -r`
                    582: for file in $files; do
                    583:   rmdir $LIB/$file > /dev/null 2>&1
                    584: done
                    585: 
                    586: if $LINKS; then
                    587:   echo 'Making internal symbolic non-directory links'
                    588:   cd ${INPUT}
                    589:   files=`find . -type l -print`
                    590:   for file in $files; do
                    591:     dest=`ls -ld $file | sed -n 's/.*-> //p'`
                    592:     if expr "$dest" : '[^/].*' > /dev/null; then    
                    593:       target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
                    594:       if [ -f $target ]; then
                    595:         ln -s $dest ${LIB}/$file >/dev/null 2>&1
                    596:       fi
                    597:     fi
                    598:   done
                    599: fi
                    600: 
                    601: exit 0

unix.superglobalmegacorp.com

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