Annotation of gcc/fixincludes, revision 1.1.1.8

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: 
1.1.1.5   root       12: # Directory in which to store the results.
                     13: LIB=${1?"fixincludes: output directory not specified"}
1.1.1.4   root       14: 
                     15: # Define PWDCMD as a command to use to get the working dir
                     16: # in the form that we want.
                     17: PWDCMD=pwd
                     18: case "`pwd`" in
                     19: //*)
                     20:        # On an Apollo, discard everything before `/usr'.
                     21:        PWDCMD="eval pwd | sed -e 's,.*/usr/,/usr/,'"
                     22:        ;;
                     23: esac
1.1       root       24: 
1.1.1.5   root       25: # Original directory.
                     26: ORIGDIR=`${PWDCMD}`
1.1       root       27: 
                     28: # Make sure it exists.
                     29: if [ ! -d $LIB ]; then
                     30:   mkdir $LIB || exit 1
                     31: fi
                     32: 
1.1.1.5   root       33: # Make LIB absolute only if needed to avoid problems with the amd.
                     34: case $LIB in
                     35: /*)
                     36:        ;;
                     37: *)
                     38:        cd $LIB; LIB=`${PWDCMD}`
                     39:        ;;
                     40: esac
                     41: 
1.1       root       42: # Fail if no arg to specify a directory for the output.
                     43: if [ x$1 = x ]
                     44: then echo fixincludes: no output directory specified
                     45: exit 1
                     46: fi
                     47: 
1.1.1.4   root       48: echo Building fixed headers in ${LIB}
1.1       root       49: 
                     50: # Determine whether this system has symbolic links.
                     51: if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
                     52:   rm -f $LIB/ShouldNotExist
                     53:   LINKS=true
1.1.1.6   root       54: elif ln -s X /tmp/ShouldNotExist 2>/dev/null; then
                     55:   rm -f /tmp/ShouldNotExist
                     56:   LINKS=true
1.1       root       57: else
                     58:   LINKS=false
                     59: fi
                     60: 
1.1.1.4   root       61: echo Finding directories and links to directories
1.1       root       62: cd ${INPUT}
1.1.1.2   root       63: # Find all directories and all symlinks that point to directories.
1.1.1.4   root       64: # Put the list in $files.
                     65: # Each time we find a symlink, add it to newdirs
                     66: # so that we do another find within the dir the link points to.
                     67: # Note that $files may have duplicates in it;
                     68: # later parts of this file are supposed to ignore them.
                     69: dirs="."
                     70: levels=2
                     71: while [ -n "$dirs" ] && [ $levels -gt 0 ]
                     72: do
                     73:     levels=`expr $levels - 1`
                     74:     newdirs=
                     75:     for d in $dirs
                     76:     do
                     77:        echo " Searching $INPUT/$d"
                     78:        if [ "$d" != . ]
                     79:        then
                     80:            d=$d/.
                     81:        fi
                     82: 
                     83:        # Find all directories under $d, relative to $d, excluding $d itself.
                     84:         files="$files `find $d -type d -print | \
                     85:                       sed -e '/\/\.$/d' -e '/^\.$/d'`"
                     86:        # Find all links to directories.
                     87:        # Using `-exec test -d' in find fails on some systems,
                     88:        # and trying to run test via sh fails on others,
                     89:        # so this is the simplest alternative left.
                     90:        # First find all the links, then test each one.
                     91:        theselinks=
                     92:        $LINKS && \
                     93:          theselinks=`find $d -type l -print`
                     94:        for d1 in $theselinks --dummy--
                     95:        do
                     96:            # If the link points to a directory,
                     97:            # add that dir to $newdirs
                     98:            if [ -d $d1 ]
                     99:            then
1.1.1.7   root      100:                files="$files $d1"
                    101:                if [ "`ls -ld $d1 | sed -n 's/.*-> //p'`" != "." ]
                    102:                then
                    103:                    newdirs="$newdirs $d1"
                    104:                fi
1.1.1.4   root      105:            fi
                    106:        done
                    107:     done
                    108: 
                    109:     dirs="$newdirs"
                    110: done
                    111: 
                    112: dirs=
                    113: echo "All directories (including links to directories):"
                    114: echo $files
                    115: 
1.1       root      116: for file in $files; do
                    117:   rm -rf $LIB/$file
                    118:   if [ ! -d $LIB/$file ]
                    119:   then mkdir $LIB/$file
                    120:   fi
                    121: done
1.1.1.4   root      122: mkdir $LIB/root
1.1       root      123: 
                    124: # treetops gets an alternating list
                    125: # of old directories to copy
                    126: # and the new directories to copy to.
                    127: treetops="${INPUT} ${LIB}"
                    128: 
                    129: if $LINKS; then
1.1.1.4   root      130:   echo 'Making symbolic directory links'
1.1       root      131:   for file in $files; do
                    132:     dest=`ls -ld $file | sed -n 's/.*-> //p'`
                    133:     if [ "$dest" ]; then    
1.1.1.4   root      134:       cwd=`${PWDCMD}`
1.1       root      135:       # In case $dest is relative, get to $file's dir first.
                    136:       cd ${INPUT}
                    137:       cd `echo ./$file | sed -n 's&[^/]*$&&p'`
                    138:       # Check that the target directory exists.
                    139:       # Redirections changed to avoid bug in sh on Ultrix.
                    140:       (cd $dest) > /dev/null 2>&1
                    141:       if [ $? = 0 ]; then
                    142:        cd $dest
                    143:        # X gets the dir that the link actually leads to.
1.1.1.4   root      144:        x=`${PWDCMD}`
1.1.1.7   root      145:        # Canonicalize ${INPUT} now to minimize the time an
                    146:        # automounter has to change the result of ${PWDCMD}.
                    147:        cinput=`cd ${INPUT}; ${PWDCMD}`
1.1.1.4   root      148:        # If a link points to ., make a similar link to .
1.1.1.7   root      149:        if [ $x = ${cinput} ]; then
1.1.1.4   root      150:          echo $file '->' . ': Making link'
                    151:          rm -fr ${LIB}/$file > /dev/null 2>&1
                    152:          ln -s . ${LIB}/$file > /dev/null 2>&1
1.1       root      153:        # If link leads back into ${INPUT},
                    154:        # make a similar link here.
1.1.1.7   root      155:        elif expr $x : "${cinput}/.*" > /dev/null; then
1.1       root      156:          # Y gets the actual target dir name, relative to ${INPUT}.
1.1.1.7   root      157:          y=`echo $x | sed -n "s&${cinput}/&&p"`
1.1.1.6   root      158:          # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
                    159:          dots=`echo "$file" |
                    160:            sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
                    161:          echo $file '->' $dots$y ': Making link'
1.1       root      162:          rm -fr ${LIB}/$file > /dev/null 2>&1
1.1.1.6   root      163:          ln -s $dots$y ${LIB}/$file > /dev/null 2>&1
1.1       root      164:        else
1.1.1.4   root      165:          # If the link is to a dir $target outside ${INPUT},
                    166:          # repoint the link at ${INPUT}/root$target
                    167:          # and process $target into ${INPUT}/root$target
1.1       root      168:          # treat this directory as if it actually contained the files.
1.1.1.4   root      169:          echo $file '->' root$x ': Making link'
                    170:          if [ -d $LIB/root$x ]
                    171:          then true
                    172:          else
                    173:            dirname=root$x/
                    174:            dirmade=.
                    175:            cd $LIB
                    176:            while [ x$dirname != x ]; do
                    177:              component=`echo $dirname | sed -e 's|/.*$||'`
                    178:              mkdir $component >/dev/null 2>&1
                    179:              cd $component
                    180:              dirmade=$dirmade/$component
                    181:              dirname=`echo $dirname | sed -e 's|[^/]*/||'`
                    182:            done
                    183:          fi
1.1.1.5   root      184:          # Duplicate directory structure created in ${LIB}/$file in new
                    185:          # root area.
                    186:          for file2 in $files; do
                    187:            case $file2 in
                    188:              $file/./*)
                    189:                dupdir=${LIB}/root$x/`echo $file2 | sed -n "s|^${file}/||p"`
                    190:                echo "Duplicating ${file}'s ${dupdir}"
                    191:                if [ -d ${dupdir} ]
                    192:                then true
                    193:                else
                    194:                  mkdir ${dupdir}
                    195:                fi
                    196:                ;;
                    197:              *)
                    198:                ;;
                    199:            esac
                    200:           done
1.1.1.7   root      201:          # Get the path from ${LIB} to $file, accounting for symlinks.
                    202:          parent=`echo "$file" | sed -e 's@/[^/]*$@@'`
                    203:          libabs=`cd ${LIB}; ${PWDCMD}`
                    204:          file2=`cd ${LIB}; cd $parent; ${PWDCMD} | sed -e "s@^${libabs}@@"`
1.1.1.6   root      205:          # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
1.1.1.7   root      206:          dots=`echo "$file2" | sed -e 's@/[^/]*@../@g'`
1.1.1.4   root      207:          rm -fr ${LIB}/$file > /dev/null 2>&1
1.1.1.6   root      208:          ln -s ${dots}root$x ${LIB}/$file > /dev/null 2>&1
1.1.1.4   root      209:          treetops="$treetops $x ${LIB}/root$x"
1.1       root      210:        fi
                    211:       fi
                    212:       cd $cwd
                    213:     fi
                    214:   done
                    215: fi
                    216: 
1.1.1.6   root      217: required=
1.1.1.5   root      218: set x $treetops
                    219: shift
1.1       root      220: while [ $# != 0 ]; do
                    221:   # $1 is an old directory to copy, and $2 is the new directory to copy to.
                    222:   cd ${INPUT}
                    223:   cd $1
1.1.1.4   root      224: # The same dir can appear more than once in treetops.
                    225: # There's no need to scan it more than once.
                    226:   if [ -f $2/DONE ]
                    227:   then
                    228:     files=
                    229:   else
                    230:     touch $2/DONE
                    231:     echo Fixing directory $1 into $2
                    232: # Check .h files which are symlinks as well as those which are files.
                    233: # A link to a header file will not be processed by anything but this.
                    234:     if $LINKS; then
                    235:       files=`find . -name '*.h' \( -type f -o -type l \) -print`
                    236:     else
                    237:       files=`find . -name '*.h' -type f -print`
                    238:     fi
                    239:     echo Checking header files
                    240:   fi
1.1       root      241: # Note that BSD43_* are used on recent MIPS systems.
                    242:   for file in $files; do
                    243: # This call to egrep is essential, since checking a file with egrep
                    244: # is much faster than actually trying to fix it.
1.1.1.2   root      245: # It is also essential that most files *not* match!
                    246: # Thus, matching every #endif is unacceptable.
1.1       root      247: # But the argument to egrep must be kept small, or many versions of egrep
                    248: # won't be able to handle it.
1.1.1.5   root      249: #
                    250: # We use the pattern [!-.0-~] instead of [^/   ] to match a noncomment
                    251: # following #else or #endif because some buggy egreps think [^/] matches
                    252: # newline, and they thus think `#else ' matches `#e[ndiflse]*[         ]+[^/   ]'.
                    253: #
                    254: # We use the pattern [^a-zA-Z0-9_][_a-ce-km-z][a-z0-9] to match an identifier
                    255: # following #if or #elif that is not surrounded by __.  The `a-ce-km-z'
                    256: # in this pattern lacks `d' and `l'; this means we don't worry about
                    257: # identifiers starting with `d' or `l'.  This is OK, since none of the
                    258: # identifiers below start with `d' or `l'.  It also greatly improves
                    259: # performance, since many files contain lines of the form `#if ... defined ...'
                    260: # or `#if lint'.
1.1.1.7   root      261:     if egrep '//|[     _]_IO|CTRL|^#define.NULL|^#e[nl][ds][ief]*[     ]+[!-.0-~]|^#[el]*if.*[^a-zA-Z0-9_][_a-ce-km-zA-Z][a-zA-Z0-9]' $file >/dev/null; then
1.1       root      262:       if [ -r $file ]; then
                    263:        cp $file $2/$file >/dev/null 2>&1       \
                    264:        || echo "Can't copy $file"
                    265:        chmod +w $2/$file
1.1.1.5   root      266:        chmod a+r $2/$file
                    267:        # Here is how the sed commands in braces work.
                    268:        # (It doesn't work to put the comments inside the sed commands.)
                    269:                # Surround each word with spaces, to simplify matching below.
                    270:                # ANSIfy each pre-ANSI machine-dependent symbol
                    271:                # by surrounding it with __ __.
                    272:                # Remove the spaces that we inserted around each word.
1.1       root      273:        sed -e '
                    274:                                   :loop
                    275:          /\\$/                 N
                    276:          /\\$/                 b loop
1.1.1.6   root      277:          s%^\([        ]*#[    ]*else\)[       ]*/[^*].*%\1%
                    278:          s%^\([        ]*#[    ]*else\)[       ]*[^/   ].*%\1%
                    279:          s%^\([        ]*#[    ]*endif\)[      ]*/[^*].*%\1%
                    280:          s%^\([        ]*#[    ]*endif\)[      ]*\*[^/].*%\1%
                    281:          s%^\([        ]*#[    ]*endif\)[      ]*[^/*  ].*%\1%
1.1.1.5   root      282:          /\/\/[^*]/                    s|//\(.*\)$|/*\1*/|
                    283:          /[    ]_IO[A-Z]*[     ]*(/    s/\(_IO[A-Z]*[  ]*(\)\(.\),/\1'\''\2'\'',/
1.1       root      284:          /[    ]BSD43__IO[A-Z]*[       ]*(/    s/(\(.\),/('\''\1'\'',/
1.1.1.6   root      285:          /#define._IO/                 s/'\''\([cgxtf]\)'\''/\1/g
1.1.1.5   root      286:          /#define.BSD43__IO/           s/'\''\([cgx]\)'\''/\1/g
                    287:          /[^A-Z0-9_]CTRL[      ]*(/            s/\([^'\'']\))/'\''\1'\'')/
                    288:          /[^A-Z0-9]_CTRL[      ]*(/            s/\([^'\'']\))/'\''\1'\'')/
1.1.1.6   root      289:          /#define[     ]*[     ]CTRL/          s/'\''\([cgx]\)'\''/\1/g
                    290:          /#define[     ]*[     ]_CTRL/         s/'\''\([cgx]\)'\''/\1/g
1.1.1.5   root      291:          /#define.BSD43_CTRL/          s/'\''\([cgx]\)'\''/\1/g
1.1.1.8 ! root      292:          /#[    ]*[el]*if/{
1.1.1.5   root      293:                s/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g
                    294: 
                    295:                s/ bsd4\([0-9]\) / __bsd4\1__ /g
1.1.1.7   root      296:                s/ _*host_mips / __host_mips__ /g
1.1.1.5   root      297:                s/ _*i386 / __i386__ /g
1.1.1.7   root      298:                s/ M32 / __M32__ /g
1.1.1.5   root      299:                s/ is68k / __is68k__ /g
                    300:                s/ m68k / __m68k__ /g
                    301:                s/ mc680\([0-9]\)0 / __mc680\10__ /g
1.1.1.7   root      302:                s/ m88k / __m88k__ /g
                    303:                s/ _*mips / __mips__ /g
1.1.1.5   root      304:                s/ news\([0-9]*\) / __news\1__ /g
                    305:                s/ ns32000 / __ns32000__ /g
1.1.1.7   root      306:                s/ pdp11 / __pdp11__ /g
1.1.1.5   root      307:                s/ pyr / __pyr__ /g
1.1.1.8 ! root      308:                s/ sel / __sel__ /g
1.1.1.5   root      309:                s/ sony_news / __sony_news__ /g
                    310:                s/ sparc / __sparc__ /g
                    311:                s/ sun\([a-z0-9]*\) / __sun\1__ /g
1.1.1.8 ! root      312:                s/ tahoe / __tahoe__ /g
1.1.1.7   root      313:                s/ tower\([_0-9]*\) / __tower\1__ /g
                    314:                s/ u370 / __u370__ /g
                    315:                s/ u3b\([0-9]*\) / __u3b\1__ /g
1.1.1.5   root      316:                s/ unix / __unix__ /g
                    317:                s/ vax / __vax__ /g
1.1.1.7   root      318:                s/ _*MIPSE\([LB]\) / __MIPSE\1__ /g
1.1.1.8 ! root      319:                s/ _*\([Rr][34]\)000 / __\1000__ /g
1.1.1.7   root      320:                s/ _*SYSTYPE_\([A-Z0-9]*\) / __SYSTYPE_\1__ /g
1.1.1.5   root      321: 
                    322:                s/ \([a-zA-Z0-9_][a-zA-Z0-9_]*\) /\1/g
                    323:          }
1.1.1.3   root      324:          /^#define.NULL[       ]/      i\
1.1       root      325:                #undef NULL
1.1.1.5   root      326:        ' $2/$file > $2/$file.
                    327:        mv $2/$file. $2/$file
1.1.1.7   root      328:        if cmp $file $2/$file >/dev/null 2>&1 \
                    329:            || egrep 'This file is part of the GNU C Library' $2/$file >/dev/null 2>&1; then
1.1       root      330:           rm $2/$file
1.1.1.5   root      331:        else
                    332:           echo Fixed $file
1.1.1.6   root      333:           # Find any include directives that use "file".
                    334:           for include in `egrep '^[    ]*#[    ]*include[      ]*"[^/]' $2/$file | sed -e 's/^[        ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    335:              dir=`echo $file | sed -e s'|/[^/]*$||'`
                    336:              required="$required $1 $dir/$include $2/$dir/$include"
                    337:           done
1.1       root      338:        fi
                    339:       fi
                    340:     fi
                    341:   done
                    342:   shift; shift
                    343: done
                    344: 
                    345: cd ${INPUT}
                    346: 
1.1.1.7   root      347: # Install the proper definition of the three standard types in header files
                    348: # that they come from.
                    349: for file in sys/types.h stdlib.h sys/stdtypes.h stddef.h memory.h unistd.h; do
1.1.1.5   root      350:   if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    351:     cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    352:     chmod +w ${LIB}/$file 2>/dev/null
                    353:     chmod a+r ${LIB}/$file 2>/dev/null
                    354:   fi
                    355: 
                    356:   if [ -r ${LIB}/$file ]; then
1.1.1.7   root      357:     echo Fixing size_t, ptrdiff_t and wchar_t in $file
                    358:     sed \
                    359:       -e '/typedef[    ][      ]*[a-z_][       a-z_]*[         ]size_t/i\
                    360: #ifndef __SIZE_TYPE__\
                    361: #define __SIZE_TYPE__ long unsigned int\
                    362: #endif
                    363: ' \
                    364:       -e 's/typedef[   ][      ]*[a-z_][       a-z_]*[         ]size_t/typedef __SIZE_TYPE__ size_t/' \
                    365:       -e '/typedef[    ][      ]*[a-z_][       a-z_]*[         ]ptrdiff_t/i\
                    366: #ifndef __PTRDIFF_TYPE__\
                    367: #define __PTRDIFF_TYPE__ long int\
                    368: #endif
                    369: ' \
                    370:       -e 's/typedef[   ][      ]*[a-z_][       a-z_]*[         ]ptrdiff_t/typedef __PTRDIFF_TYPE__ ptrdiff_t/' \
                    371:       -e '/typedef[    ][      ]*[a-z_][       a-z_]*[         ]wchar_t/i\
                    372: #ifndef __WCHAR_TYPE__\
                    373: #define __WCHAR_TYPE__ int\
1.1.1.8 ! root      374: #endif\
        !           375: #ifndef __cplusplus
        !           376: ' \
        !           377:       -e '/typedef[    ][      ]*[a-z_][       a-z_]*[         ]wchar_t/a\
1.1.1.7   root      378: #endif
                    379: ' \
                    380:       -e 's/typedef[   ][      ]*[a-z_][       a-z_]*[         ]wchar_t/typedef __WCHAR_TYPE__ wchar_t/' \
                    381:       ${LIB}/$file > ${LIB}/${file}.sed
1.1.1.5   root      382:     rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    383:     if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    384:       rm ${LIB}/$file
1.1.1.7   root      385:     else
                    386:       # Find any include directives that use "file".
                    387:       for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    388:         dir=`echo $file | sed -e s'|/[^/]*$||'`
                    389:         required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    390:       done
1.1.1.5   root      391:     fi
                    392:   fi
                    393: done
                    394: 
1.1       root      395: # Fix one other error in this file: a mismatched quote not inside a C comment.
                    396: file=sundev/vuid_event.h
1.1.1.2   root      397: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    398:   mkdir ${LIB}/sundev 2>/dev/null
                    399:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    400:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root      401:   chmod a+r ${LIB}/$file 2>/dev/null
1.1       root      402: fi
                    403: 
                    404: if [ -r ${LIB}/$file ]; then
                    405:   echo Fixing $file comment
1.1.1.5   root      406:   sed -e "s/doesn't/does not/" ${LIB}/$file > ${LIB}/${file}.sed
                    407:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    408:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    409:     rm ${LIB}/$file
1.1.1.7   root      410:   else
                    411:     # Find any include directives that use "file".
                    412:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    413:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                    414:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    415:     done
1.1.1.5   root      416:   fi
                    417: fi
                    418: 
                    419: # Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
                    420: file=sunwindow/win_cursor.h
                    421: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    422: #  mkdir ${LIB}/sunwindow 2>/dev/null
                    423:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    424:   chmod +w ${LIB}/$file 2>/dev/null
                    425: fi
                    426: if [ -r ${LIB}/$file ]; then
                    427:   echo Fixing $file
                    428:   sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.sed
                    429:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    430:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    431:     rm ${LIB}/$file
1.1.1.7   root      432:   else
                    433:     # Find any include directives that use "file".
                    434:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    435:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                    436:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    437:     done
1.1.1.5   root      438:   fi
                    439: fi
                    440: file=sunwindow/win_lock.h
                    441: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    442: #  mkdir ${LIB}/sunwindow 2>/dev/null
                    443:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    444:   chmod +w ${LIB}/$file 2>/dev/null
                    445: fi
                    446: if [ -r ${LIB}/$file ]; then
                    447:   echo Fixing $file
                    448:   sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.sed
                    449:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1       root      450:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    451:     rm ${LIB}/$file
1.1.1.7   root      452:   else
                    453:     # Find any include directives that use "file".
                    454:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    455:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                    456:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    457:     done
1.1       root      458:   fi
                    459: fi
                    460: 
1.1.1.3   root      461: # Fix this Sun file to avoid interfering with stddef.h.
1.1       root      462: file=sys/stdtypes.h
1.1.1.2   root      463: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    464:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    465:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root      466:   chmod a+r ${LIB}/$file 2>/dev/null
1.1       root      467: fi
                    468: 
                    469: if [ -r ${LIB}/$file ]; then
1.1.1.2   root      470:   echo Fixing $file
1.1.1.6   root      471: sed -e '/[      ]size_t.*;/i\
1.1.1.5   root      472: #ifndef _GCC_SIZE_T\
1.1.1.7   root      473: #define _GCC_SIZE_T
                    474: ' \
1.1.1.6   root      475:     -e '/[      ]size_t.*;/a\
1.1.1.7   root      476: #endif
                    477: ' \
1.1.1.6   root      478:     -e '/[      ]ptrdiff_t.*;/i\
1.1.1.5   root      479: #ifndef _GCC_PTRDIFF_T\
1.1.1.7   root      480: #define _GCC_PTRDIFF_T
                    481: ' \
1.1.1.6   root      482:     -e '/[      ]ptrdiff_t.*;/a\
1.1.1.7   root      483: #endif
                    484: ' \
1.1.1.6   root      485:     -e '/[      ]wchar_t.*;/i\
1.1.1.5   root      486: #ifndef _GCC_WCHAR_T\
1.1.1.7   root      487: #define _GCC_WCHAR_T
                    488: ' \
1.1.1.6   root      489:     -e '/[      ]wchar_t.*;/a\
1.1.1.7   root      490: #endif
                    491: ' ${LIB}/$file > ${LIB}/${file}.sed
1.1.1.5   root      492:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1       root      493:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    494:     rm ${LIB}/$file
1.1.1.7   root      495:   else
                    496:     # Find any include directives that use "file".
                    497:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    498:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                    499:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    500:     done
1.1       root      501:   fi
                    502: fi
                    503: 
1.1.1.6   root      504: # Fix this ARM/RISCiX file to avoid interfering with the use of __wchar_t
                    505: # in cc1plus.
                    506: file=stdlib.h
                    507: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    508:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    509:   chmod +w ${LIB}/$file 2>/dev/null
                    510:   chmod a+r ${LIB}/$file 2>/dev/null
                    511: fi
                    512: 
                    513: if [ -r ${LIB}/$file ]; then
                    514:   echo Fixing $file
                    515:   sed -e "s/\(#[       ]*ifndef[       ]*\)__wchar_t/\1_GCC_WCHAR_T/" \
                    516:       -e "s/\(#[       ]*define[       ]*\)__wchar_t/\1_GCC_WCHAR_T/" \
                    517:      ${LIB}/$file > ${LIB}/${file}.sed
                    518:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    519:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    520:     rm ${LIB}/$file
1.1.1.7   root      521:   else
                    522:     # Find any include directives that use "file".
                    523:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    524:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                    525:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    526:     done
                    527:   fi
                    528: fi
                    529: 
                    530: # Fix this ARM/RISCiX file where ___type is a Compiler hint that is specific to
                    531: # the Norcroft compiler.
                    532: file=X11/Intrinsic.h
                    533: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    534:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    535:   chmod +w ${LIB}/$file 2>/dev/null
                    536:   chmod a+r ${LIB}/$file 2>/dev/null
                    537: fi
                    538: 
                    539: if [ -r ${LIB}/$file ]; then
                    540:   echo Fixing $file
                    541:   sed -e "s/___type p_type/p_type/" \
                    542:      ${LIB}/$file > ${LIB}/${file}.sed
                    543:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    544:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    545:     rm ${LIB}/$file
                    546:   else
                    547:     # Find any include directives that use "file".
                    548:     for include in `egrep '^[         ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    549:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                    550:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    551:     done
1.1.1.6   root      552:   fi
                    553: fi
                    554: 
1.1.1.4   root      555: # Fix this file to avoid interfering with stddef.h, but don't mistakenly
1.1.1.7   root      556: # match ssize_t present in AIX for the ps/2, or typedefs which use (but do not
                    557: # set) size_t.
1.1       root      558: file=sys/types.h
1.1.1.2   root      559: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    560:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    561:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root      562:   chmod a+r ${LIB}/$file 2>/dev/null
1.1       root      563: fi
                    564: 
                    565: if [ -r ${LIB}/$file ]; then
1.1.1.2   root      566:   echo Fixing $file
1.1.1.7   root      567: sed -e '/typedef[      ][      ]*[A-Za-z_][    A-Za-z_]*[      ]size_t/i\
1.1.1.5   root      568: #ifndef _GCC_SIZE_T\
1.1.1.7   root      569: #define _GCC_SIZE_T
                    570: ' \
                    571:     -e '/typedef[      ][      ]*[A-Za-z_][    A-Za-z_]*[      ]size_t/a\
                    572: #endif
                    573: ' ${LIB}/$file > ${LIB}/${file}.sed
1.1.1.5   root      574:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1       root      575:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    576:     rm ${LIB}/$file
1.1.1.7   root      577:   else
                    578:     # Find any include directives that use "file".
                    579:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    580:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                    581:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    582:     done
1.1       root      583:   fi
                    584: fi
                    585: 
1.1.1.6   root      586: # Fix HP's use of ../machine/inline.h to refer to
                    587: # /usr/include/machine/inline.h
                    588: file=sys/spinlock.h
                    589: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    590:   cp $file ${LIB}/$file
                    591: fi
                    592: if [ -r ${LIB}/$file ] ; then
                    593:   echo Fixing $file
                    594:   sed -e 's,"../machine/inline.h",<machine/inline.h>,' \
                    595:     -e 's,"../machine/psl.h",<machine/psl.h>,' \
                    596:   ${LIB}/$file > ${LIB}/${file}.sed
                    597:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    598:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    599:     rm ${LIB}/$file
1.1.1.7   root      600:   else
                    601:     # Find any include directives that use "file".
                    602:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    603:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                    604:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    605:     done
1.1.1.6   root      606:   fi
                    607: fi
                    608: 
1.1.1.4   root      609: # Fix an error in this file: the #if says _cplusplus, not the double
                    610: # underscore __cplusplus that it should be
                    611: file=tinfo.h
                    612: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    613:   mkdir ${LIB}/rpcsvc 2>/dev/null
                    614:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    615:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root      616:   chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.4   root      617: fi
                    618: 
                    619: if [ -r ${LIB}/$file ]; then
                    620:   echo Fixing $file, __cplusplus macro
                    621:   sed -e 's/[  ]_cplusplus/ __cplusplus/' ${LIB}/$file > ${LIB}/${file}.sed
                    622:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    623:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    624:     rm ${LIB}/$file
1.1.1.7   root      625:   else
                    626:     # Find any include directives that use "file".
                    627:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    628:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                    629:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    630:     done
1.1.1.4   root      631:   fi
                    632: fi
                    633: 
1.1       root      634: # Fix an error in this file: a missing semi-colon at the end of the statsswtch
                    635: # structure definition.
                    636: file=rpcsvc/rstat.h
1.1.1.2   root      637: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    638:   mkdir ${LIB}/rpcsvc 2>/dev/null
                    639:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    640:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root      641:   chmod a+r ${LIB}/$file 2>/dev/null
1.1       root      642: fi
                    643: 
                    644: if [ -r ${LIB}/$file ]; then
                    645:   echo Fixing $file, definition of statsswtch
1.1.1.5   root      646:   sed -e 's/boottime$/boottime;/' ${LIB}/$file > ${LIB}/${file}.sed
                    647:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1       root      648:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    649:     rm ${LIB}/$file
1.1.1.7   root      650:   else
                    651:     # Find any include directives that use "file".
                    652:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    653:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                    654:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    655:     done
1.1       root      656:   fi
                    657: fi
                    658: 
                    659: # Fix an error in this file: a missing semi-colon at the end of the nodeent
                    660: # structure definition.
                    661: file=netdnet/dnetdb.h
1.1.1.2   root      662: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    663:   mkdir ${LIB}/netdnet 2>/dev/null
                    664:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    665:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root      666:   chmod a+r ${LIB}/$file 2>/dev/null
1.1       root      667: fi
                    668: 
                    669: if [ -r ${LIB}/$file ]; then
                    670:   echo Fixing $file, definition of nodeent
1.1.1.5   root      671:   sed -e 's/char.*na_addr *$/char *na_addr;/' ${LIB}/$file > ${LIB}/${file}.sed
                    672:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1       root      673:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    674:     rm ${LIB}/$file
1.1.1.7   root      675:   else
                    676:     # Find any include directives that use "file".
                    677:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    678:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                    679:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    680:     done
1.1       root      681:   fi
                    682: fi
                    683: 
                    684: # Check for bad #ifdef line (in Ultrix 4.1)
                    685: file=sys/file.h
1.1.1.2   root      686: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    687:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    688:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root      689:   chmod a+r ${LIB}/$file 2>/dev/null
1.1       root      690: fi
                    691: 
                    692: if [ -r ${LIB}/$file ]; then
                    693:   echo Fixing $file, bad \#ifdef line
1.1.1.5   root      694:   sed -e 's/#ifdef KERNEL/#if defined(KERNEL)/' ${LIB}/$file > ${LIB}/${file}.sed
                    695:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1       root      696:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    697:     rm ${LIB}/$file
1.1.1.7   root      698:   else
                    699:     # Find any include directives that use "file".
                    700:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    701:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                    702:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    703:     done
1.1       root      704:   fi
                    705: fi
                    706: 
1.1.1.8 ! root      707: # Check for (...) in C++ code in HP/UX sys/file.h.
        !           708: file=sys/file.h
        !           709: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !           710:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !           711:   chmod +w ${LIB}/$file 2>/dev/null
        !           712:   chmod a+r ${LIB}/$file 2>/dev/null
        !           713: fi
        !           714: 
        !           715: if [ -r ${LIB}/$file ]; then
        !           716:   if egrep HPUX_SOURCE ${LIB}/$file > /dev/null; then
        !           717:     echo Fixing $file, use of '(...)'
        !           718:     sed -e 's/(\.\.\.)/(struct file * ...)/' ${LIB}/$file > ${LIB}/${file}.sed
        !           719:     rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !           720:     if cmp $file ${LIB}/$file >/dev/null 2>&1; then
        !           721:       rm ${LIB}/$file
        !           722:     else
        !           723:       # Find any include directives that use "file".
        !           724:       for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
        !           725:        dir=`echo $file | sed -e s'|/[^/]*$||'`
        !           726:        required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
        !           727:       done
        !           728:     fi
        !           729:   fi
        !           730: fi
        !           731: 
1.1.1.2   root      732: # Check for superfluous `static' (in Ultrix 4.2)
1.1.1.7   root      733: # On Ultrix 4.3, includes of other files (r3_cpu.h,r4_cpu.h) is broken.
1.1       root      734: file=machine/cpu.h
1.1.1.2   root      735: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    736:   mkdir ${LIB}/machine 2>/dev/null
                    737:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    738:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root      739:   chmod a+r ${LIB}/$file 2>/dev/null
1.1       root      740: fi
                    741: 
                    742: if [ -r ${LIB}/$file ]; then
1.1.1.7   root      743:   echo Fixing $file, superfluous static and broken includes of other files.
                    744:   sed -e 's/^static struct tlb_pid_state/struct tlb_pid_state/' \
                    745:       -e 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/' \
                    746:       -e 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/' \
                    747:       ${LIB}/$file > ${LIB}/${file}.sed
1.1.1.5   root      748:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1       root      749:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    750:     rm ${LIB}/$file
                    751:   else
1.1.1.7   root      752:     # Find any include directives that use "file".
                    753:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    754:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                    755:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    756:     done
1.1       root      757: # This file has an alternative name, mips/cpu.h.  Fix that name, too.
1.1.1.6   root      758:     if cmp machine/cpu.h mips/cpu.h > /dev/null 2>&1; then
1.1       root      759:       mkdir ${LIB}/mips 2>&-
1.1.1.7   root      760: # Don't remove the file first, they may be the same file!
                    761:       ln ${LIB}/$file ${LIB}/mips/cpu.h > /dev/null 2>&1
1.1       root      762:     fi
                    763:   fi
                    764: fi
                    765: 
1.1.1.2   root      766: # Incorrect sprintf declaration in X11/Xmu.h
1.1       root      767: file=X11/Xmu.h
1.1.1.2   root      768: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    769:   mkdir ${LIB}/X11 2>/dev/null
                    770:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    771:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root      772:   chmod a+r ${LIB}/$file 2>/dev/null
1.1       root      773: fi
                    774: 
                    775: if [ -r ${LIB}/$file ]; then
                    776:   echo Fixing $file sprintf declaration
1.1.1.5   root      777:   sed -e 's,^extern char \*    sprintf();$,#ifndef __STDC__\
                    778: extern char *  sprintf();\
                    779: #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.sed
                    780:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1       root      781:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    782:     rm ${LIB}/$file
1.1.1.7   root      783:   else
                    784:     # Find any include directives that use "file".
                    785:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    786:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                    787:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    788:     done
1.1       root      789:   fi
                    790: fi
                    791: 
1.1.1.4   root      792: # Incorrect sprintf declaration in X11/Xmu/Xmu.h
                    793: # (It's not clear whether the right file name is this or X11/Xmu.h.)
                    794: file=X11/Xmu/Xmu.h
                    795: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    796:   mkdir ${LIB}/X11/Xmu 2>/dev/null
                    797:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    798:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root      799:   chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.4   root      800: fi
                    801: 
                    802: if [ -r ${LIB}/$file ]; then
                    803:   echo Fixing $file sprintf declaration
1.1.1.5   root      804:   sed -e 's,^extern char \*    sprintf();$,#ifndef __STDC__\
                    805: extern char *  sprintf();\
                    806: #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.sed
                    807:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1.1.4   root      808:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    809:     rm ${LIB}/$file
1.1.1.7   root      810:   else
                    811:     # Find any include directives that use "file".
                    812:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    813:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                    814:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    815:     done
1.1.1.4   root      816:   fi
                    817: fi
                    818: 
1.1       root      819: # Check for missing ';' in struct
                    820: file=netinet/ip.h
1.1.1.2   root      821: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    822:   mkdir ${LIB}/netinet 2>/dev/null
                    823:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    824:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root      825:   chmod a+r ${LIB}/$file 2>/dev/null
1.1       root      826: fi
                    827: 
1.1.1.2   root      828: if [ -r ${LIB}/$file ]; then
                    829:   echo Fixing $file
                    830:   sed -e '/^struct/,/^};/s/}$/};/' ${LIB}/$file > ${LIB}/${file}.sed
                    831:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    832:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    833:     rm -f ${LIB}/$file
1.1.1.7   root      834:   else
                    835:     # Find any include directives that use "file".
                    836:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    837:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                    838:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    839:     done
1.1.1.2   root      840:   fi
                    841: fi
1.1       root      842: 
1.1.1.2   root      843: # Fix the CAT macro in SunOS memvar.h.
1.1       root      844: file=pixrect/memvar.h
1.1.1.2   root      845: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    846:   mkdir ${LIB}/pixrect 2>/dev/null
                    847:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    848:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root      849:   chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.2   root      850: fi
                    851: 
                    852: if [ -r ${LIB}/$file ]; then
                    853:   echo Fixing $file
                    854:   sed -e '/^#define.CAT(a,b)/ i\
1.1       root      855: #ifdef __STDC__ \
                    856: #define CAT(a,b) a##b\
                    857: #else
                    858: /^#define.CAT(a,b)/ a\
                    859: #endif
1.1.1.2   root      860: ' ${LIB}/$file > ${LIB}/${file}.sed
                    861:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    862:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    863:     rm -f ${LIB}/$file
1.1.1.7   root      864:   else
                    865:     # Find any include directives that use "file".
                    866:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    867:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                    868:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    869:     done
1.1       root      870:   fi
                    871: fi
                    872: 
                    873: # Check for yet more missing ';' in struct (in SunOS 4.0.x)
                    874: file=rpcsvc/rusers.h
1.1.1.2   root      875: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    876:   mkdir ${LIB}/rpcsvc 2>/dev/null
                    877:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    878:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root      879:   chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.2   root      880: fi
                    881: 
                    882: if [ -r ${LIB}/$file ]; then
                    883:   echo Fixing $file
                    884:   sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' ${LIB}/$file > ${LIB}/${file}.sed
                    885:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    886:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    887:     rm -f ${LIB}/$file
1.1.1.7   root      888:   else
                    889:     # Find any include directives that use "file".
                    890:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    891:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                    892:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    893:     done
1.1       root      894:   fi
                    895: fi
                    896: 
                    897: # Fix return type of exit and abort in <stdlib.h> on SunOS 4.1.
1.1.1.6   root      898: # Also wrap protection around size_t for m88k-sysv3 systems.
1.1       root      899: file=stdlib.h
1.1.1.2   root      900: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    901:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    902:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root      903:   chmod a+r ${LIB}/$file 2>/dev/null
1.1       root      904: fi
1.1.1.2   root      905: 
                    906: if [ -r ${LIB}/$file ]; then
                    907:   echo Fixing $file
                    908:   sed -e 's/int        abort/void      abort/g' \
1.1.1.3   root      909:   -e 's/int    free/void       free/g' \
1.1.1.8 ! root      910:   -e 's/char[  ]*\*[   ]*calloc/void \*        calloc/g' \
        !           911:   -e 's/char[  ]*\*[   ]*malloc/void \*        malloc/g' \
        !           912:   -e 's/char[  ]*\*[   ]*realloc/void \*       realloc/g' \
        !           913:   -e 's/int[   ][      ]*exit/void     exit/g' \
1.1.1.6   root      914:   -e '/typedef[        a-zA-Z_]*[      ]size_t[        ]*;/i\
                    915: #ifndef _GCC_SIZE_T\
1.1.1.7   root      916: #define _GCC_SIZE_T
                    917: ' \
1.1.1.6   root      918:   -e '/typedef[        a-zA-Z_]*[      ]size_t[        ]*;/a\
1.1.1.7   root      919: #endif
                    920: ' \
1.1.1.6   root      921:       ${LIB}/$file > ${LIB}/${file}.sed
1.1.1.2   root      922:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    923:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1.1       root      924:     rm -f ${LIB}/$file
1.1.1.7   root      925:   else
                    926:     # Find any include directives that use "file".
                    927:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    928:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                    929:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    930:     done
1.1       root      931:   fi
                    932: fi
                    933: 
1.1.1.3   root      934: # Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
1.1.1.8 ! root      935: # Also fix return type of {m,re}alloc in <malloc.h> on sysV68
1.1.1.3   root      936: file=malloc.h
                    937: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    938:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    939:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root      940:   chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.3   root      941: fi
                    942: 
                    943: if [ -r ${LIB}/$file ]; then
                    944:   echo Fixing $file
                    945:   sed -e 's/typedef[   ]char \*        malloc_t/typedef void \*        malloc_t/g' \
                    946:   -e 's/int[   ][      ]*free/void     free/g' \
1.1.1.8 ! root      947:   -e 's/char\([        ]*\*[   ]*malloc\)/void\1/g' \
        !           948:   -e 's/char\([        ]*\*[   ]*realloc\)/void\1/g' \
1.1.1.3   root      949:   ${LIB}/$file > ${LIB}/${file}.sed
                    950:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    951:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    952:     rm -f ${LIB}/$file
1.1.1.7   root      953:   else
                    954:     # Find any include directives that use "file".
                    955:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    956:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                    957:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    958:     done
1.1.1.3   root      959:   fi
                    960: fi
                    961: 
1.1       root      962: # Fix bogus #ifdef in <hsfs/hsfs_spec.h> on SunOS 4.1.
                    963: file=hsfs/hsfs_spec.h
1.1.1.2   root      964: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    965:   mkdir ${LIB}/hsfs 2>/dev/null
                    966:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    967:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root      968:   chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.2   root      969: fi
                    970: 
1.1       root      971: if [ -r ${LIB}/$file ]; then
1.1.1.2   root      972:   echo Fixing $file
                    973:   sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
1.1.1.5   root      974:     ${LIB}/$file > ${LIB}/${file}.
                    975:   rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
1.1.1.2   root      976:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1.1       root      977:     rm -f ${LIB}/$file
1.1.1.7   root      978:   else
                    979:     # Find any include directives that use "file".
                    980:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                    981:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                    982:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                    983:     done
1.1       root      984:   fi
                    985: fi
                    986: 
                    987: # Fix bogus #ifdef in <hsfs/hsnode.h> on SunOS 4.1.
                    988: file=hsfs/hsnode.h
1.1.1.2   root      989: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    990:   mkdir ${LIB}/hsfs 2>/dev/null
                    991:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    992:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root      993:   chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.2   root      994: fi
                    995: 
1.1       root      996: if [ -r ${LIB}/$file ]; then
1.1.1.2   root      997:   echo Fixing $file
                    998:   sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \
                    999:     ${LIB}/$file > ${LIB}/${file}.sed
                   1000:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1001:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1.1       root     1002:     rm -f ${LIB}/$file
1.1.1.7   root     1003:   else
                   1004:     # Find any include directives that use "file".
                   1005:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1006:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1007:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1008:     done
1.1       root     1009:   fi
                   1010: fi
                   1011: 
                   1012: # Fix bogus #ifdef in <hsfs/iso_spec.h> on SunOS 4.1.
                   1013: file=hsfs/iso_spec.h
1.1.1.2   root     1014: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1015:   mkdir ${LIB}/hsfs 2>/dev/null
                   1016:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1017:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root     1018:   chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.2   root     1019: fi
                   1020: 
1.1       root     1021: if [ -r ${LIB}/$file ]; then
1.1.1.2   root     1022:   echo Fixing $file
                   1023:   sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
                   1024:     ${LIB}/$file > ${LIB}/${file}.sed
                   1025:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1026:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1027:     rm -f ${LIB}/$file
1.1.1.7   root     1028:   else
                   1029:     # Find any include directives that use "file".
                   1030:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1031:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1032:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1033:     done
1.1.1.2   root     1034:   fi
                   1035: fi
                   1036: 
                   1037: # Incorrect #include in Sony News-OS 3.2.
                   1038: file=machine/machparam.h
                   1039: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1040:   mkdir ${LIB}/machine 2>/dev/null
                   1041:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1042:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root     1043:   chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.2   root     1044: fi
                   1045: 
                   1046: if [ -r ${LIB}/$file ]; then
                   1047:   echo Fixing $file, incorrect \#include
                   1048:   sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \
1.1.1.5   root     1049:     ${LIB}/$file > ${LIB}/${file}.
                   1050:   rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
1.1.1.2   root     1051:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1052:     rm -f ${LIB}/$file
1.1.1.7   root     1053:   else
                   1054:     # Find any include directives that use "file".
                   1055:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1056:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1057:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1058:     done
1.1.1.2   root     1059:   fi
                   1060: fi
                   1061: 
                   1062: # Multiline comment after typedef on IRIX 4.0.1.
                   1063: file=sys/types.h
                   1064: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1065:   mkdir ${LIB}/sys 2>/dev/null
                   1066:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1067:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root     1068:   chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.2   root     1069: fi
                   1070: 
                   1071: if [ -r ${LIB}/$file ]; then
                   1072:   echo Fixing $file, comment in the middle of \#ifdef
                   1073:   sed -e 's@type of the result@type of the result */@' \
                   1074:     -e 's@of the sizeof@/* of the sizeof@' \
                   1075:     ${LIB}/$file > ${LIB}/${file}.sed
                   1076:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1077:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1.1.1.5   root     1078:     rm -f ${LIB}/$file
1.1.1.7   root     1079:   else
                   1080:     # Find any include directives that use "file".
                   1081:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1082:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1083:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1084:     done
1.1.1.5   root     1085:   fi
                   1086: fi
                   1087: 
                   1088: # Turning // comments into /* */ comments trashes this IRIX 4.0.1
                   1089: # header file, which embeds // comments inside multi-line /* */
                   1090: # comments.  If this looks like the IRIX header file, we refix it by
                   1091: # just throwing away the // comments.
                   1092: file=fam.h
                   1093: if [ -r ${LIB}/$file ]; then
                   1094:   if egrep indigo.esd ${LIB}/$file > /dev/null; then
                   1095:     echo Fixing $file, overeager sed script
                   1096:     rm ${LIB}/$file
                   1097:     sed -e 's|//.*$||g' $file > ${LIB}/$file
                   1098:     chmod +w ${LIB}/$file 2>/dev/null
                   1099:     chmod a+r ${LIB}/$file 2>/dev/null
                   1100:   fi
                   1101: fi
                   1102: 
1.1.1.8 ! root     1103: # There is a similar problem with the VxWorks drv/netif/if_med.h file.
        !          1104: file=drv/netif/if_med.h
        !          1105: if [ -r ${LIB}/$file ]; then
        !          1106:   if egrep 'Wind River' ${LIB}/$file > /dev/null; then
        !          1107:     echo Fixing $file, overeager sed script
        !          1108:     rm ${LIB}/$file
        !          1109:     sed -e 's|//.*$||g' $file > ${LIB}/$file
        !          1110:     chmod +w ${LIB}/$file 2>/dev/null
        !          1111:     chmod a+r ${LIB}/$file 2>/dev/null
        !          1112:   fi
        !          1113: fi
        !          1114: 
1.1.1.6   root     1115: # Some IRIX header files contains the string "//"
                   1116: for file in elf_abi.h elf.h; do
                   1117:   if [ -r ${LIB}/$file ]; then
                   1118:     echo Fixing $file, overeager sed script
                   1119:     sed -e 's|"/\*"\*/|"//"|' ${LIB}/$file > ${LIB}/${file}.sed
                   1120:     rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1121:     if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1122:       rm -f ${LIB}/$file
1.1.1.7   root     1123:   else
                   1124:     # Find any include directives that use "file".
                   1125:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1126:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1127:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1128:     done
1.1.1.6   root     1129:     fi
                   1130:   fi
                   1131: done
                   1132: 
1.1.1.7   root     1133: # IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr in prototype without
                   1134: # previous definition.
                   1135: file=rpc/auth.h
                   1136: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1137:   mkdir ${LIB}/rpc 2>/dev/null
                   1138:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1139:   chmod +w ${LIB}/$file 2>/dev/null
                   1140:   chmod a+r ${LIB}/$file 2>/dev/null
                   1141: fi
                   1142: 
                   1143: if [ -r ${LIB}/$file ]; then
                   1144:   echo Fixing $file, undefined type
                   1145:   sed -e '/authdes_create.*struct sockaddr/i\
                   1146: struct sockaddr;
                   1147: ' \
                   1148:     ${LIB}/$file > ${LIB}/$file.sed
                   1149:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1150:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1151:     rm -f ${LIB}/$file
                   1152:   else
                   1153:     # Find any include directives that use "file".
                   1154:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1155:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1156:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1157:     done
                   1158:   fi
                   1159: fi
                   1160: 
                   1161: # IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s in prototype without previous
                   1162: # definition.
                   1163: file=rpc/xdr.h
                   1164: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1165:   mkdir ${LIB}/rpc 2>/dev/null
                   1166:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1167:   chmod +w ${LIB}/$file 2>/dev/null
                   1168:   chmod a+r ${LIB}/$file 2>/dev/null
                   1169: fi
                   1170: 
                   1171: if [ -r ${LIB}/$file ]; then
                   1172:   echo Fixing $file, undefined type
                   1173:   sed -e '/xdrstdio_create.*struct __file_s/i\
                   1174: struct __file_s;
                   1175: ' \
                   1176:     ${LIB}/$file > ${LIB}/$file.sed
                   1177:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1178:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1179:     rm -f ${LIB}/$file
                   1180:   else
                   1181:     # Find any include directives that use "file".
                   1182:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1183:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1184:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1185:     done
                   1186:   fi
                   1187: fi
                   1188: 
1.1.1.6   root     1189: # Same problem with a file from SunOS 4.1.3 : a header file containing
                   1190: # the string "//" embedded in "/**/"
                   1191: file=sbusdev/audiovar.h
1.1.1.5   root     1192: if [ -r ${LIB}/$file ]; then
                   1193:   echo Fixing $file, overeager sed script
1.1.1.6   root     1194:   rm ${LIB}/$file
                   1195:   sed -e 's|//.*$||g' $file > ${LIB}/$file
                   1196:   chmod +w ${LIB}/$file 2>/dev/null
                   1197:   chmod a+r ${LIB}/$file 2>/dev/null
1.1       root     1198: fi
                   1199: 
1.1.1.3   root     1200: # Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
                   1201: # declaration on Sun OS 4.x.  We must only fix this on Sun OS 4.x, because
                   1202: # many other systems have similar text but correct versions of the file.
                   1203: # To ensure only Sun's is fixed, we grep for a likely unique string.
                   1204: file=memory.h
1.1.1.5   root     1205: if [ -r $file ] && egrep '/\*  @\(#\)memory\.h 1\.[2-4] 8./../.. SMI; from S5R2 1\.2   \*/' $file > /dev/null; then
                   1206:   if [ ! -r ${LIB}/$file ]; then
1.1.1.3   root     1207:     cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1208:     chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root     1209:     chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.3   root     1210:   fi
                   1211:   if [ -r ${LIB}/$file ]; then
                   1212:     echo Replacing $file
                   1213:     cat > ${LIB}/$file << EOF
                   1214: /* This file was generated by fixincludes */
                   1215: #ifndef __memory_h__
                   1216: #define __memory_h__
                   1217: 
                   1218: #ifdef __STDC__
                   1219: extern void *memccpy();
                   1220: extern void *memchr();
                   1221: extern void *memcpy();
                   1222: extern void *memset();
                   1223: #else
                   1224: extern char *memccpy();
                   1225: extern char *memchr();
                   1226: extern char *memcpy();
                   1227: extern char *memset();
                   1228: #endif /* __STDC__ */
                   1229: 
                   1230: extern int memcmp();
                   1231: 
1.1.1.5   root     1232: #endif /* __memory_h__ */
1.1.1.3   root     1233: EOF
                   1234:   fi
                   1235: fi
                   1236: 
1.1.1.7   root     1237: # parameters not const on DECstation Ultrix V4.0 and OSF/1.
1.1.1.3   root     1238: file=stdio.h
                   1239: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1240:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1241:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root     1242:   chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.3   root     1243: fi
                   1244: 
                   1245: if [ -r ${LIB}/$file ]; then
                   1246:   echo Fixing $file, non-const arg
                   1247:   sed -e 's@perror( char \*__s );@perror( const char *__s );@' \
                   1248:       -e 's@fputs( char \*__s,@fputs( const char *__s,@' \
                   1249:       -e 's@fopen( char \*__filename, char \*__type );@fopen( const char *__filename, const char *__type );@' \
                   1250:       -e 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@' \
                   1251:       -e 's@fscanf( FILE \*__stream, char \*__format,@fscanf( FILE *__stream, const char *__format,@' \
                   1252:       -e 's@scanf( char \*__format,@scanf( const char *__format,@' \
                   1253:       -e 's@sscanf( char \*__s, char \*__format,@sscanf( const char *__s, const char *__format,@' \
1.1.1.7   root     1254:       -e 's@popen(char \*, char \*);@popen(const char *, const char *);@' \
                   1255:       -e 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@' \
1.1.1.3   root     1256:     ${LIB}/$file > ${LIB}/${file}.sed
                   1257:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1258:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1.1.1.5   root     1259:     rm -f ${LIB}/$file
1.1.1.7   root     1260:   else
                   1261:     # Find any include directives that use "file".
                   1262:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1263:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1264:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1265:     done
1.1.1.5   root     1266:   fi
                   1267: fi
                   1268: 
                   1269: # parameters conflict with C++ new on rs/6000 
1.1.1.6   root     1270: for file in stdio.h unistd.h ; do
                   1271:   if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1272:     cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1273:     chmod +w ${LIB}/$file 2>/dev/null
                   1274:   fi
                   1275: 
                   1276:   if [ -r ${LIB}/$file ]; then
                   1277:     echo Fixing $file, parameter name conflicts
                   1278:     sed -e 's@rename(const char \*old, const char \*new)@rename(const char *_old, const char *_new)@' \
                   1279:       ${LIB}/$file > ${LIB}/${file}.sed
                   1280:     rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1281:     if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1282:       rm -f ${LIB}/$file
1.1.1.7   root     1283:     else
                   1284:       # Find any include directives that use "file".
                   1285:       for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1286:         dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1287:         required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1288:       done
1.1.1.6   root     1289:     fi
                   1290:   fi
                   1291: done
                   1292: 
                   1293: # function class(double x) conflicts with C++ keyword on rs/6000 
                   1294: file=math.h
1.1.1.5   root     1295: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1296:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1297:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.6   root     1298:   chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.5   root     1299: fi
                   1300: 
                   1301: if [ -r ${LIB}/$file ]; then
1.1.1.6   root     1302:   if grep 'class[(]' ${LIB}/$file >/dev/null; then
                   1303:     echo Fixing $file
                   1304:     sed -e '/class[(]/i\
1.1.1.7   root     1305: #ifndef __cplusplus
                   1306: ' \
1.1.1.6   root     1307:         -e '/class[(]/a\
1.1.1.7   root     1308: #endif
                   1309: ' ${LIB}/$file > ${LIB}/${file}.sed
1.1.1.6   root     1310:     rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1311:     if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1312:       rm ${LIB}/$file
1.1.1.7   root     1313:     else
                   1314:       # Find any include directives that use "file".
                   1315:       for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1316:         dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1317:         required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1318:       done
1.1.1.6   root     1319:     fi
                   1320:   fi
                   1321: fi
                   1322: 
                   1323: # Wrong fchmod prototype on RS/6000.
                   1324: file=sys/stat.h
                   1325: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1326:   mkdir ${LIB}/sys 2>/dev/null
                   1327:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1328:   chmod +w ${LIB}/$file 2>/dev/null
                   1329:   chmod a+r ${LIB}/$file 2>/dev/null
                   1330: fi
                   1331: 
                   1332: if [ -r ${LIB}/$file ]; then
                   1333:   echo Fixing $file, fchmod prototype
                   1334:   sed -e 's/fchmod(char \*/fchmod(int/' \
                   1335:     ${LIB}/$file > ${LIB}/$file.sed
                   1336:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1337:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1338:     rm -f ${LIB}/$file
1.1.1.7   root     1339:   else
                   1340:     # Find any include directives that use "file".
                   1341:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1342:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1343:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1344:     done
                   1345:   fi
                   1346: fi
                   1347: 
                   1348: # There are several name conflicts with C++ reserved words in X11
                   1349: # header files.  These are fixed in some versions, so don't do the
                   1350: # fixes if we find __cplusplus in the file.  These were found on the
                   1351: # RS/6000.
                   1352: 
                   1353: # class in X11/ShellP.h
                   1354: file=X11/ShellP.h
                   1355: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1356:   mkdir ${LIB}/sys 2>/dev/null
                   1357:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1358:   chmod +w ${LIB}/$file 2>/dev/null
                   1359:   chmod a+r ${LIB}/$file 2>/dev/null
                   1360: fi
                   1361: 
                   1362: if [ -r ${LIB}/$file ]; then
                   1363:   if grep __cplusplus ${LIB}/$file >/dev/null 2>/dev/null; then
                   1364:     true;
                   1365:   else
                   1366:     echo Fixing $file, field class
                   1367:     sed -e '/char [*]class;/i\
                   1368: #ifdef __cplusplus\
                   1369:        char *c_class;\
                   1370: #else
                   1371: ' \
                   1372:         -e '/char [*]class;/a\
                   1373: #endif
                   1374: ' ${LIB}/$file > ${LIB}/${file}.sed
                   1375:     rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1376:   fi
                   1377:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1378:     rm -f ${LIB}/$file
                   1379:   else
                   1380:     # Find any include directives that use "file".
                   1381:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1382:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1383:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1384:     done
                   1385:   fi
                   1386: fi
                   1387: # new in Xm/Traversal.h
                   1388: file=Xm/Traversal.h
                   1389: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1390:   mkdir ${LIB}/sys 2>/dev/null
                   1391:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1392:   chmod +w ${LIB}/$file 2>/dev/null
                   1393:   chmod a+r ${LIB}/$file 2>/dev/null
                   1394: fi
                   1395: 
                   1396: if [ -r ${LIB}/$file ]; then
                   1397:   if grep __cplusplus ${LIB}/$file >/dev/null 2>/dev/null; then
                   1398:     true;
                   1399:   else
                   1400:     echo Fixing $file, uses of new
                   1401:     sed -e '/Widget    old, new;/i\
                   1402: #ifdef __cplusplus\
                   1403:        Widget  old, c_new;\
                   1404: #else
                   1405: ' \
                   1406:         -e '/Widget    old, new;/a\
                   1407: #endif
                   1408: ' \
                   1409:        -e 's/Widget new,/Widget c_new,/g' ${LIB}/$file > ${LIB}/${file}.sed
                   1410:     rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1411:   fi
                   1412:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1413:     rm -f ${LIB}/$file
                   1414:   else
                   1415:     # Find any include directives that use "file".
                   1416:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1417:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1418:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1419:     done
                   1420:   fi
                   1421: fi
                   1422: # class in Xm/BaseClassI.h
                   1423: file=Xm/BaseClassI.h
                   1424: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1425:   mkdir ${LIB}/sys 2>/dev/null
                   1426:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1427:   chmod +w ${LIB}/$file 2>/dev/null
                   1428:   chmod a+r ${LIB}/$file 2>/dev/null
                   1429: fi
                   1430: 
                   1431: if [ -r ${LIB}/$file ]; then
                   1432:   if grep __cplusplus ${LIB}/$file >/dev/null 2>/dev/null; then
                   1433:     true;
                   1434:   else
                   1435:     echo Fixing $file, prototype parameter name
                   1436:     sed -e 's/ class[)]/ c_class)/g' ${LIB}/$file > ${LIB}/${file}.sed
                   1437:     rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1438:   fi
                   1439:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1440:     rm -f ${LIB}/$file
                   1441:   else
                   1442:     # Find any include directives that use "file".
                   1443:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1444:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1445:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1446:     done
                   1447:   fi
                   1448: fi
                   1449: 
                   1450: # NeXT 3.2 adds const prefix to some math functions. These conflict
                   1451: # with the built-in functions.
                   1452: file=ansi/math.h
                   1453: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1454:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1455:   chmod +w ${LIB}/$file 2>/dev/null
                   1456: fi
                   1457: if [ -r ${LIB}/$file ]; then
                   1458:   echo Fixing $file
                   1459:   sed -e '/^extern.*double.*__const__.*cos(/s/__const__//' \
                   1460:       -e '/^extern.*double.*__const__.*sin(/s/__const__//' ${LIB}/$file > ${LIB}/${file}.sed
                   1461:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1462:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1463:     rm -f ${LIB}/$file
                   1464:   else
                   1465:     # Find any include directives that use "file".
                   1466:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1467:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1468:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1469:     done
                   1470:   fi
                   1471: fi
                   1472: 
                   1473: # NeXT 3.2 uses the word "template" as a parameter for some 
                   1474: # functions. GCC reports an invalid use of a reserved key word
                   1475: # with the built-in functions. NeXT 3.2 includes the keyword
                   1476: # volatile in the prototype for abort(). This conflicts with
                   1477: # the built-in definition.
                   1478: file=bsd/libc.h
                   1479: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1480:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1481:   chmod +w ${LIB}/$file 2>/dev/null
                   1482: fi
                   1483: if [ -r ${LIB}/$file ]; then
                   1484:   echo Fixing $file
                   1485:   sed -e '/\(.*template\)/s/template//' \
                   1486:       -e '/extern.*volatile.*void.*abort/s/volatile//' ${LIB}/$file > ${LIB}/${file}.sed
                   1487:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1488:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1489:     rm -f ${LIB}/$file
                   1490:   else
                   1491:     # Find any include directives that use "file".
                   1492:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1493:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1494:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1495:     done
                   1496:   fi
                   1497: fi
                   1498: 
                   1499: # NeXT 3.2 includes the keyword volatile in the abort() and 
                   1500: # exit() function prototypes. That conflicts with the 
                   1501: # built-in functions.
                   1502: file=ansi/stdlib.h
                   1503: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1504:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1505:   chmod +w ${LIB}/$file 2>/dev/null
                   1506: fi
                   1507: if [ -r ${LIB}/$file ]; then
                   1508:   echo Fixing $file
                   1509:   sed -e '/extern.*volatile.*void.*exit/s/volatile//' \
                   1510:       -e '/extern.*volatile.*void.*abort/s/volatile//' ${LIB}/$file > ${LIB}/${file}.sed
                   1511:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1512:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1513:     rm -f ${LIB}/$file
                   1514:   else
                   1515:     # Find any include directives that use "file".
                   1516:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1517:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1518:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1519:     done
1.1.1.6   root     1520:   fi
                   1521: fi
                   1522: 
                   1523: # NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
                   1524: # Note that version 3 of the NeXT system has wait.h in a different directory,
                   1525: # so that this code won't do anything.  But wait.h in version 3 has a
                   1526: # conditional, so it doesn't need this fix.  So everything is okay.
                   1527: file=sys/wait.h
                   1528: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1529:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1530:   chmod +w ${LIB}/$file 2>/dev/null
                   1531: fi
                   1532: 
                   1533: if [ -r ${LIB}/$file ] \
                   1534:   && grep 'wait[(]union wait' ${LIB}/$file >/dev/null; then
                   1535:   echo Fixing $file, bad wait formal
                   1536:   sed -e 's@wait(union wait@wait(void@' ${LIB}/$file > ${LIB}/${file}.sed
1.1.1.5   root     1537:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1538:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1.1.1.3   root     1539:     rm -f ${LIB}/$file
1.1.1.7   root     1540:   else
                   1541:     # Find any include directives that use "file".
                   1542:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1543:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1544:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1545:     done
1.1.1.3   root     1546:   fi
                   1547: fi
                   1548: 
1.1.1.4   root     1549: # Don't use or define the name va_list in stdio.h.
1.1.1.7   root     1550: # This is for ANSI and also to interoperate properly with gcc's varargs.h.
1.1.1.4   root     1551: file=stdio.h
                   1552: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1553:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1554:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root     1555:   chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.4   root     1556: fi
                   1557: 
                   1558: if [ -r ${LIB}/$file ]; then
                   1559:   echo Fixing $file, use of va_list
                   1560:   # Arrange for stdio.h to use stdarg.h to define __gnuc_va_list
1.1.1.7   root     1561:   if egrep "__need___va_list" ${LIB}/$file >/dev/null 2>&1; then
                   1562:     touch ${LIB}/${file}.sed
                   1563:   else
                   1564:     (echo "#define __need___va_list"
                   1565:      echo "#include <stdarg.h>") > ${LIB}/${file}.sed
                   1566:   fi
1.1.1.4   root     1567:   # Use __gnuc_va_list in arg types in place of va_list.
1.1.1.5   root     1568:   # On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
                   1569:   # trailing parentheses and semicolon save all other systems from this.
1.1.1.4   root     1570:   # Define __va_list__ (something harmless and unused) instead of va_list.
                   1571:   # Don't claim to have defined va_list.
                   1572:   sed -e 's@ va_list @ __gnuc_va_list @' \
1.1.1.5   root     1573:       -e 's@ va_list)@ __gnuc_va_list)@' \
1.1.1.8 ! root     1574:       -e 's@ _BSD_VA_LIST_));@ __gnuc_va_list));@' \
1.1.1.5   root     1575:       -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \
1.1.1.4   root     1576:       -e 's@ va_list@ __va_list__@' \
                   1577:       -e 's@\*va_list@*__va_list__@' \
1.1.1.6   root     1578:       -e 's@ __va_list)@ __gnuc_va_list)@' \
1.1.1.7   root     1579:       -e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \
1.1.1.6   root     1580:       -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \
1.1.1.4   root     1581:       -e 's@VA_LIST@DUMMY_VA_LIST@' \
1.1.1.7   root     1582:       -e 's@_Va_LIST@_VA_LIST@' \
1.1.1.4   root     1583:     ${LIB}/$file >> ${LIB}/${file}.sed
                   1584:   
                   1585:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1586:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1587:     rm -f ${LIB}/$file
1.1.1.7   root     1588:   else
                   1589:     # Find any include directives that use "file".
                   1590:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1591:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1592:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1593:     done
1.1.1.4   root     1594:   fi
                   1595: fi
                   1596: 
                   1597: # Cancel out ansi_compat.h on Ultrix.  Replace it with empty file.
                   1598: file=ansi_compat.h
                   1599: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1600:   if grep -s ULTRIX $file; then
                   1601:     echo "/* This file intentionally left blank.  */" > $LIB/$file
                   1602:   fi
                   1603: fi
                   1604: 
1.1.1.8 ! root     1605: # parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R.
1.1.1.4   root     1606: # also get rid of bogus inline definitions in HP-UX 8.0
1.1.1.3   root     1607: file=math.h
                   1608: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1609:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1610:   chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5   root     1611:   chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.3   root     1612: fi
                   1613: 
                   1614: if [ -r ${LIB}/$file ]; then
                   1615:   echo Fixing $file, non-const arg
1.1.1.8 ! root     1616:   sed -e 's@atof(\([   ]*char[         ]*\*[^)]*\))@atof(const \1)@' \
        !          1617:       -e 's@inline int abs(int [a-z][a-z]*) {.*}@extern "C" int abs(int);@' \
1.1.1.6   root     1618:       -e 's@inline double abs(double [a-z][a-z]*) {.*}@@' \
                   1619:       -e 's@inline int sqr(int [a-z][a-z]*) {.*}@@' \
                   1620:       -e 's@inline double sqr(double [a-z][a-z]*) {.*}@@' \
1.1.1.3   root     1621:     ${LIB}/$file > ${LIB}/${file}.sed
                   1622:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1623:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1.1.1.5   root     1624:     rm -f ${LIB}/$file
1.1.1.7   root     1625:   else
                   1626:     # Find any include directives that use "file".
                   1627:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1628:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1629:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1630:     done
1.1.1.5   root     1631:   fi
                   1632: fi
                   1633: 
1.1.1.8 ! root     1634: # fix bogus recursive stdlib.h in NEWS-OS 4.0C
        !          1635: file=stdlib.h
        !          1636: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !          1637:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !          1638:   chmod +w ${LIB}/$file 2>/dev/null
        !          1639:   chmod a+r ${LIB}/$file 2>/dev/null
        !          1640: fi
        !          1641: 
        !          1642: if [ -r ${LIB}/$file ]; then
        !          1643:   echo Fixing $file, recursive inclusion
        !          1644:   sed -e '/^#include <stdlib.h>/i\
        !          1645: #if 0
        !          1646: ' \
        !          1647:       -e '/^#include <stdlib.h>/a\
        !          1648: #endif
        !          1649: ' \
        !          1650:     ${LIB}/$file > ${LIB}/${file}.sed
        !          1651:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !          1652:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
        !          1653:     rm -f ${LIB}/$file
        !          1654:   else
        !          1655:     # Find any include directives that use "file".
        !          1656:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
        !          1657:       dir=`echo $file | sed -e s'|/[^/]*$||'`
        !          1658:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
        !          1659:     done
        !          1660:   fi
        !          1661: fi
        !          1662: 
1.1.1.6   root     1663: # Avoid nested comments on Ultrix 4.3.
                   1664: file=rpc/svc.h
                   1665: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1666:   mkdir ${LIB}/rpc 2>/dev/null
                   1667:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1668:   chmod +w ${LIB}/$file 2>/dev/null
                   1669:   chmod a+r ${LIB}/$file 2>/dev/null
                   1670: fi
                   1671: 
                   1672: if [ -r ${LIB}/$file ]; then
                   1673:   echo Fixing $file, nested comment
                   1674:   sed -e 's@^\( \*     int protocol;  \)/\*@\1*/ /*@' \
                   1675:     ${LIB}/$file > ${LIB}/$file.sed
                   1676:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1677:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1678:     rm -f ${LIB}/$file
1.1.1.7   root     1679:   else
                   1680:     # Find any include directives that use "file".
                   1681:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1682:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1683:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1684:     done
                   1685:   fi
                   1686: fi
                   1687: 
                   1688: # This file in RISC/os uses /**/ to concatenate two tokens.
                   1689: file=bsd43/bsd43_.h
                   1690: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1691:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1692:   chmod +w ${LIB}/$file 2>/dev/null
                   1693:   chmod a+r ${LIB}/$file 2>/dev/null
                   1694: fi
                   1695: if [ -r ${LIB}/$file ]; then
                   1696:   sed -e 's|/\*\*/|##|' ${LIB}/$file > ${LIB}/${file}.sed
                   1697:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1698:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1699:     rm -f ${LIB}/$file
                   1700:   else
                   1701:     # Find any include directives that use "file".
                   1702:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1703:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1704:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1705:     done
                   1706:   fi
                   1707: fi
                   1708: 
                   1709: file=rpc/rpc.h
                   1710: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1711:   mkdir ${LIB}/rpc 2>/dev/null
                   1712:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1713:   chmod +w ${LIB}/$file 2>/dev/null
                   1714:   chmod a+r ${LIB}/$file 2>/dev/null
                   1715: fi
                   1716: 
                   1717: if [ -r ${LIB}/$file ]; then
                   1718:   echo Fixing $file, nested comment
                   1719:   sed -e 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@' \
                   1720:     ${LIB}/$file > ${LIB}/$file.sed
                   1721:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1722:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1723:     rm -f ${LIB}/$file
                   1724:   else
                   1725:     # Find any include directives that use "file".
                   1726:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1727:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1728:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1729:     done
1.1.1.6   root     1730:   fi
                   1731: fi
                   1732: 
1.1.1.5   root     1733: # In limits.h, put #ifndefs around things that are supposed to be defined
                   1734: # in float.h to avoid redefinition errors if float.h is included first.
                   1735: # On HP/UX this patch does not work, because on HP/UX limits.h uses
                   1736: # multi line comments and the inserted #endif winds up inside the
                   1737: # comment.  Fortunately, HP/UX already uses #ifndefs in limits.h; if
                   1738: # we find a #ifndef FLT_MIN we assume that all the required #ifndefs
                   1739: # are there, and we do not add them ourselves.
1.1.1.6   root     1740: for file in limits.h sys/limits.h; do
                   1741:   if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1742:     mkdir ${LIB}/sys 2>/dev/null
                   1743:     cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1744:     chmod +w ${LIB}/$file 2>/dev/null
                   1745:     chmod a+r ${LIB}/$file 2>/dev/null
                   1746:   fi
1.1.1.5   root     1747: 
1.1.1.6   root     1748:   if [ -r ${LIB}/$file ]; then
                   1749:     if egrep 'ifndef[  ]+FLT_MIN' ${LIB}/$file >/dev/null; then
                   1750:       true
                   1751:     else
                   1752:       echo Fixing $file
                   1753:       sed -e '/[       ]FLT_MIN[       ]/i\
1.1.1.7   root     1754: #ifndef FLT_MIN
                   1755: '\
1.1.1.6   root     1756:          -e '/[        ]FLT_MIN[       ]/a\
1.1.1.7   root     1757: #endif
                   1758: '\
1.1.1.6   root     1759:          -e '/[        ]FLT_MAX[       ]/i\
1.1.1.7   root     1760: #ifndef FLT_MAX
                   1761: '\
1.1.1.6   root     1762:          -e '/[        ]FLT_MAX[       ]/a\
1.1.1.7   root     1763: #endif
                   1764: '\
1.1.1.6   root     1765:          -e '/[        ]FLT_DIG[       ]/i\
1.1.1.7   root     1766: #ifndef FLT_DIG
                   1767: '\
1.1.1.6   root     1768:          -e '/[        ]FLT_DIG[       ]/a\
1.1.1.7   root     1769: #endif
                   1770: '\
1.1.1.6   root     1771:          -e '/[        ]DBL_MIN[       ]/i\
1.1.1.7   root     1772: #ifndef DBL_MIN
                   1773: '\
1.1.1.6   root     1774:          -e '/[        ]DBL_MIN[       ]/a\
1.1.1.7   root     1775: #endif
                   1776: '\
1.1.1.6   root     1777:          -e '/[        ]DBL_MAX[       ]/i\
1.1.1.7   root     1778: #ifndef DBL_MAX
                   1779: '\
1.1.1.6   root     1780:          -e '/[        ]DBL_MAX[       ]/a\
1.1.1.7   root     1781: #endif
                   1782: '\
1.1.1.6   root     1783:          -e '/[        ]DBL_DIG[       ]/i\
1.1.1.7   root     1784: #ifndef DBL_DIG
                   1785: '\
1.1.1.6   root     1786:          -e '/[        ]DBL_DIG[       ]/a\
1.1.1.7   root     1787: #endif
                   1788: '\
1.1.1.6   root     1789:        ${LIB}/$file > ${LIB}/${file}.sed
                   1790:       rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1791:     fi
                   1792:     if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1793:       echo Deleting ${LIB}/$file\; no fixes were needed.
                   1794:       rm -f ${LIB}/$file
1.1.1.7   root     1795:     else
                   1796:       # Find any include directives that use "file".
                   1797:       for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1798:         dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1799:         required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1800:       done
1.1.1.6   root     1801:     fi
1.1.1.5   root     1802:   fi
1.1.1.6   root     1803: done
                   1804: 
                   1805: # In math.h, put #ifndefs around things that might be defined in a gcc
                   1806: # specific math-*.h file.
                   1807: file=math.h
                   1808: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1809:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1810:   chmod +w ${LIB}/$file 2>/dev/null
                   1811:   chmod a+r ${LIB}/$file 2>/dev/null
                   1812: fi
                   1813: 
                   1814: if [ -r ${LIB}/$file ]; then
                   1815:   echo Fixing $file
                   1816:   sed -e '/define[     ]HUGE_VAL[      ]/i\
1.1.1.7   root     1817: #ifndef HUGE_VAL
                   1818: '\
1.1.1.6   root     1819:       -e '/define[     ]HUGE_VAL[      ]/a\
1.1.1.7   root     1820: #endif
                   1821: '\
1.1.1.6   root     1822:     ${LIB}/$file > ${LIB}/${file}.sed
                   1823:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1.1.7   root     1824: 
                   1825:   # In addition, copy the definition of DBL_MAX from float.h
                   1826:   # if math.h requires one.  The Lynx math.h requires it.
                   1827:   if egrep '#define[   ]*HUGE_VAL[     ]+DBL_MAX' $file >/dev/null 2>&1; then
                   1828:     if egrep '#define[         ]+DBL_MAX[      ]+' $file >/dev/null 2>&1; then
                   1829:       true;
                   1830:     else
                   1831:       dbl_max_def=`egrep 'define[      ]+DBL_MAX[      ]+.*' float.h 2>/dev/null`
                   1832:       if [ "$dbl_max_def" != "" ]; then
                   1833:         dbl_max_def=`echo $dbl_max_def | sed 's/.*define[      ]*DBL_MAX[      ]*//'`
                   1834:         sed -e "/define[       ]HUGE_VAL[      ]DBL_MAX/s/DBL_MAX/$dbl_max_def/" \
                   1835:           ${LIB}/$file > ${LIB}/${file}.sed
                   1836:        rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1837:       fi
                   1838:     fi
                   1839:   fi
                   1840: 
1.1.1.5   root     1841:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1.1.1.3   root     1842:     echo Deleting ${LIB}/$file\; no fixes were needed.
                   1843:     rm -f ${LIB}/$file
1.1.1.7   root     1844:   else
                   1845:     # Find any include directives that use "file".
                   1846:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1847:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1848:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1849:     done
1.1.1.3   root     1850:   fi
                   1851: fi
                   1852: 
1.1.1.6   root     1853: # Remove erroneous parentheses in sym.h on Alpha OSF/1.
                   1854: file=sym.h
                   1855: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1856:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1857:   chmod +w ${LIB}/$file 2>/dev/null
                   1858:   chmod a+r ${LIB}/$file 2>/dev/null
                   1859: fi
                   1860: 
                   1861: if [ -r ${LIB}/$file ]; then
                   1862:   echo Fixing $file
                   1863:   sed -e 's/#ifndef(__mips64)/#ifndef __mips64/' \
                   1864:     ${LIB}/$file > ${LIB}/${file}.sed
                   1865:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1866:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1867:     rm -f ${LIB}/$file
1.1.1.7   root     1868:   else
                   1869:     # Find any include directives that use "file".
                   1870:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1871:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1872:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1873:     done
                   1874:   fi
                   1875: fi
                   1876: 
1.1.1.8 ! root     1877: # Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
        !          1878: # in string.h on sysV68
1.1.1.7   root     1879: # Correct the return type for strlen in string.h on Lynx.
                   1880: # Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
                   1881: # Add missing const for strdup on OSF/1 V3.0.
                   1882: file=string.h
                   1883: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1884:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1885:   chmod +w ${LIB}/$file 2>/dev/null
                   1886:   chmod a+r ${LIB}/$file 2>/dev/null
                   1887: fi
                   1888: 
                   1889: if [ -r ${LIB}/$file ]; then
1.1.1.8 ! root     1890:   echo Fixing $file, mem{ccpy,chr,cpy,set} and str{len,spn,cspn} return value
1.1.1.7   root     1891:   sed -e 's/extern[    ]*int[  ]*strlen();/extern unsigned int strlen();/' \
                   1892:       -e 's/extern[    ]*int[  ]*ffs[  ]*(long);/extern int ffs(int);/' \
                   1893:       -e 's/strdup(char \*s1);/strdup(const char *s1);/' \
1.1.1.8 ! root     1894:       -e '/^extern char$/N' \
        !          1895:       -e 's/^extern char\(\n   \*memccpy(),\)$/extern void\1/'\
        !          1896:       -e '/^   strncmp(),$/N'\
        !          1897:       -e 's/^\(        strncmp()\),\n\(        strlen(),\)$/\1;\
        !          1898: extern unsigned int\
        !          1899: \2/'\
        !          1900:     ${LIB}/$file > ${LIB}/${file}.sed
        !          1901:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !          1902:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
        !          1903:     rm -f ${LIB}/$file
        !          1904:   else
        !          1905:     # Find any include directives that use "file".
        !          1906:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
        !          1907:       dir=`echo $file | sed -e s'|/[^/]*$||'`
        !          1908:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
        !          1909:     done
        !          1910:   fi
        !          1911: fi
        !          1912: 
        !          1913: # Correct the return type for strlen in strings.h in SunOS 4.
        !          1914: file=strings.h
        !          1915: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !          1916:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !          1917:   chmod +w ${LIB}/$file 2>/dev/null
        !          1918:   chmod a+r ${LIB}/$file 2>/dev/null
        !          1919: fi
        !          1920: 
        !          1921: if [ -r ${LIB}/$file ]; then
        !          1922:   echo Fixing $file
        !          1923:   sed -e 's/int[       ]*strlen();/__SIZE_TYPE__ strlen();/' \
1.1.1.7   root     1924:     ${LIB}/$file > ${LIB}/${file}.sed
                   1925:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1926:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1927:     rm -f ${LIB}/$file
                   1928:   else
                   1929:     # Find any include directives that use "file".
                   1930:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1931:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1932:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1933:     done
                   1934:   fi
                   1935: fi
                   1936: 
                   1937: # Delete the '#define void int' line from curses.h on Lynx
                   1938: file=curses.h
                   1939: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1940:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1941:   chmod +w ${LIB}/$file 2>/dev/null
                   1942:   chmod a+r ${LIB}/$file 2>/dev/null
                   1943: fi
                   1944: 
                   1945: if [ -r ${LIB}/$file ]; then
                   1946:   echo Fixing $file
                   1947:   sed -e '/#[  ]*define[       ][      ]*void[         ]int/d' \
                   1948:      ${LIB}/$file > ${LIB}/${file}.sed
                   1949:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1950:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1951:     rm -f ${LIB}/$file
                   1952:   else
                   1953:     # Find any include directives that use "file".
                   1954:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   1955:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   1956:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   1957:     done
1.1.1.6   root     1958:   fi
                   1959: fi
                   1960: 
1.1.1.8 ! root     1961: # Fix `typedef struct term;' on hppa1.1-hp-hpux9.
        !          1962: file=curses.h
        !          1963: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !          1964:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !          1965:   chmod +w ${LIB}/$file 2>/dev/null
        !          1966:   chmod a+r ${LIB}/$file 2>/dev/null
        !          1967: fi
        !          1968: 
        !          1969: if [ -r ${LIB}/$file ]; then
        !          1970:   echo Fixing $file
        !          1971:   sed -e 's/^[         ]*typedef[      ][      ]*\(struct[     ][      ]*term[         ]*;[    ]*\)$/\1/' \
        !          1972:      ${LIB}/$file > ${LIB}/${file}.sed
        !          1973:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !          1974:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
        !          1975:     rm -f ${LIB}/$file
        !          1976:   else
        !          1977:     # Find any include directives that use "file".
        !          1978:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
        !          1979:       dir=`echo $file | sed -e s'|/[^/]*$||'`
        !          1980:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
        !          1981:     done
        !          1982:   fi
        !          1983: fi
        !          1984: 
1.1.1.7   root     1985: # For C++, avoid any typedef or macro definition of bool, and use the
                   1986: # built in type instead.
                   1987: for files in curses.h; do
                   1988:   if [ -r $file ] && egrep bool $file >/dev/null 2>&1; then
                   1989:     if [ ! -r ${LIB}/$file ]; then
                   1990:       cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1991:       chmod +w ${LIB}/$file 2>/dev/null
                   1992:       chmod a+r ${LIB}/$file 2>/dev/null
                   1993:     fi
                   1994: 
                   1995:     echo Fixing $file
                   1996:     sed -e '/^#[       ]*define[       ][      ]*bool[         ][      ]*char[         ]*$/i\
                   1997: #ifndef __cplusplus'\
                   1998:        -e '/^#[        ]*define[       ][      ]*bool[         ][      ]*char[         ]*$/a\
                   1999: #endif'\
1.1.1.8 ! root     2000:        -e '/^typedef[  ][      ]*char[         ][      ]*bool[         ]*;/i\
1.1.1.7   root     2001: #ifndef __cplusplus'\
1.1.1.8 ! root     2002:        -e '/^typedef[  ][      ]*char[         ][      ]*bool[         ]*;/a\
1.1.1.7   root     2003: #endif'\
                   2004:        ${LIB}/$file > ${LIB}/${file}.sed
                   2005:     rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   2006:     if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   2007:       rm -f ${LIB}/$file
                   2008:     else
                   2009:       # Find any include directives that use "file".
                   2010:       for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   2011:         dir=`echo $file | sed -e s'|/[^/]*$||'`
                   2012:         required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   2013:       done
                   2014:     fi
                   2015:   fi
                   2016: done
                   2017: 
1.1.1.6   root     2018: # Fix incorrect S_IF* definitions on m88k-sysv3.
                   2019: file=sys/stat.h
                   2020: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   2021:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   2022:   chmod +w ${LIB}/$file 2>/dev/null
                   2023:   chmod a+r ${LIB}/$file 2>/dev/null
                   2024: fi
                   2025: 
                   2026: if [ -r ${LIB}/$file ]; then
                   2027:   echo Fixing $file
                   2028:   sed -e 's/^\(#define[        ]*S_IS[A-Z]*(m)\)[      ]*(m[   ]*&[    ]*\(S_IF[A-Z][A-Z][A-Z][A-Z]*\)[        ]*)/\1 (((m)\&S_IFMT)==\2)/' \
                   2029:       -e 's/^\(#define[        ]*S_IS[A-Z]*(m)\)[      ]*(m[   ]*&[    ]*\(0[0-9]*\)[  ]*)/\1 (((m)\&S_IFMT)==\2)/' \
                   2030:     ${LIB}/$file > ${LIB}/${file}.sed
                   2031:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   2032:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   2033:     rm -f ${LIB}/$file
1.1.1.7   root     2034:   else
                   2035:     # Find any include directives that use "file".
                   2036:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   2037:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   2038:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   2039:     done
1.1.1.6   root     2040:   fi
                   2041: fi
                   2042: 
1.1.1.7   root     2043: # Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
1.1.1.6   root     2044: for file in stdio.h stdlib.h; do
                   2045:   if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   2046:     cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   2047:     chmod +w ${LIB}/$file 2>/dev/null
                   2048:     chmod a+r ${LIB}/$file 2>/dev/null
                   2049:   fi
                   2050: 
                   2051:   if [ -r ${LIB}/$file ]; then
                   2052:     echo Fixing $file, getopt declaration
1.1.1.7   root     2053:     sed -e 's/getopt(int, char \*\[\],[ ]*char \*)/getopt(int, char *const[], const char *)/' \
1.1.1.6   root     2054:       ${LIB}/$file > ${LIB}/${file}.sed
                   2055:     rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   2056:     if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   2057:       rm -f ${LIB}/$file
1.1.1.7   root     2058:     else
                   2059:       # Find any include directives that use "file".
                   2060:       for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   2061:         dir=`echo $file | sed -e s'|/[^/]*$||'`
                   2062:         required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   2063:       done
1.1.1.6   root     2064:     fi
                   2065:   fi
                   2066: done
                   2067: 
1.1.1.5   root     2068: # Determine if we're on Interactive Unix 2.2 or later, in which case we
                   2069: # need to fix some additional files.  This is the same test for ISC that
                   2070: # Autoconf uses.
                   2071: if test -d /etc/conf/kconfig.d \
                   2072:     && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1; then
                   2073:   echo "Fixing ISC __STDC__ goof in several files..."
                   2074:   for name in stdio.h math.h ctype.h sys/limits.h sys/fcntl.h sys/dirent.h; do
                   2075:     echo $name
                   2076:     if test -r ${LIB}/$name; then
                   2077:       file=${LIB}/$name
                   2078:     else
                   2079:       file=${INPUT}/$name
                   2080:     fi
                   2081:     # On Interactive 2.2, certain traditional Unix definitions
                   2082:     # (notably getc and putc in stdio.h) are omitted if __STDC__ is
                   2083:     # defined, not just if _POSIX_SOURCE is defined.  This makes it
                   2084:     # impossible to compile any nontrivial program except with -posix.
                   2085:     sed \
                   2086: 's/!defined(__STDC__) && !defined(_POSIX_SOURCE)/!defined(_POSIX_SOURCE)/' \
                   2087:            < $file > ${LIB}/$name.
                   2088:     mv ${LIB}/$name. ${LIB}/$name
                   2089:   done
                   2090:   
                   2091:   echo "Fixing ISC fmod declaration"
                   2092:   # This one's already been fixed for other things.
                   2093:   file=${LIB}/math.h
                   2094:   sed 's/fmod(double)/fmod(double, double)/' <$file >$file.
                   2095:   mv $file. $file
                   2096:   
                   2097:   echo "Fixing nested comments in ISC <sys/limits.h>"
                   2098:   file=sys/limits.h
                   2099:   sed '/CHILD_MAX/s,/\* Max, Max,' < ${INPUT}/$file >${LIB}/$file.
                   2100:   sed '/OPEN_MAX/s,/\* Max, Max,' < ${LIB}/$file. >${LIB}/$file
                   2101: fi
                   2102: 
1.1.1.6   root     2103: # These files in Sun OS 4.x use /**/ to concatenate tokens.
                   2104: for file in sparc/asm_linkage.h sun3/asm_linkage.h sun3x/asm_linkage.h \
                   2105:        sun4/asm_linkage.h sun4c/asm_linkage.h sun4m/asm_linkage.h      \
                   2106:        sun4c/debug/asm_linkage.h sun4m/debug/asm_linkage.h;
                   2107: do
                   2108:   if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   2109:     cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   2110:     chmod +w ${LIB}/$file 2>/dev/null
                   2111:     chmod a+r ${LIB}/$file 2>/dev/null
                   2112:   fi
                   2113: 
                   2114:   if [ -r ${LIB}/$file ]; then
                   2115:     sed -e 's|/\*\*/|##|g' ${LIB}/$file > ${LIB}/${file}.sed
                   2116:     rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   2117:     if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   2118:       rm -f ${LIB}/$file
1.1.1.7   root     2119:     else
                   2120:       # Find any include directives that use "file".
                   2121:       for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   2122:         dir=`echo $file | sed -e s'|/[^/]*$||'`
                   2123:         required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   2124:       done
1.1.1.6   root     2125:     fi
                   2126:   fi
                   2127: done
                   2128: 
                   2129: # These files in ARM/RISCiX use /**/ to concatenate tokens.
                   2130: for file in arm/as_support.h arm/mc_type.h arm/xcb.h dev/chardefmac.h \
                   2131:        dev/ps_irq.h dev/screen.h dev/scsi.h sys/tty.h Xm.acorn/XmP.h
                   2132: do
                   2133:   if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   2134:     cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   2135:     chmod +w ${LIB}/$file 2>/dev/null
                   2136:     chmod a+r ${LIB}/$file 2>/dev/null
                   2137:   fi
                   2138: 
                   2139:   if [ -r ${LIB}/$file ]; then
                   2140:     sed -e 's|/\*\*/|##|g' ${LIB}/$file > ${LIB}/${file}.sed
1.1.1.5   root     2141:     rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1.1.6   root     2142:     if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   2143:       rm -f ${LIB}/$file
1.1.1.7   root     2144:   else
                   2145:     # Find any include directives that use "file".
                   2146:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   2147:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   2148:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   2149:     done
1.1.1.6   root     2150:     fi
1.1.1.5   root     2151:   fi
                   2152: done
                   2153: 
1.1.1.7   root     2154: # math.h on SunOS 4 puts the declaration of matherr before the definition
                   2155: # of struct exception, so the prototype (added by fixproto) causes havoc.
                   2156: file=math.h
                   2157: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   2158:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   2159:   chmod +w ${LIB}/$file 2>/dev/null
                   2160:   chmod a+r ${LIB}/$file 2>/dev/null
                   2161: fi
1.1       root     2162: 
1.1.1.7   root     2163: if [ -r ${LIB}/$file ]; then
                   2164:   echo Fixing $file, matherr declaration
                   2165:   sed -e '/^struct exception/,$b' \
                   2166:       -e '/matherr/i\
                   2167: struct exception;
                   2168: '\
                   2169:     ${LIB}/$file > ${LIB}/${file}.sed
                   2170:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   2171:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   2172:     rm -f ${LIB}/$file
                   2173:   else
                   2174:     # Find any include directives that use "file".
                   2175:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   2176:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   2177:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   2178:     done
                   2179:   fi
                   2180: fi
                   2181: 
                   2182: # assert.h on HP/UX is not C++ ready, even though NO_IMPLICIT_EXTERN_C
                   2183: # is defined on HP/UX.
                   2184: file=assert.h
                   2185: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   2186:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   2187:   chmod +w ${LIB}/$file 2>/dev/null
                   2188:   chmod a+r ${LIB}/$file 2>/dev/null
                   2189: fi
                   2190: 
                   2191: if [ -r ${LIB}/$file ]; then
                   2192:   if egrep '"C"' ${LIB}/$file >/dev/null 2>&1 \
                   2193:      || egrep '__BEGIN_DECLS' ${LIB}/$file >/dev/null 2>&1; then
                   2194:     true
                   2195:   else
                   2196:     echo Fixing $file
                   2197:     echo '#ifdef __cplusplus
                   2198: extern "C" {
                   2199: #endif' > ${LIB}/${file}.sed
                   2200:     cat ${LIB}/${file} >> ${LIB}/${file}.sed
                   2201:     echo '#ifdef __cplusplus
                   2202: }
                   2203: #endif' >> ${LIB}/${file}.sed 
                   2204:     rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   2205:     if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   2206:       rm -f ${LIB}/$file
                   2207:     else
                   2208:       # Find any include directives that use "file".
                   2209:       for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   2210:         dir=`echo $file | sed -e s'|/[^/]*$||'`
                   2211:         required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   2212:       done
1.1       root     2213:     fi
1.1.1.7   root     2214:   fi
                   2215: fi
                   2216: 
                   2217: # check for broken assert.h that needs stdio.h or stdlib.h
                   2218: file=assert.h
                   2219: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   2220:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   2221:   chmod +w ${LIB}/$file 2>/dev/null
                   2222:   chmod a+r ${LIB}/$file 2>/dev/null
                   2223: fi
                   2224: 
                   2225: if [ -r ${LIB}/$file ]; then
                   2226:   if grep 'stderr' ${LIB}/$file >/dev/null 2>/dev/null; then
                   2227:     if grep 'include.*stdio.h' ${LIB}/$file >/dev/null 2>/dev/null; then
                   2228:       true
                   2229:     else
                   2230:       echo "Fixing $file (needs stdio.h)"
1.1.1.8 ! root     2231:       echo '#ifdef __cplusplus
        !          2232: #include <stdio.h>
        !          2233: #endif' >>${LIB}/$file
1.1.1.7   root     2234:     fi
                   2235:   fi
                   2236:   if grep 'exit *(' ${LIB}/$file >/dev/null 2>/dev/null || 
                   2237:      grep 'abort *(' ${LIB}/$file >/dev/null 2>/dev/null; then
                   2238:     if grep 'include.*stdlib.h' ${LIB}/$file >/dev/null 2>/dev/null; then
                   2239:       true
                   2240:     else
                   2241:       echo "Fixing $file (needs stdlib.h)"
1.1.1.8 ! root     2242:       echo '#ifdef __cplusplus
        !          2243: #include <stdlib.h>
        !          2244: #endif' >>${LIB}/$file
1.1.1.7   root     2245:     fi
                   2246:   fi
                   2247:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   2248:     rm -f ${LIB}/$file
                   2249:   else
                   2250:     # Find any include directives that use "file".
                   2251:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   2252:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   2253:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   2254:     done
                   2255:   fi
                   2256: fi
                   2257: 
                   2258: # Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
                   2259: file=unistd.h
                   2260: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   2261:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   2262:   chmod +w ${LIB}/$file 2>/dev/null
                   2263:   chmod a+r ${LIB}/$file 2>/dev/null
                   2264: fi
                   2265: 
                   2266: if [ -r ${LIB}/$file ]; then
                   2267:   echo Fixing $file, sbrk declaration
                   2268:   sed -e 's/char\([    ]*\*[    ]*sbrk[        ]*(\)/void\1/' \
                   2269:     ${LIB}/$file > ${LIB}/${file}.sed
                   2270:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   2271:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   2272:     rm -f ${LIB}/$file
                   2273:   else
                   2274:     # Find any include directives that use "file".
                   2275:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   2276:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   2277:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   2278:     done
                   2279:   fi
                   2280: fi
                   2281: 
                   2282: # This file on SunOS 4 has a very large macro.  When the sed loop
                   2283: # tries pull it in, it overflows the pattern space size of the SunOS
                   2284: # sed (GNU sed does not have this problem).  Since the file does not
                   2285: # require fixing, we remove it from the fixed directory.
                   2286: file=sundev/ipi_error.h
                   2287: if [ -r ${LIB}/$file ]; then
                   2288:   echo "Removing incorrect fix to SunOS <sundev/ipi_error.h>"
                   2289:   rm -f ${LIB}/$file
                   2290: fi
                   2291: 
                   2292: # Put cpp wrappers around these include files to avoid redeclaration
                   2293: # errors during multiple inclusion on m88k-tektronix-sysv3.
                   2294: for file in time.h sys/time.h ; do
                   2295:   if egrep '#ifndef' $file >/dev/null 2>&1; then
                   2296:     true
                   2297:   else
                   2298:     if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   2299:       cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   2300:       chmod +w ${LIB}/$file 2>/dev/null
                   2301:     fi
                   2302:     if [ -r ${LIB}/$file ]; then
                   2303:       echo Fixing $file, to protect against multiple inclusion.
                   2304:       cpp_wrapper=`echo $file | sed -e 's,\.,_,g' -e 's,/,_,g'`
                   2305:       (echo "#ifndef __GCC_GOT_${cpp_wrapper}_"
                   2306:       echo "#define __GCC_GOT_${cpp_wrapper}_"
                   2307:       cat ${LIB}/${file}
                   2308:       echo '#endif /* !_GCC_GOT_'${cpp_wrapper}_' */')  > ${LIB}/${file}.new
                   2309:       rm -f ${LIB}/$file; mv ${LIB}/${file}.new ${LIB}/$file
                   2310:     fi
                   2311:   fi
                   2312: done
                   2313: 
                   2314: # Fix fcntl prototype in fcntl.h on LynxOS.
                   2315: file=fcntl.h
                   2316: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   2317:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   2318:   chmod +w ${LIB}/$file 2>/dev/null
                   2319:   chmod a+r ${LIB}/$file 2>/dev/null
                   2320: fi
                   2321: 
                   2322: if [ -r ${LIB}/$file ]; then
                   2323:   echo Fixing $file, fcntl declaration
                   2324:   sed -e 's/\(fcntl.*(int, int, \)int)/\1...)/' \
                   2325:     ${LIB}/$file > ${LIB}/${file}.sed
                   2326:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   2327:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   2328:     rm -f ${LIB}/$file
                   2329:   else
                   2330:     # Find any include directives that use "file".
                   2331:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   2332:       dir=`echo $file | sed -e s'|/[^/]*$||'`
                   2333:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
                   2334:     done
                   2335:   fi
1.1       root     2336: fi
                   2337: 
1.1.1.8 ! root     2338: # Fix definitions of macros used by va-i960.h in VxWorks header file.
        !          2339: file=arch/i960/archI960.h
        !          2340: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !          2341:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !          2342:   chmod +w ${LIB}/$file 2>/dev/null
        !          2343:   chmod a+r ${LIB}/$file 2>/dev/null
        !          2344: fi
        !          2345: 
        !          2346: if [ -r ${LIB}/$file ]; then
        !          2347:   echo Fixing $file
        !          2348:   sed -e 's/__vsiz/__vxvsiz/' -e 's/__vali/__vxvali/' \
        !          2349:       -e s'/__vpad/__vxvpad/' -e 's/__alignof__/__vxalignof__/' \
        !          2350:     ${LIB}/$file > ${LIB}/${file}.sed
        !          2351:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !          2352:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
        !          2353:     rm -f ${LIB}/$file
        !          2354:   else
        !          2355:     # Find any include directives that use "file".
        !          2356:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
        !          2357:       dir=`echo $file | sed -e s'|/[^/]*$||'`
        !          2358:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
        !          2359:     done
        !          2360:   fi
        !          2361: fi
        !          2362: 
        !          2363: # Make VxWorks header which is almost gcc ready fully gcc ready.
        !          2364: file=types/vxTypesBase.h
        !          2365: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !          2366:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !          2367:   chmod +w ${LIB}/$file 2>/dev/null
        !          2368:   chmod a+r ${LIB}/$file 2>/dev/null
        !          2369: fi
        !          2370: 
        !          2371: if [ -r ${LIB}/$file ]; then
        !          2372:   echo Fixing $file
        !          2373:   sed -e 's/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/#if 1/' \
        !          2374:       -e '/[   ]size_t/i\
        !          2375: #ifndef _GCC_SIZE_T\
        !          2376: #define _GCC_SIZE_T
        !          2377: ' \
        !          2378:       -e '/[   ]size_t/a\
        !          2379: #endif
        !          2380: ' \
        !          2381:       -e '/[   ]ptrdiff_t/i\
        !          2382: #ifndef _GCC_PTRDIFF_T\
        !          2383: #define _GCC_PTRDIFF_T
        !          2384: ' \
        !          2385:       -e '/[   ]ptrdiff_t/a\
        !          2386: #endif
        !          2387: ' \
        !          2388:       -e '/[   ]wchar_t/i\
        !          2389: #ifndef _GCC_WCHAR_T\
        !          2390: #define _GCC_WCHAR_T
        !          2391: ' \
        !          2392:       -e '/[   ]wchar_t/a\
        !          2393: #endif
        !          2394: ' \
        !          2395:     ${LIB}/$file > ${LIB}/${file}.sed
        !          2396:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !          2397:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
        !          2398:     rm -f ${LIB}/$file
        !          2399:   else
        !          2400:     # Find any include directives that use "file".
        !          2401:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
        !          2402:       dir=`echo $file | sed -e s'|/[^/]*$||'`
        !          2403:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
        !          2404:     done
        !          2405:   fi
        !          2406: fi
        !          2407: 
        !          2408: # Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
        !          2409: file=sys/stat.h
        !          2410: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !          2411:   mkdir ${LIB}/sys 2>/dev/null
        !          2412:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !          2413:   chmod +w ${LIB}/$file 2>/dev/null
        !          2414:   chmod a+r ${LIB}/$file 2>/dev/null
        !          2415: fi
        !          2416: 
        !          2417: if [ -r ${LIB}/$file ]; then
        !          2418:   if egrep '#include' ${LIB}/$file >/dev/null 2>&1; then
        !          2419:     :
        !          2420:   else
        !          2421:     if egrep 'ULONG' ${LIB}/$file >/dev/null 2>&1 \
        !          2422:        && [ -r types/vxTypesOld.h ]; then
        !          2423:       echo Fixing $file
        !          2424:       sed -e '/#define[        ][      ]*__INCstath/a\
        !          2425: #include <types/vxTypesOld.h>
        !          2426: ' \
        !          2427:     ${LIB}/$file > ${LIB}/${file}.sed
        !          2428:       rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !          2429:     fi
        !          2430:   fi
        !          2431:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
        !          2432:     rm -f ${LIB}/$file
        !          2433:   else
        !          2434:     # Find any include directives that use "file".
        !          2435:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
        !          2436:       dir=`echo $file | sed -e s'|/[^/]*$||'`
        !          2437:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
        !          2438:     done
        !          2439:   fi
        !          2440: fi
        !          2441: 
        !          2442: # Fix VxWorks <time.h> to not require including <vxTypes.h>.
        !          2443: file=time.h
        !          2444: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
        !          2445:   mkdir ${LIB}/sys 2>/dev/null
        !          2446:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
        !          2447:   chmod +w ${LIB}/$file 2>/dev/null
        !          2448:   chmod a+r ${LIB}/$file 2>/dev/null
        !          2449: fi
        !          2450: 
        !          2451: if [ -r ${LIB}/$file ]; then
        !          2452:   if egrep 'uint_t[    ][      ]*_clocks_per_sec' ${LIB}/$file >/dev/null 2>&1; then
        !          2453:     echo Fixing $file
        !          2454:     sed -e 's/uint_t/unsigned int/' ${LIB}/$file > ${LIB}/${file}.sed
        !          2455:     rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !          2456:   fi
        !          2457:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
        !          2458:     rm -f ${LIB}/$file
        !          2459:   else
        !          2460:     # Find any include directives that use "file".
        !          2461:     for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
        !          2462:       dir=`echo $file | sed -e s'|/[^/]*$||'`
        !          2463:       required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
        !          2464:     done
        !          2465:   fi
        !          2466: fi
        !          2467:     
        !          2468: 
1.1.1.7   root     2469: # This loop does not appear to do anything, because it uses file
                   2470: # rather than $file when setting target.  It also appears to be
                   2471: # unnecessary, since the main loop processes symbolic links.
                   2472: #if $LINKS; then
                   2473: #  echo 'Making internal symbolic non-directory links'
                   2474: #  cd ${INPUT}
                   2475: #  files=`find . -type l -print`
                   2476: #  for file in $files; do
                   2477: #    dest=`ls -ld $file | sed -n 's/.*-> //p'`
                   2478: #    if expr "$dest" : '[^/].*' > /dev/null; then    
                   2479: #      target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
                   2480: #      if [ -f $target ]; then
                   2481: #        ln -s $dest ${LIB}/$file >/dev/null 2>&1
                   2482: #      fi
                   2483: #    fi
                   2484: #  done
                   2485: #fi
                   2486: 
1.1.1.6   root     2487: # Make sure that any include files referenced using double quotes
                   2488: # exist in the fixed directory.  This comes last since otherwise
                   2489: # we might end up deleting some of these files "because they don't
                   2490: # need any change."
1.1.1.7   root     2491: set x $required
                   2492: shift
                   2493: while [ $# != 0 ]; do
1.1.1.6   root     2494:   newreq=
                   2495:   while [ $# != 0 ]; do
                   2496:     # $1 is the directory to copy from, $2 is the unfixed file,
                   2497:     # $3 is the fixed file name.
                   2498:     cd ${INPUT}
                   2499:     cd $1
                   2500:     if [ -r $2 ] && [ ! -r $3 ]; then
                   2501:       cp $2 $3 >/dev/null 2>&1 || echo "Can't copy $2"
                   2502:       chmod +w $3 2>/dev/null
                   2503:       chmod a+r $3 2>/dev/null
                   2504:       echo Copied $2
                   2505:       for include in `egrep '^[        ]*#[    ]*include[      ]*"[^/]' $3 | sed -e 's/^[      ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
                   2506:        dir=`echo $2 | sed -e s'|/[^/]*$||'`
                   2507:        dir2=`echo $3 | sed -e s'|/[^/]*$||'`
                   2508:        newreq="$newreq $1 $dir/$include $dir2/$include"
                   2509:       done
                   2510:     fi
                   2511:     shift; shift; shift
                   2512:   done
1.1.1.7   root     2513:   set x $newreq
                   2514:   shift
1.1.1.6   root     2515: done
                   2516: 
1.1.1.5   root     2517: echo 'Cleaning up DONE files.'
                   2518: cd $LIB
1.1.1.6   root     2519: find . -name DONE -exec rm -f '{}' ';'
1.1.1.5   root     2520: 
1.1.1.7   root     2521: echo 'Removing unneeded directories:'
                   2522: cd $LIB
                   2523: files=`find . -type d -print | sort -r`
                   2524: for file in $files; do
                   2525:   rmdir $LIB/$file > /dev/null 2>&1
                   2526: done
                   2527: 
1.1       root     2528: exit 0

unix.superglobalmegacorp.com

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