Annotation of GNUtools/cc/fixinc.mips, revision 1.1.1.1

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 where gcc sources (and sometimes special include files) live.
                      9: # fixincludes doesn't use this, but fixinc.svr4 does, and I want to make
                     10: # sure somebody doesn't try to use arg3 for something incompatible. -- gumby
                     11: SRCDIR=${3-${SRCDIR-.}}
                     12: 
                     13: # Directory containing the original header files.
                     14: # (This was named INCLUDES, but that conflicts with a name in Makefile.in.)
                     15: INPUT=${2-${INPUT-/usr/include}}
                     16: 
                     17: # Directory in which to store the results.
                     18: LIB=${1?"fixincludes: output directory not specified"}
                     19: 
                     20: # Define PWDCMD as a command to use to get the working dir
                     21: # in the form that we want.
                     22: PWDCMD=pwd
                     23: case "`pwd`" in
                     24: //*)
                     25:        # On an Apollo, discard everything before `/usr'.
                     26:        PWDCMD="eval pwd | sed -e 's,.*/usr/,/usr/,'"
                     27:        ;;
                     28: esac
                     29: 
                     30: # Original directory.
                     31: ORIGDIR=`${PWDCMD}`
                     32: 
                     33: # Make sure it exists.
                     34: if [ ! -d $LIB ]; then
                     35:   mkdir $LIB || exit 1
                     36: fi
                     37: 
                     38: # Make LIB absolute only if needed to avoid problems with the amd.
                     39: case $LIB in
                     40: /*)
                     41:        ;;
                     42: *)
                     43:        cd $LIB; LIB=`${PWDCMD}`
                     44:        ;;
                     45: esac
                     46: 
                     47: # Make SRCDIR absolute only if needed to avoid problems with the amd.
                     48: cd $ORIGDIR
                     49: case $SRCDIR in
                     50: /*)
                     51:        ;;
                     52: *)
                     53:        cd $SRCDIR; SRCDIR=`${PWDCMD}`
                     54:        ;;
                     55: esac
                     56: 
                     57: # Fail if no arg to specify a directory for the output.
                     58: if [ x$1 = x ]
                     59: then echo fixincludes: no output directory specified
                     60: exit 1
                     61: fi
                     62: 
                     63: echo Building fixed headers in ${LIB}
                     64: 
                     65: # Determine whether this system has symbolic links.
                     66: if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
                     67:   rm -f $LIB/ShouldNotExist
                     68:   LINKS=true
                     69: else
                     70:   LINKS=false
                     71: fi
                     72: 
                     73: echo Finding directories and links to directories
                     74: cd ${INPUT}
                     75: # Find all directories and all symlinks that point to directories.
                     76: # Put the list in $files.
                     77: # Each time we find a symlink, add it to newdirs
                     78: # so that we do another find within the dir the link points to.
                     79: # Note that $files may have duplicates in it;
                     80: # later parts of this file are supposed to ignore them.
                     81: dirs="."
                     82: levels=2
                     83: while [ -n "$dirs" ] && [ $levels -gt 0 ]
                     84: do
                     85:     levels=`expr $levels - 1`
                     86:     newdirs=
                     87:     for d in $dirs
                     88:     do
                     89:        echo " Searching $INPUT/$d"
                     90:        if [ "$d" != . ]
                     91:        then
                     92:            d=$d/.
                     93:        fi
                     94: 
                     95:        # Find all directories under $d, relative to $d, excluding $d itself.
                     96:         files="$files `find $d -type d -print | \
                     97:                       sed -e '/\/\.$/d' -e '/^\.$/d'`"
                     98:        # Find all links to directories.
                     99:        # Using `-exec test -d' in find fails on some systems,
                    100:        # and trying to run test via sh fails on others,
                    101:        # so this is the simplest alternative left.
                    102:        # First find all the links, then test each one.
                    103:        theselinks=
                    104:        $LINKS && \
                    105:          theselinks=`find $d -type l -print`
                    106:        for d1 in $theselinks --dummy--
                    107:        do
                    108:            # If the link points to a directory,
                    109:            # add that dir to $newdirs
                    110:            if [ -d $d1 ]
                    111:            then
                    112:                newdirs="$newdirs $d1"
                    113:            fi
                    114:        done
                    115:     done
                    116: 
                    117:     files="$files $newdirs"
                    118:     dirs="$newdirs"
                    119: done
                    120: 
                    121: dirs=
                    122: echo "All directories (including links to directories):"
                    123: echo $files
                    124: 
                    125: for file in $files; do
                    126:   rm -rf $LIB/$file
                    127:   if [ ! -d $LIB/$file ]
                    128:   then mkdir $LIB/$file
                    129:   fi
                    130: done
                    131: mkdir $LIB/root
                    132: 
                    133: # treetops gets an alternating list
                    134: # of old directories to copy
                    135: # and the new directories to copy to.
                    136: treetops="${INPUT} ${LIB}"
                    137: 
                    138: if $LINKS; then
                    139:   echo 'Making symbolic directory links'
                    140:   for file in $files; do
                    141:     dest=`ls -ld $file | sed -n 's/.*-> //p'`
                    142:     if [ "$dest" ]; then    
                    143:       cwd=`${PWDCMD}`
                    144:       # In case $dest is relative, get to $file's dir first.
                    145:       cd ${INPUT}
                    146:       cd `echo ./$file | sed -n 's&[^/]*$&&p'`
                    147:       # Check that the target directory exists.
                    148:       # Redirections changed to avoid bug in sh on Ultrix.
                    149:       (cd $dest) > /dev/null 2>&1
                    150:       if [ $? = 0 ]; then
                    151:        cd $dest
                    152:        # X gets the dir that the link actually leads to.
                    153:        x=`${PWDCMD}`
                    154:        # If a link points to ., make a similar link to .
                    155:        if [ $x = $INPUT ]; then
                    156:          echo $file '->' . ': Making link'
                    157:          rm -fr ${LIB}/$file > /dev/null 2>&1
                    158:          ln -s . ${LIB}/$file > /dev/null 2>&1
                    159:        # If link leads back into ${INPUT},
                    160:        # make a similar link here.
                    161:        elif expr $x : "${INPUT}/.*" > /dev/null; then
                    162:          # Y gets the actual target dir name, relative to ${INPUT}.
                    163:          y=`echo $x | sed -n "s&${INPUT}/&&p"`
                    164:          echo $file '->' $y ': Making link'
                    165:          rm -fr ${LIB}/$file > /dev/null 2>&1
                    166:          ln -s ${LIB}/$y ${LIB}/$file > /dev/null 2>&1
                    167:        else
                    168:          # If the link is to a dir $target outside ${INPUT},
                    169:          # repoint the link at ${INPUT}/root$target
                    170:          # and process $target into ${INPUT}/root$target
                    171:          # treat this directory as if it actually contained the files.
                    172:          echo $file '->' root$x ': Making link'
                    173:          if [ -d $LIB/root$x ]
                    174:          then true
                    175:          else
                    176:            dirname=root$x/
                    177:            dirmade=.
                    178:            cd $LIB
                    179:            while [ x$dirname != x ]; do
                    180:              component=`echo $dirname | sed -e 's|/.*$||'`
                    181:              mkdir $component >/dev/null 2>&1
                    182:              cd $component
                    183:              dirmade=$dirmade/$component
                    184:              dirname=`echo $dirname | sed -e 's|[^/]*/||'`
                    185:            done
                    186:          fi
                    187:          # Duplicate directory structure created in ${LIB}/$file in new
                    188:          # root area.
                    189:          for file2 in $files; do
                    190:            case $file2 in
                    191:              $file/./*)
                    192:                dupdir=${LIB}/root$x/`echo $file2 | sed -n "s|^${file}/||p"`
                    193:                echo "Duplicating ${file}'s ${dupdir}"
                    194:                if [ -d ${dupdir} ]
                    195:                then true
                    196:                else
                    197:                  mkdir ${dupdir}
                    198:                fi
                    199:                ;;
                    200:              *)
                    201:                ;;
                    202:            esac
                    203:           done
                    204:          rm -fr ${LIB}/$file > /dev/null 2>&1
                    205:          ln -s ${LIB}/root$x ${LIB}/$file > /dev/null 2>&1
                    206:          treetops="$treetops $x ${LIB}/root$x"
                    207:        fi
                    208:       fi
                    209:       cd $cwd
                    210:     fi
                    211:   done
                    212: fi
                    213: 
                    214: set x $treetops
                    215: shift
                    216: while [ $# != 0 ]; do
                    217:   # $1 is an old directory to copy, and $2 is the new directory to copy to.
                    218:   cd ${INPUT}
                    219:   cd $1
                    220: # The same dir can appear more than once in treetops.
                    221: # There's no need to scan it more than once.
                    222:   if [ -f $2/DONE ]
                    223:   then
                    224:     files=
                    225:   else
                    226:     touch $2/DONE
                    227:     echo Fixing directory $1 into $2
                    228: # Check .h files which are symlinks as well as those which are files.
                    229: # A link to a header file will not be processed by anything but this.
                    230:     if $LINKS; then
                    231:       files=`find . -name '*.h' \( -type f -o -type l \) -print`
                    232:     else
                    233:       files=`find . -name '*.h' -type f -print`
                    234:     fi
                    235:     echo Checking header files
                    236:   fi
                    237: # Note that BSD43_*,SYSTYPE_*,MIPSE[LB] are used on recent MIPS systems.
                    238:   for file in $files; do
                    239: # This call to egrep is essential, since checking a file with egrep
                    240: # is much faster than actually trying to fix it.
                    241: # It is also essential that most files *not* match!
                    242: # Thus, matching every #endif is unacceptable.
                    243: # But the argument to egrep must be kept small, or many versions of egrep
                    244: # won't be able to handle it.
                    245: #
                    246: # We use the pattern [!-.0-~] instead of [^/   ] to match a noncomment
                    247: # following #else or #endif because some buggy egreps think [^/] matches
                    248: # newline, and they thus think `#else ' matches `#e[ndiflse]*[         ]+[^/   ]'.
                    249: #
                    250: # We use the pattern [^a-zA-Z0-9_][_a-ce-km-z][a-z0-9] to match an identifier
                    251: # following #if or #elif that is not surrounded by __.  The `a-ce-km-z'
                    252: # in this pattern lacks `d' and `l'; this means we don't worry about
                    253: # identifiers starting with `d' or `l'.  This is OK, since none of the
                    254: # identifiers below start with `d' or `l'.  It also greatly improves
                    255: # performance, since many files contain lines of the form `#if ... defined ...'
                    256: # or `#if lint'.
                    257:     if egrep '//|[     _]_IO|CTRL|SYSTYPE|MIPSE|^#define.NULL|^#e[nl][ds][ief]*[       ]+[!-.0-~]|^#[el]*if.*[^a-zA-Z0-9_][_a-ce-km-z][a-z0-9]' $file >/dev/null; then
                    258:       if [ -r $file ]; then
                    259:        cp $file $2/$file >/dev/null 2>&1       \
                    260:        || echo "Can't copy $file"
                    261:        chmod +w $2/$file
                    262:        chmod a+r $2/$file
                    263:        # Here is how the sed commands in braces work.
                    264:        # (It doesn't work to put the comments inside the sed commands.)
                    265:                # Surround each word with spaces, to simplify matching below.
                    266:                # ANSIfy each pre-ANSI machine-dependent symbol
                    267:                # by surrounding it with __ __.
                    268:                # Remove the spaces that we inserted around each word.
                    269:        sed -e '
                    270:                                   :loop
                    271:          /\\$/                 N
                    272:          /\\$/                 b loop
                    273:          s%^\([        ]*#[    ]*endif[        ]*\)\([^/       ].*\)$%\1/* \2 */%
                    274:          s%^\([        ]*#[    ]*else[         ]*\)\([^/       ].*\)$%\1/* \2 */%
                    275:          /\/\/[^*]/                    s|//\(.*\)$|/*\1*/|
                    276:          /[    ]_IO[A-Z]*[     ]*(/    s/\(_IO[A-Z]*[  ]*(\)\(.\),/\1'\''\2'\'',/
                    277:          /[    ]BSD43__IO[A-Z]*[       ]*(/    s/(\(.\),/('\''\1'\'',/
                    278:          /#define._IO/                 s/'\''\([cgx]\)'\''/\1/g
                    279:          /#define.BSD43__IO/           s/'\''\([cgx]\)'\''/\1/g
                    280:          /[^A-Z0-9_]CTRL[      ]*(/            s/\([^'\'']\))/'\''\1'\'')/
                    281:          /[^A-Z0-9]_CTRL[      ]*(/            s/\([^'\'']\))/'\''\1'\'')/
                    282:          /#define.CTRL/                s/'\''\([cgx]\)'\''/\1/g
                    283:          /#define._CTRL/               s/'\''\([cgx]\)'\''/\1/g
                    284:          /#define.BSD43_CTRL/          s/'\''\([cgx]\)'\''/\1/g
                    285:          /#[el]*if/{
                    286:                s/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g
                    287: 
                    288:                s/ bsd4\([0-9]\) / __bsd4\1__ /g
                    289:                s/ _*i386 / __i386__ /g
                    290:                s/ is68k / __is68k__ /g
                    291:                s/ m68k / __m68k__ /g
                    292:                s/ mc680\([0-9]\)0 / __mc680\10__ /g
                    293:                s/ news\([0-9]*\) / __news\1__ /g
                    294:                s/ ns32000 / __ns32000__ /g
                    295:                s/ pyr / __pyr__ /g
                    296:                s/ sony_news / __sony_news__ /g
                    297:                s/ sparc / __sparc__ /g
                    298:                s/ sun\([a-z0-9]*\) / __sun\1__ /g
                    299:                s/ unix / __unix__ /g
                    300:                s/ vax / __vax__ /g
                    301:                s/ _*\(MIPSE[LB]\) / __\1__ /g
                    302:                s/ _*\(mips\) / __\1__ /g
                    303:                s/ _*\(host_mips\) / __\1__ /g
                    304:                s/ _*\(SYSTYPE_[A-Z0-9]*\) / __\1__ /g
                    305: 
                    306:                s/ \([a-zA-Z0-9_][a-zA-Z0-9_]*\) /\1/g
                    307:          }
                    308:          /^#define.NULL[       ]/      i\
                    309:                #undef NULL
                    310:        ' $2/$file > $2/$file.
                    311:        mv $2/$file. $2/$file
                    312:        if cmp $file $2/$file >/dev/null 2>&1; then
                    313:           rm $2/$file
                    314:        else
                    315:           echo Fixed $file
                    316:        fi
                    317:       fi
                    318:     fi
                    319:   done
                    320:   shift; shift
                    321: done
                    322: 
                    323: cd ${INPUT}
                    324: 
                    325: # Install the proper definition of size_t in header files that it comes from.
                    326: for file in sys/types.h sys/stdtypes.h stddef.h memory.h stdlib.h unistd.h;
                    327: do
                    328:   if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    329:     cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    330:     chmod +w ${LIB}/$file 2>/dev/null
                    331:     chmod a+r ${LIB}/$file 2>/dev/null
                    332:   fi
                    333: 
                    334:   if [ -r ${LIB}/$file ]; then
                    335:     echo Fixing $file size_t typedef
                    336:     # Extract the definition of SIZE_TYPE, if any.
                    337:     # (This file must be called something.c).
                    338:     echo "#include \"tm.h\"
                    339: gobblegobble SIZE_TYPE" > ${LIB}/types.c
                    340:     foo=`cd ${LIB}; cc -E -I${ORIGDIR} -I${SRCDIR} -I${SRCDIR}/config types.c | grep gobblegobble | sed -e "s/gobblegobble[    ]*//"`
                    341:     rm -f ${LIB}/types.c
                    342:     # Default to our preferred type.
                    343:     if [ "$foo" = SIZE_TYPE ]; then foo="unsigned long int"; else foo=`echo $foo | sed -e 's/^.*"\(.*\)".*$/\1/'`; fi
                    344:     sed -e "s/typedef[         a-z_]*[         ]size_t/typedef $foo size_t/" \
                    345:       -e "s/typedef[   a-z_]*[         ]bsd43_(size_t)/typedef $foo bsd43_(size_t)/" \
                    346:       ${LIB}/$file > ${LIB}/${file}.sed
                    347:     rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    348:     if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    349:       rm ${LIB}/$file
                    350:     fi
                    351:   fi
                    352: done
                    353: 
                    354: # Fix one other error in this file: a mismatched quote not inside a C comment.
                    355: file=sundev/vuid_event.h
                    356: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    357:   mkdir ${LIB}/sundev 2>/dev/null
                    358:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    359:   chmod +w ${LIB}/$file 2>/dev/null
                    360:   chmod a+r ${LIB}/$file 2>/dev/null
                    361: fi
                    362: 
                    363: if [ -r ${LIB}/$file ]; then
                    364:   echo Fixing $file comment
                    365:   sed -e "s/doesn't/does not/" ${LIB}/$file > ${LIB}/${file}.sed
                    366:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    367:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    368:     rm ${LIB}/$file
                    369:   fi
                    370: fi
                    371: 
                    372: # Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
                    373: file=sunwindow/win_cursor.h
                    374: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    375: #  mkdir ${LIB}/sunwindow 2>/dev/null
                    376:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    377:   chmod +w ${LIB}/$file 2>/dev/null
                    378: fi
                    379: if [ -r ${LIB}/$file ]; then
                    380:   echo Fixing $file
                    381:   sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.sed
                    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
                    385:   fi
                    386: fi
                    387: file=sunwindow/win_lock.h
                    388: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    389: #  mkdir ${LIB}/sunwindow 2>/dev/null
                    390:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    391:   chmod +w ${LIB}/$file 2>/dev/null
                    392: fi
                    393: if [ -r ${LIB}/$file ]; then
                    394:   echo Fixing $file
                    395:   sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.sed
                    396:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    397:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    398:     rm ${LIB}/$file
                    399:   fi
                    400: fi
                    401: 
                    402: # Fix this Sun file to avoid interfering with stddef.h.
                    403: file=sys/stdtypes.h
                    404: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    405:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    406:   chmod +w ${LIB}/$file 2>/dev/null
                    407:   chmod a+r ${LIB}/$file 2>/dev/null
                    408: fi
                    409: 
                    410: if [ -r ${LIB}/$file ]; then
                    411:   echo Fixing $file
                    412: sed -e '/size_t.*;/i\
                    413: #ifndef _GCC_SIZE_T\
                    414: #define _GCC_SIZE_T' \
                    415:     -e '/size_t.*;/a\
                    416: #endif' \
                    417:     -e '/ptrdiff_t.*;/i\
                    418: #ifndef _GCC_PTRDIFF_T\
                    419: #define _GCC_PTRDIFF_T' \
                    420:     -e '/ptrdiff_t.*;/a\
                    421: #endif' \
                    422:     -e '/wchar_t.*;/i\
                    423: #ifndef _GCC_WCHAR_T\
                    424: #define _GCC_WCHAR_T' \
                    425:     -e '/wchar_t.*;/a\
                    426: #endif' ${LIB}/$file > ${LIB}/${file}.sed
                    427:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    428:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    429:     rm ${LIB}/$file
                    430:   fi
                    431: fi
                    432: 
                    433: # Fix this file to avoid interfering with stddef.h, but don't mistakenly
                    434: # match e.g. ssize_t present in AIX for the ps/2.
                    435: file=sys/types.h
                    436: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    437:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    438:   chmod +w ${LIB}/$file 2>/dev/null
                    439:   chmod a+r ${LIB}/$file 2>/dev/null
                    440: fi
                    441: 
                    442: if [ -r ${LIB}/$file ]; then
                    443:   echo Fixing $file
                    444: sed -e '/[     ]size_t.*;/i\
                    445: #ifndef _GCC_SIZE_T\
                    446: #define _GCC_SIZE_T' \
                    447:     -e '/[     ]size_t.*;/a\
                    448: #endif' ${LIB}/$file > ${LIB}/${file}.sed
                    449:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    450:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    451:     rm ${LIB}/$file
                    452:   fi
                    453: fi
                    454: 
                    455: # Fix an error in this file: the #if says _cplusplus, not the double
                    456: # underscore __cplusplus that it should be
                    457: file=tinfo.h
                    458: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    459:   mkdir ${LIB}/rpcsvc 2>/dev/null
                    460:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    461:   chmod +w ${LIB}/$file 2>/dev/null
                    462:   chmod a+r ${LIB}/$file 2>/dev/null
                    463: fi
                    464: 
                    465: if [ -r ${LIB}/$file ]; then
                    466:   echo Fixing $file, __cplusplus macro
                    467:   sed -e 's/[  ]_cplusplus/ __cplusplus/' ${LIB}/$file > ${LIB}/${file}.sed
                    468:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    469:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    470:     rm ${LIB}/$file
                    471:   fi
                    472: fi
                    473: 
                    474: # Fix an error in this file: a missing semi-colon at the end of the statsswtch
                    475: # structure definition.
                    476: file=rpcsvc/rstat.h
                    477: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    478:   mkdir ${LIB}/rpcsvc 2>/dev/null
                    479:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    480:   chmod +w ${LIB}/$file 2>/dev/null
                    481:   chmod a+r ${LIB}/$file 2>/dev/null
                    482: fi
                    483: 
                    484: if [ -r ${LIB}/$file ]; then
                    485:   echo Fixing $file, definition of statsswtch
                    486:   sed -e 's/boottime$/boottime;/' ${LIB}/$file > ${LIB}/${file}.sed
                    487:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    488:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    489:     rm ${LIB}/$file
                    490:   fi
                    491: fi
                    492: 
                    493: # Fix an error in this file: a missing semi-colon at the end of the nodeent
                    494: # structure definition.
                    495: file=netdnet/dnetdb.h
                    496: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    497:   mkdir ${LIB}/netdnet 2>/dev/null
                    498:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    499:   chmod +w ${LIB}/$file 2>/dev/null
                    500:   chmod a+r ${LIB}/$file 2>/dev/null
                    501: fi
                    502: 
                    503: if [ -r ${LIB}/$file ]; then
                    504:   echo Fixing $file, definition of nodeent
                    505:   sed -e 's/char.*na_addr *$/char *na_addr;/' ${LIB}/$file > ${LIB}/${file}.sed
                    506:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    507:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    508:     rm ${LIB}/$file
                    509:   fi
                    510: fi
                    511: 
                    512: # Check for bad #ifdef line (in Ultrix 4.1)
                    513: file=sys/file.h
                    514: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    515:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    516:   chmod +w ${LIB}/$file 2>/dev/null
                    517:   chmod a+r ${LIB}/$file 2>/dev/null
                    518: fi
                    519: 
                    520: if [ -r ${LIB}/$file ]; then
                    521:   echo Fixing $file, bad \#ifdef line
                    522:   sed -e 's/#ifdef KERNEL/#if defined(KERNEL)/' ${LIB}/$file > ${LIB}/${file}.sed
                    523:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    524:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    525:     rm ${LIB}/$file
                    526:   fi
                    527: fi
                    528: 
                    529: # Remove nested comments created by #endifs in a comment (Ultrix 4.1)
                    530: # Only needed if commenting out junk after #endif.
                    531: file=signal.h
                    532: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    533:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    534:   chmod +w ${LIB}/$file 2>/dev/null
                    535:   chmod a+r ${LIB}/$file 2>/dev/null
                    536: fi
                    537: 
                    538: if [ -r ${LIB}/$file ]; then
                    539:   echo Fixing $file, nested comments
                    540:   sed -e 's/^[         ]#endif.*/#endif/' ${LIB}/$file > ${LIB}/${file}.sed
                    541:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    542:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    543:     rm -f ${LIB}/$file
                    544:   fi
                    545: fi
                    546: 
                    547: # Check for superfluous `static' (in Ultrix 4.2)
                    548: file=machine/cpu.h
                    549: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    550:   mkdir ${LIB}/machine 2>/dev/null
                    551:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    552:   chmod +w ${LIB}/$file 2>/dev/null
                    553:   chmod a+r ${LIB}/$file 2>/dev/null
                    554: fi
                    555: 
                    556: if [ -r ${LIB}/$file ]; then
                    557:   echo Fixing $file, superfluous static
                    558:   sed -e 's/^static struct tlb_pid_state/struct tlb_pid_state/' ${LIB}/$file > ${LIB}/${file}.sed
                    559:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    560:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    561:     rm ${LIB}/$file
                    562:   else
                    563: # This file has an alternative name, mips/cpu.h.  Fix that name, too.
                    564:     if cmp machine/cpu.h mips/cpu.h > /dev/null 2>& 1; then
                    565:       mkdir ${LIB}/mips 2>&-
                    566:       ln ${LIB}/$file ${LIB}/mips/cpu.h 
                    567:     fi
                    568:   fi
                    569: fi
                    570: 
                    571: # Incorrect sprintf declaration in X11/Xmu.h
                    572: file=X11/Xmu.h
                    573: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    574:   mkdir ${LIB}/X11 2>/dev/null
                    575:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    576:   chmod +w ${LIB}/$file 2>/dev/null
                    577:   chmod a+r ${LIB}/$file 2>/dev/null
                    578: fi
                    579: 
                    580: if [ -r ${LIB}/$file ]; then
                    581:   echo Fixing $file sprintf declaration
                    582:   sed -e 's,^extern char \*    sprintf();$,#ifndef __STDC__\
                    583: extern char *  sprintf();\
                    584: #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.sed
                    585:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    586:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    587:     rm ${LIB}/$file
                    588:   fi
                    589: fi
                    590: 
                    591: # Incorrect sprintf declaration in X11/Xmu/Xmu.h
                    592: # (It's not clear whether the right file name is this or X11/Xmu.h.)
                    593: file=X11/Xmu/Xmu.h
                    594: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    595:   mkdir ${LIB}/X11/Xmu 2>/dev/null
                    596:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    597:   chmod +w ${LIB}/$file 2>/dev/null
                    598:   chmod a+r ${LIB}/$file 2>/dev/null
                    599: fi
                    600: 
                    601: if [ -r ${LIB}/$file ]; then
                    602:   echo Fixing $file sprintf declaration
                    603:   sed -e 's,^extern char \*    sprintf();$,#ifndef __STDC__\
                    604: extern char *  sprintf();\
                    605: #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.sed
                    606:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    607:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    608:     rm ${LIB}/$file
                    609:   fi
                    610: fi
                    611: 
                    612: # Check for missing ';' in struct
                    613: file=netinet/ip.h
                    614: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    615:   mkdir ${LIB}/netinet 2>/dev/null
                    616:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    617:   chmod +w ${LIB}/$file 2>/dev/null
                    618:   chmod a+r ${LIB}/$file 2>/dev/null
                    619: fi
                    620: 
                    621: if [ -r ${LIB}/$file ]; then
                    622:   echo Fixing $file
                    623:   sed -e '/^struct/,/^};/s/}$/};/' ${LIB}/$file > ${LIB}/${file}.sed
                    624:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    625:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    626:     rm -f ${LIB}/$file
                    627:   fi
                    628: fi
                    629: 
                    630: # Fix the CAT macro in SunOS memvar.h.
                    631: file=pixrect/memvar.h
                    632: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    633:   mkdir ${LIB}/pixrect 2>/dev/null
                    634:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    635:   chmod +w ${LIB}/$file 2>/dev/null
                    636:   chmod a+r ${LIB}/$file 2>/dev/null
                    637: fi
                    638: 
                    639: if [ -r ${LIB}/$file ]; then
                    640:   echo Fixing $file
                    641:   sed -e '/^#define.CAT(a,b)/ i\
                    642: #ifdef __STDC__ \
                    643: #define CAT(a,b) a##b\
                    644: #else
                    645: /^#define.CAT(a,b)/ a\
                    646: #endif
                    647: ' ${LIB}/$file > ${LIB}/${file}.sed
                    648:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    649:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    650:     rm -f ${LIB}/$file
                    651:   fi
                    652: fi
                    653: 
                    654: # Check for yet more missing ';' in struct (in SunOS 4.0.x)
                    655: file=rpcsvc/rusers.h
                    656: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    657:   mkdir ${LIB}/rpcsvc 2>/dev/null
                    658:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    659:   chmod +w ${LIB}/$file 2>/dev/null
                    660:   chmod a+r ${LIB}/$file 2>/dev/null
                    661: fi
                    662: 
                    663: if [ -r ${LIB}/$file ]; then
                    664:   echo Fixing $file
                    665:   sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' ${LIB}/$file > ${LIB}/${file}.sed
                    666:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    667:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    668:     rm -f ${LIB}/$file
                    669:   fi
                    670: fi
                    671: 
                    672: # Fix return type of exit and abort in <stdlib.h> on SunOS 4.1.
                    673: file=stdlib.h
                    674: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    675:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    676:   chmod +w ${LIB}/$file 2>/dev/null
                    677:   chmod a+r ${LIB}/$file 2>/dev/null
                    678: fi
                    679: 
                    680: if [ -r ${LIB}/$file ]; then
                    681:   echo Fixing $file
                    682:   sed -e 's/int        abort/void      abort/g' \
                    683:   -e 's/int    free/void       free/g' \
                    684:   -e 's/char \*        calloc/void \*  calloc/g' \
                    685:   -e 's/char \*        malloc/void \*  malloc/g' \
                    686:   -e 's/char \*        realloc/void \* realloc/g' \
                    687:   -e 's/int    exit/void       exit/g' ${LIB}/$file > ${LIB}/${file}.sed
                    688:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    689:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    690:     rm -f ${LIB}/$file
                    691:   fi
                    692: fi
                    693: 
                    694: # Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
                    695: file=malloc.h
                    696: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    697:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    698:   chmod +w ${LIB}/$file 2>/dev/null
                    699:   chmod a+r ${LIB}/$file 2>/dev/null
                    700: fi
                    701: 
                    702: if [ -r ${LIB}/$file ]; then
                    703:   echo Fixing $file
                    704:   sed -e 's/typedef[   ]char \*        malloc_t/typedef void \*        malloc_t/g' \
                    705:   -e 's/int[   ][      ]*free/void     free/g' \
                    706:   ${LIB}/$file > ${LIB}/${file}.sed
                    707:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    708:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    709:     rm -f ${LIB}/$file
                    710:   fi
                    711: fi
                    712: 
                    713: 
                    714: # Fix bogus comment in <locale.h> on SunOS 4.1.
                    715: file=locale.h
                    716: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    717:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    718:   chmod +w ${LIB}/$file 2>/dev/null
                    719:   chmod a+r ${LIB}/$file 2>/dev/null
                    720: fi
                    721: 
                    722: if [ -r ${LIB}/$file ]; then
                    723:   echo Fixing $file
                    724:   sed -e 's%#endif / \*%#endif /\* %g' ${LIB}/$file > ${LIB}/${file}.sed
                    725:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    726:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    727:     rm -f ${LIB}/$file
                    728:   fi
                    729: fi
                    730: 
                    731: # Fix bogus #ifdef in <hsfs/hsfs_spec.h> on SunOS 4.1.
                    732: file=hsfs/hsfs_spec.h
                    733: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    734:   mkdir ${LIB}/hsfs 2>/dev/null
                    735:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    736:   chmod +w ${LIB}/$file 2>/dev/null
                    737:   chmod a+r ${LIB}/$file 2>/dev/null
                    738: fi
                    739: 
                    740: if [ -r ${LIB}/$file ]; then
                    741:   echo Fixing $file
                    742:   sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
                    743:     ${LIB}/$file > ${LIB}/${file}.
                    744:   rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
                    745:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    746:     rm -f ${LIB}/$file
                    747:   fi
                    748: fi
                    749: 
                    750: # Fix bogus #ifdef in <hsfs/hsnode.h> on SunOS 4.1.
                    751: file=hsfs/hsnode.h
                    752: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    753:   mkdir ${LIB}/hsfs 2>/dev/null
                    754:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    755:   chmod +w ${LIB}/$file 2>/dev/null
                    756:   chmod a+r ${LIB}/$file 2>/dev/null
                    757: fi
                    758: 
                    759: if [ -r ${LIB}/$file ]; then
                    760:   echo Fixing $file
                    761:   sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \
                    762:     ${LIB}/$file > ${LIB}/${file}.sed
                    763:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    764:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    765:     rm -f ${LIB}/$file
                    766:   fi
                    767: fi
                    768: 
                    769: # Fix bogus #ifdef in <hsfs/iso_spec.h> on SunOS 4.1.
                    770: file=hsfs/iso_spec.h
                    771: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    772:   mkdir ${LIB}/hsfs 2>/dev/null
                    773:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    774:   chmod +w ${LIB}/$file 2>/dev/null
                    775:   chmod a+r ${LIB}/$file 2>/dev/null
                    776: fi
                    777: 
                    778: if [ -r ${LIB}/$file ]; then
                    779:   echo Fixing $file
                    780:   sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
                    781:     ${LIB}/$file > ${LIB}/${file}.sed
                    782:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    783:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    784:     rm -f ${LIB}/$file
                    785:   fi
                    786: fi
                    787: 
                    788: # Incorrect #include in Sony News-OS 3.2.
                    789: file=machine/machparam.h
                    790: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    791:   mkdir ${LIB}/machine 2>/dev/null
                    792:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    793:   chmod +w ${LIB}/$file 2>/dev/null
                    794:   chmod a+r ${LIB}/$file 2>/dev/null
                    795: fi
                    796: 
                    797: if [ -r ${LIB}/$file ]; then
                    798:   echo Fixing $file, incorrect \#include
                    799:   sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \
                    800:     ${LIB}/$file > ${LIB}/${file}.
                    801:   rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
                    802:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    803:     rm -f ${LIB}/$file
                    804:   fi
                    805: fi
                    806: 
                    807: # Multiline comment after typedef on IRIX 4.0.1.
                    808: file=sys/types.h
                    809: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    810:   mkdir ${LIB}/sys 2>/dev/null
                    811:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    812:   chmod +w ${LIB}/$file 2>/dev/null
                    813:   chmod a+r ${LIB}/$file 2>/dev/null
                    814: fi
                    815: 
                    816: if [ -r ${LIB}/$file ]; then
                    817:   echo Fixing $file, comment in the middle of \#ifdef
                    818:   sed -e 's@type of the result@type of the result */@' \
                    819:     -e 's@of the sizeof@/* of the sizeof@' \
                    820:     ${LIB}/$file > ${LIB}/${file}.sed
                    821:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    822:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    823:     rm -f ${LIB}/$file
                    824:   fi
                    825: fi
                    826: 
                    827: # Fix line in IRIX 4.0.1 header file.  The sed script turns
                    828: # #define EM_CTRL              (CUTIOC|0x1)
                    829: # into
                    830: # #define EM_CTRL              (CUTIOC|0x'1')
                    831: file=sys/t3270reg.h
                    832: if [ -r ${LIB}/$file ]; then
                    833:   echo Fixing $file, overeager sed script
                    834:   sed -e "s/0x'1'/0x1/" ${LIB}/$file > ${LIB}/${file}.sed
                    835:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    836:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    837:     rm -f ${LIB}/$file
                    838:   fi
                    839: fi
                    840: 
                    841: # Turning // comments into /* */ comments trashes this IRIX 4.0.1
                    842: # header file, which embeds // comments inside multi-line /* */
                    843: # comments.  If this looks like the IRIX header file, we refix it by
                    844: # just throwing away the // comments.
                    845: file=fam.h
                    846: if [ -r ${LIB}/$file ]; then
                    847:   if egrep indigo.esd ${LIB}/$file > /dev/null; then
                    848:     echo Fixing $file, overeager sed script
                    849:     rm ${LIB}/$file
                    850:     sed -e 's|//.*$||g' $file > ${LIB}/$file
                    851:     chmod +w ${LIB}/$file 2>/dev/null
                    852:     chmod a+r ${LIB}/$file 2>/dev/null
                    853:   fi
                    854: fi
                    855: 
                    856: # Another IRIX 4.0.1 header file contains the string "//"
                    857: file=elf_abi.h
                    858: if [ -r ${LIB}/$file ]; then
                    859:   echo Fixing $file, overeager sed script
                    860:   sed -e 's|"/\*"\*/|"//"|' ${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
                    864:   fi
                    865: fi
                    866: 
                    867: # Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
                    868: # declaration on Sun OS 4.x.  We must only fix this on Sun OS 4.x, because
                    869: # many other systems have similar text but correct versions of the file.
                    870: # To ensure only Sun's is fixed, we grep for a likely unique string.
                    871: file=memory.h
                    872: if [ -r $file ] && egrep '/\*  @\(#\)memory\.h 1\.[2-4] 8./../.. SMI; from S5R2 1\.2   \*/' $file > /dev/null; then
                    873:   if [ ! -r ${LIB}/$file ]; then
                    874:     cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    875:     chmod +w ${LIB}/$file 2>/dev/null
                    876:     chmod a+r ${LIB}/$file 2>/dev/null
                    877:   fi
                    878:   if [ -r ${LIB}/$file ]; then
                    879:     echo Replacing $file
                    880:     cat > ${LIB}/$file << EOF
                    881: /* This file was generated by fixincludes */
                    882: #ifndef __memory_h__
                    883: #define __memory_h__
                    884: 
                    885: #ifdef __STDC__
                    886: extern void *memccpy();
                    887: extern void *memchr();
                    888: extern void *memcpy();
                    889: extern void *memset();
                    890: #else
                    891: extern char *memccpy();
                    892: extern char *memchr();
                    893: extern char *memcpy();
                    894: extern char *memset();
                    895: #endif /* __STDC__ */
                    896: 
                    897: extern int memcmp();
                    898: 
                    899: #endif /* __memory_h__ */
                    900: EOF
                    901:   fi
                    902: fi
                    903: 
                    904: # parameters not const on DECstation Ultrix V4.0.
                    905: file=stdio.h
                    906: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    907:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    908:   chmod +w ${LIB}/$file 2>/dev/null
                    909:   chmod a+r ${LIB}/$file 2>/dev/null
                    910: fi
                    911: 
                    912: if [ -r ${LIB}/$file ]; then
                    913:   echo Fixing $file, non-const arg
                    914:   sed -e 's@perror( char \*__s );@perror( const char *__s );@' \
                    915:       -e 's@fputs( char \*__s,@fputs( const char *__s,@' \
                    916:       -e 's@fopen( char \*__filename, char \*__type );@fopen( const char *__filename, const char *__type );@' \
                    917:       -e 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@' \
                    918:       -e 's@fscanf( FILE \*__stream, char \*__format,@fscanf( FILE *__stream, const char *__format,@' \
                    919:       -e 's@scanf( char \*__format,@scanf( const char *__format,@' \
                    920:       -e 's@sscanf( char \*__s, char \*__format,@sscanf( const char *__s, const char *__format,@' \
                    921:     ${LIB}/$file > ${LIB}/${file}.sed
                    922:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    923:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    924:     rm -f ${LIB}/$file
                    925:   fi
                    926: fi
                    927: 
                    928: # parameters conflict with C++ new on rs/6000 
                    929: file=stdio.h
                    930: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    931:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    932:   chmod +w ${LIB}/$file 2>/dev/null
                    933: fi
                    934: 
                    935: if [ -r ${LIB}/$file ]; then
                    936:   echo Fixing $file, parameter name conflicts
                    937:   sed -e 's@rename(const char \*old, const char \*new)@rename(const char *_old, const char *_new)@' \
                    938:     ${LIB}/$file > ${LIB}/${file}.sed
                    939:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    940:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    941:     rm -f ${LIB}/$file
                    942:   fi
                    943: fi
                    944: 
                    945: # Don't use or define the name va_list in stdio.h.
                    946: # This is for ANSI and also to interoperate properly with gvarargs.h.
                    947: file=stdio.h
                    948: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    949:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    950:   chmod +w ${LIB}/$file 2>/dev/null
                    951:   chmod a+r ${LIB}/$file 2>/dev/null
                    952: fi
                    953: 
                    954: if [ -r ${LIB}/$file ]; then
                    955:   echo Fixing $file, use of va_list
                    956:   # Arrange for stdio.h to use stdarg.h to define __gnuc_va_list
                    957:   (echo "#define __need___va_list"
                    958:    echo "#include <stdarg.h>") > ${LIB}/${file}.sed
                    959:   # Use __gnuc_va_list in arg types in place of va_list.
                    960:   # On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
                    961:   # trailing parentheses and semicolon save all other systems from this.
                    962:   # Define __va_list__ (something harmless and unused) instead of va_list.
                    963:   # Don't claim to have defined va_list.
                    964:   sed -e 's@ va_list @ __gnuc_va_list @' \
                    965:       -e 's@ va_list)@ __gnuc_va_list)@' \
                    966:       -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \
                    967:       -e 's@ va_list@ __va_list__@' \
                    968:       -e 's@\*va_list@*__va_list__@' \
                    969:       -e 's@VA_LIST@DUMMY_VA_LIST@' \
                    970:     ${LIB}/$file >> ${LIB}/${file}.sed
                    971:   
                    972:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                    973:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                    974:     rm -f ${LIB}/$file
                    975:   fi
                    976: fi
                    977: 
                    978: # Cancel out ansi_compat.h on Ultrix.  Replace it with empty file.
                    979: file=ansi_compat.h
                    980: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    981:   if grep -s ULTRIX $file; then
                    982:     echo "/* This file intentionally left blank.  */" > $LIB/$file
                    983:   fi
                    984: fi
                    985: 
                    986: # parameter to atof not const on DECstation Ultrix V4.0.
                    987: # also get rid of bogus inline definitions in HP-UX 8.0
                    988: file=math.h
                    989: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                    990:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    991:   chmod +w ${LIB}/$file 2>/dev/null
                    992:   chmod a+r ${LIB}/$file 2>/dev/null
                    993: fi
                    994: 
                    995: if [ -r ${LIB}/$file ]; then
                    996:   echo Fixing $file, non-const arg
                    997:   sed -e 's@atof( char \*__nptr );@atof( const char *__nptr );@' \
                    998:       -e 's@inline int abs(int d) { return (d>0)?d:-d; }@@' \
                    999:       -e 's@inline double abs(double d) { return fabs(d); }@@' \
                   1000:     ${LIB}/$file > ${LIB}/${file}.sed
                   1001:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1002:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1003:     rm -f ${LIB}/$file
                   1004:   fi
                   1005: fi
                   1006: 
                   1007: # In limits.h, put #ifndefs around things that are supposed to be defined
                   1008: # in float.h to avoid redefinition errors if float.h is included first.
                   1009: # On HP/UX this patch does not work, because on HP/UX limits.h uses
                   1010: # multi line comments and the inserted #endif winds up inside the
                   1011: # comment.  Fortunately, HP/UX already uses #ifndefs in limits.h; if
                   1012: # we find a #ifndef FLT_MIN we assume that all the required #ifndefs
                   1013: # are there, and we do not add them ourselves.
                   1014: file=limits.h
                   1015: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1016:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1017:   chmod +w ${LIB}/$file 2>/dev/null
                   1018:   chmod a+r ${LIB}/$file 2>/dev/null
                   1019: fi
                   1020: 
                   1021: if [ -r ${LIB}/$file ]; then
                   1022:   if egrep 'ifndef[    ]+FLT_MIN' ${LIB}/$file >/dev/null; then
                   1023:     true
                   1024:   else
                   1025:     echo Fixing $file
                   1026:     sed -e '/[         ]FLT_MIN[       ]/i\
                   1027: #ifndef FLT_MIN'\
                   1028:         -e '/[         ]FLT_MIN[       ]/a\
                   1029: #endif'\
                   1030:         -e '/[         ]FLT_MAX[       ]/i\
                   1031: #ifndef FLT_MAX'\
                   1032:         -e '/[         ]FLT_MAX[       ]/a\
                   1033: #endif'\
                   1034:         -e '/[         ]FLT_DIG[       ]/i\
                   1035: #ifndef FLT_DIG'\
                   1036:         -e '/[         ]FLT_DIG[       ]/a\
                   1037: #endif'\
                   1038:         -e '/[         ]DBL_MIN[       ]/i\
                   1039: #ifndef DBL_MIN'\
                   1040:         -e '/[         ]DBL_MIN[       ]/a\
                   1041: #endif'\
                   1042:         -e '/[         ]DBL_MAX[       ]/i\
                   1043: #ifndef DBL_MAX'\
                   1044:         -e '/[         ]DBL_MAX[       ]/a\
                   1045: #endif'\
                   1046:         -e '/[         ]DBL_DIG[       ]/i\
                   1047: #ifndef DBL_DIG'\
                   1048:         -e '/[         ]DBL_DIG[       ]/a\
                   1049: #endif'\
                   1050:       ${LIB}/$file > ${LIB}/${file}.sed
                   1051:     rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1052:   fi
                   1053:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1054:     echo Deleting ${LIB}/$file\; no fixes were needed.
                   1055:     rm -f ${LIB}/$file
                   1056:   fi
                   1057: fi
                   1058: 
                   1059: # These two files on SunOS 4 are included by other files
                   1060: # in the same directory, using "...".  So we must make sure they exist
                   1061: # in the same directory as the other fixed files.
                   1062: if [ -r ${INPUT}/multimedia/audio_errno.h ]
                   1063: then
                   1064:   ln -s ${INPUT}/multimedia/audio_errno.h ${LIB}/multimedia 2>/dev/null
                   1065: fi
                   1066: if [ -r ${INPUT}/multimedia/audio_hdr.h ]
                   1067: then
                   1068:   ln -s ${INPUT}/multimedia/audio_hdr.h ${LIB}/multimedia 2>/dev/null
                   1069: fi
                   1070: 
                   1071: # These files on Ultrix 4.2 put comments around instances of #endif
                   1072: # __mips.  When the sed expression turns that into #endif /* __mips */
                   1073: # the comment ends prematurely.
                   1074: for file in sys/audit.h sys/signal.h; do
                   1075:   if [ -r ${LIB}/${file} ]; then
                   1076:     echo Fixing $file, early comment termination
                   1077:     sed -e 's|^#endif /\*.*\*/|#endif|g' ${LIB}/${file} > ${LIB}/${file}.sed
                   1078:     rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1079:   fi
                   1080: done
                   1081: 
                   1082: # This file in RISC/os uses /**/ to concatenate two tokens.
                   1083: file=bsd43/bsd43_.h
                   1084: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
                   1085:   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
                   1086:   chmod +w ${LIB}/$file 2>/dev/null
                   1087:   chmod a+r ${LIB}/$file 2>/dev/null
                   1088: fi
                   1089: if [ -r ${LIB}/$file ]; then
                   1090:   sed -e 's|/\*\*/|##|' ${LIB}/$file > ${LIB}/${file}.sed
                   1091:   rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
                   1092:   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
                   1093:     rm -f ${LIB}/$file
                   1094:   fi
                   1095: fi
                   1096: 
                   1097: echo 'Removing unneeded directories:'
                   1098: cd $LIB
                   1099: files=`find . -type d -print | sort -r`
                   1100: for file in $files; do
                   1101:   rmdir $LIB/$file > /dev/null 2>&1
                   1102: done
                   1103: 
                   1104: if $LINKS; then
                   1105:   echo 'Making internal symbolic non-directory links'
                   1106:   cd ${INPUT}
                   1107:   files=`find . -type l -print`
                   1108:   for file in $files; do
                   1109:     dest=`ls -ld $file | sed -n 's/.*-> //p'`
                   1110:     if expr "$dest" : '[^/].*' > /dev/null; then    
                   1111:       target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
                   1112:       if [ -f $target ]; then
                   1113:         ln -s $dest ${LIB}/$file >/dev/null 2>&1
                   1114:       fi
                   1115:     fi
                   1116:   done
                   1117: fi
                   1118: 
                   1119: echo 'Cleaning up DONE files.'
                   1120: cd $LIB
                   1121: find . -name DONE -exec rm -f {} ';'
                   1122: 
                   1123: exit 0

unix.superglobalmegacorp.com

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