Annotation of gcc/fixinc.svr4, revision 1.1.1.2

1.1       root        1: #! /bin/sh
                      2: #
                      3: #   fixinc.svr4  --  Install modified versions of certain ANSI-incompatible
                      4: #   native System V Release 4 system include files.
                      5: #
                      6: #   Written by Ron Guilmette ([email protected]).
                      7: #
                      8: # This file is part of GNU CC.
                      9: # 
                     10: # GNU CC is free software; you can redistribute it and/or modify
                     11: # it under the terms of the GNU General Public License as published by
                     12: # the Free Software Foundation; either version 2, or (at your option)
                     13: # any later version.
                     14: # 
                     15: # GNU CC is distributed in the hope that it will be useful,
                     16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     18: # GNU General Public License for more details.
                     19: # 
                     20: # You should have received a copy of the GNU General Public License
                     21: # along with GNU CC; see the file COPYING.  If not, write to
                     22: # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
                     23: #
                     24: #      This script munges the native include files provided with System V
                     25: #      Release 4 systems so as to remove things which are violations of the
                     26: #      ANSI C standard.  Once munged, the resulting new system include files
                     27: #      are placed in a directory that GNU C will search *before* searching
                     28: #      the /usr/include directory. This script should work properly for most
                     29: #      System V Release 4 systems.  For other types of systems, you should
                     30: #      use the `fixincludes' script instead.
                     31: #
                     32: #      See README-fixinc for more information.
                     33: 
                     34: # Directory containing the original header files.
                     35: INPUT=${2-${INPUT-/usr/include}}
                     36: 
                     37: # Fail if no arg to specify a directory for the output.
                     38: if [ x$1 = x ]
                     39: then echo fixincludes: no output directory specified
                     40: exit 1
                     41: fi
                     42: 
                     43: # Directory in which to store the results.
                     44: LIB=${1-${LIB-/usr/local/lib/gcc-include}}
                     45: 
                     46: # Make sure it exists.
                     47: if [ ! -d $LIB ]; then
                     48:   mkdir $LIB || exit 1
                     49: fi
                     50: 
                     51: ORIG_DIR=`pwd`
                     52: 
                     53: # Make LIB absolute.
                     54: cd $LIB; LIB=`pwd`
                     55: 
                     56: # This prevents /bin/ex from failing if the current terminal type is
                     57: # unrecognizable.
                     58: TERM=unknown
                     59: export TERM
                     60: 
                     61: echo 'Building fixincludes in ' ${LIB}
                     62: 
1.1.1.2 ! root       63: # Determine whether this filesystem has symbolic links.
1.1       root       64: if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
                     65:   rm -f $LIB/ShouldNotExist
                     66:   LINKS=true
                     67: else
                     68:   LINKS=false
                     69: fi
                     70: 
                     71: echo 'Making directories:'
                     72: cd ${INPUT}
                     73: if $LINKS; then
                     74:   files=`ls -LR | sed -n s/:$//p`
                     75: else
                     76:   files=`find . -type d -print | sed '/^.$/d'`
                     77: fi
                     78: for file in $files; do
                     79:   rm -rf $LIB/$file
                     80:   if [ ! -d $LIB/$file ]
                     81:   then mkdir $LIB/$file
                     82:   fi
                     83: done
                     84: 
                     85: # treetops gets an alternating list
                     86: # of old directories to copy
                     87: # and the new directories to copy to.
                     88: treetops="${INPUT} ${LIB}"
                     89: 
                     90: if $LINKS; then
                     91:   echo 'Making internal symbolic directory links'
                     92:   for file in $files; do
                     93:     dest=`ls -ld $file | sed -n 's/.*-> //p'`
                     94:     if [ "$dest" ]; then    
                     95:       cwd=`pwd`
                     96:       # In case $dest is relative, get to $file's dir first.
                     97:       cd ${INPUT}
                     98:       cd `echo ./$file | sed -n 's&[^/]*$&&p'`
                     99:       # Check that the target directory exists.
                    100:       # Redirections changed to avoid bug in sh on Ultrix.
                    101:       (cd $dest) > /dev/null 2>&1
                    102:       if [ $? = 0 ]; then
                    103:        cd $dest
                    104:        # X gets the dir that the link actually leads to.
                    105:        x=`pwd`
                    106:        # If link leads back into ${INPUT},
                    107:        # make a similar link here.
                    108:        if expr $x : "${INPUT}/.*" > /dev/null; then
                    109:          # Y gets the actual target dir name, relative to ${INPUT}.
                    110:          y=`echo $x | sed -n "s&${INPUT}/&&p"`
                    111:          echo $file '->' $y ': Making link'
                    112:          rm -fr ${LIB}/$file > /dev/null 2>&1
                    113:          ln -s ${LIB}/$y ${LIB}/$file > /dev/null 2>&1
                    114:        else
                    115:          # If the link is to outside ${INPUT},
                    116:          # treat this directory as if it actually contained the files.
                    117: # This line used to have $dest instead of $x.
                    118: # $dest seemed to be wrong for links found in subdirectories
                    119: # of ${INPUT}.  Does this change break anything?
                    120:          treetops="$treetops $x ${LIB}/$file"
                    121:        fi
                    122:       fi
                    123:       cd $cwd
                    124:     fi
                    125:   done
                    126: fi
                    127: 
                    128: set - $treetops
                    129: while [ $# != 0 ]; do
                    130:   # $1 is an old directory to copy, and $2 is the new directory to copy to.
                    131:   echo "Finding header files in $1:"
                    132:   cd ${INPUT}
                    133:   cd $1
                    134:   files=`find . -name '*.h' -type f -print`
                    135:   echo 'Checking header files:'
                    136:   for file in $files; do
                    137:       echo Fixing $file
                    138:       if [ -r $file ]; then
                    139:        cp $file $2/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    140:        chmod +w $2/$file
                    141: 
                    142: # The following have been removed from the sed command below
                    143: # because it is more useful to leave these things in.
                    144: # The only reason to remove them was for -pedantic,
                    145: # which isn't much of a reason. -- rms.
                    146: #        /^[   ]*#[    ]*ident/d
                    147: 
                    148: # The change of u_char, etc, to u_int
                    149: # applies to bit fields.
                    150:        sed -e '
1.1.1.2 ! root      151:          s%^\([        ]*#[    ]*endif[        ]*\)\([^/       ].*\)$%\1/* \2 */%
        !           152:          s%^\([        ]*#[    ]*else[         ]*\)\([^/       ].*\)$%\1/* \2 */%
1.1       root      153:          s/#lint(on)/defined(lint)/g
                    154:          s/#lint(off)/!defined(lint)/g
                    155:          s/#machine(\([^)]*\))/defined(__\1__)/g
                    156:          s/#system(\([^)]*\))/defined(__\1__)/g
                    157:          s/#cpu(\([^)]*\))/defined(__\1__)/g
1.1.1.2 ! root      158:          /#[a-z]*if.*[  (]m68k/                s/\([^_]\)m68k/\1__m68k__/g
        !           159:          /#[a-z]*if.*[  (]__i386/      s/__i386/__i386__/g
        !           160:          /#[a-z]*if.*[  (]i386/                s/\([^_]\)i386/\1__i386__/g
        !           161:          /#[a-z]*if.*[  (]sparc/       s/\([^_]\)sparc/\1__sparc__/g
        !           162:          /#[a-z]*if.*[  (]mc68000/     s/\([^_]\)mc68000/\1__mc68000__/g
        !           163:          /#[a-z]*if.*[  (]vax/         s/\([^_]\)vax/\1__vax__/g
        !           164:          /#[a-z]*if.*[  (]sun/         s/\([^_]\)\(sun[a-z0-9]*\)\([^a-z0-9_]\)/\1__\2__\3/g
        !           165:          /#[a-z]*if.*[  (]sun/         s/\([^_]\)\(sun[a-z0-9]*\)$/\1__\2__/g
        !           166:          /#[a-z]*if.*[  (]ns32000/     s/\([^_]\)ns32000/\1__ns32000__/g
        !           167:          /#[a-z]*if.*[  (]pyr/         s/\([^_]\)pyr/\1__pyr__/g
        !           168:          /#[a-z]*if.*[  (]is68k/       s/\([^_]\)is68k/\1__is68k__/g
1.1       root      169:          s/u_char\([   ][      ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[    ]*:[    ]*[0-9][0-9]*\)/u_int\1/
                    170:          s/u_short\([  ][      ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[    ]*:[    ]*[0-9][0-9]*\)/u_int\1/
                    171:          s/ushort\([   ][      ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[    ]*:[    ]*[0-9][0-9]*\)/u_int\1/
                    172:          s/evcm_t\([   ][      ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[    ]*:[    ]*[0-9][0-9]*\)/u_int\1/
                    173:          s/Pbyte\([    ][      ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[    ]*:[    ]*SEQSIZ\)/unsigned int\1/
                    174:          s/__STDC__ == 0/!defined (__STRICT_ANSI__)/g
                    175:          s/__STDC__ != 0/defined (__STRICT_ANSI__)/g
                    176:          s/__STDC__ - 0 == 0/!defined (__STRICT_ANSI__)/g
                    177:        ' $2/$file > $2/$file.sed
                    178:        mv $2/$file.sed $2/$file
                    179:        if cmp $file $2/$file >/dev/null 2>&1; then
                    180:           echo Deleting $2/$file\; no fixes were needed.
                    181:           rm $2/$file
                    182:        fi
                    183:       fi
                    184:   done
                    185:   shift; shift
                    186: done
                    187: 
                    188: # Fix first broken decl of getcwd present on some svr4 systems.
                    189: 
                    190: file=stdlib.h
                    191: base=`basename $file`
                    192: if [ -r ${LIB}/$file ]; then
                    193:   file_to_fix=${LIB}/$file
                    194: else
                    195:   if [ -r ${INPUT}/$file ]; then
                    196:     file_to_fix=${INPUT}/$file
                    197:   else
                    198:     file_to_fix=""
                    199:   fi
                    200: fi
                    201: if [ \! -z "$file_to_fix" ]; then
                    202:   echo Checking $file_to_fix
                    203:   sed -e 's/getcwd(char \*, int)/getcwd(char *, size_t)/' $file_to_fix > /tmp/$base
                    204:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    205:     echo No change needed in $file_to_fix
                    206:   else
                    207:     echo Fixed $file_to_fix
                    208:     rm -f ${LIB}/$file
                    209:     cp /tmp/$base ${LIB}/$file
                    210:   fi
                    211:   rm -f /tmp/$base
                    212: fi
                    213: 
                    214: # Fix second broken decl of getcwd present on some svr4 systems.  Also
                    215: # fix the incorrect decl of profil present on some svr4 systems.
                    216: 
                    217: file=unistd.h
                    218: base=`basename $file`
                    219: if [ -r ${LIB}/$file ]; then
                    220:   file_to_fix=${LIB}/$file
                    221: else
                    222:   if [ -r ${INPUT}/$file ]; then
                    223:     file_to_fix=${INPUT}/$file
                    224:   else
                    225:     file_to_fix=""
                    226:   fi
                    227: fi
                    228: if [ \! -z "$file_to_fix" ]; then
                    229:   echo Checking $file_to_fix
                    230:   sed -e 's/getcwd(char \*, int)/getcwd(char *, size_t)/' $file_to_fix \
                    231:     | sed -e 's/profil(unsigned short \*, unsigned int, unsigned int, unsigned int)/profil(unsigned short *, size_t, int, unsigned)/' > /tmp/$base
                    232:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    233:     echo No change needed in $file_to_fix
                    234:   else
                    235:     echo Fixed $file_to_fix
                    236:     rm -f ${LIB}/$file
                    237:     cp /tmp/$base ${LIB}/$file
                    238:   fi
                    239:   rm -f /tmp/$base
                    240: fi
                    241: 
                    242: # Fix the definition of NULL in <sys/param.h> so that it is conditional
                    243: # and so that it is correct for both C and C++.
                    244: 
                    245: file=sys/param.h
                    246: base=`basename $file`
                    247: if [ -r ${LIB}/$file ]; then
                    248:   file_to_fix=${LIB}/$file
                    249: else
                    250:   if [ -r ${INPUT}/$file ]; then
                    251:     file_to_fix=${INPUT}/$file
                    252:   else
                    253:     file_to_fix=""
                    254:   fi
                    255: fi
                    256: if [ \! -z "$file_to_fix" ]; then
                    257:   echo Checking $file_to_fix
                    258:   cp $file_to_fix /tmp/$base
                    259:   chmod +w /tmp/$base
                    260:   ex /tmp/$base <<EOF
                    261:   /^#define[   ]*NULL[         ]*0$/c
                    262: #ifndef NULL
                    263: #ifdef __cplusplus
                    264: #define __NULL_TYPE
                    265: #else /* !defined(__cplusplus) */
                    266: #define __NULL_TYPE (void *)
                    267: #endif /* !defined(__cplusplus) */
                    268: #define NULL (__NULL_TYPE 0)
                    269: #endif /* !defined(NULL) */
                    270: .
                    271:   wq
                    272: EOF
                    273:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    274:     echo No change needed in $file_to_fix
                    275:   else
                    276:     echo Fixed $file_to_fix
                    277:     rm -f ${LIB}/$file
                    278:     cp /tmp/$base ${LIB}/$file
                    279:   fi
                    280:   rm -f /tmp/$base
                    281: fi
                    282: 
                    283: # Likewise fix the definition of NULL in <stdio.h> so that it is conditional
                    284: # and so that it is correct for both C and C++.
                    285: 
                    286: file=stdio.h
                    287: base=`basename $file`
                    288: if [ -r ${LIB}/$file ]; then
                    289:   file_to_fix=${LIB}/$file
                    290: else
                    291:   if [ -r ${INPUT}/$file ]; then
                    292:     file_to_fix=${INPUT}/$file
                    293:   else
                    294:     file_to_fix=""
                    295:   fi
                    296: fi
                    297: if [ \! -z "$file_to_fix" ]; then
                    298:   echo Checking $file_to_fix
                    299:   cp $file_to_fix /tmp/$base
                    300:   chmod +w /tmp/$base
                    301:   ex /tmp/$base <<EOF
                    302:   /^#define[   ]*NULL[         ]*0$/c
                    303: #ifdef __cplusplus
                    304: #define __NULL_TYPE
                    305: #else /* !defined(__cplusplus) */
                    306: #define __NULL_TYPE (void *)
                    307: #endif /* !defined(__cplusplus) */
                    308: #define NULL (__NULL_TYPE 0)
                    309: .
                    310:   wq
                    311: EOF
                    312:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    313:     echo No change needed in $file_to_fix
                    314:   else
                    315:     echo Fixed $file_to_fix
                    316:     rm -f ${LIB}/$file
                    317:     cp /tmp/$base ${LIB}/$file
                    318:   fi
                    319:   rm -f /tmp/$base
                    320: fi
                    321: 
                    322: # Add some missing declarations to <sys/mman.h>.
                    323: 
                    324: file=sys/mman.h
                    325: base=`basename $file`
                    326: if [ -r ${LIB}/$file ]; then
                    327:   file_to_fix=${LIB}/$file
                    328: else
                    329:   if [ -r ${INPUT}/$file ]; then
                    330:     file_to_fix=${INPUT}/$file
                    331:   else
                    332:     file_to_fix=""
                    333:   fi
                    334: fi
                    335: if [ \! -z "$file_to_fix" ]; then
                    336:   echo Checking $file_to_fix
                    337:   cp $file_to_fix /tmp/$base
                    338:   chmod +w /tmp/$base
                    339:   ex /tmp/$base <<EOF
                    340:   /^extern caddr_t mmap();$/c
                    341: #ifdef __STDC__
                    342: extern caddr_t mmap (caddr_t addr, size_t len, int prot, int flags,
                    343:                      int fd, off_t off);
                    344: #else /* !defined(__STDC__) */
                    345: extern caddr_t mmap ();
                    346: #endif /* !defined(__STDC__) */
                    347: .
                    348:   wq
                    349: EOF
                    350:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    351:     echo No changed needed in $file_to_fix
                    352:   else
                    353:     echo Fixed $file_to_fix
                    354:     rm -f ${LIB}/$file
                    355:     cp /tmp/$base ${LIB}/$file
                    356:   fi
                    357:   rm -f /tmp/$base
                    358: fi
                    359: 
                    360: # Fix declarations of `ftw' and `nftw' in <ftw.h>.
                    361: 
                    362: file=ftw.h
                    363: base=`basename $file`
                    364: if [ -r ${LIB}/$file ]; then
                    365:   file_to_fix=${LIB}/$file
                    366: else
                    367:   if [ -r ${INPUT}/$file ]; then
                    368:     file_to_fix=${INPUT}/$file
                    369:   else
                    370:     file_to_fix=""
                    371:   fi
                    372: fi
                    373: if [ \! -z "$file_to_fix" ]; then
                    374:   echo Checking $file_to_fix
                    375:   cp $file_to_fix /tmp/$base
                    376:   chmod +w /tmp/$base
                    377:   ex /tmp/$base <<EOF
                    378:   /^extern int ftw(const/c
                    379: #if !defined(_STYPES)
                    380: static
                    381: #else
                    382: extern
                    383: #endif
                    384:   int ftw(const char *, int (*)(const char *, const struct stat *, int), int);
                    385: .
                    386:   /^extern int nftw/c
                    387: #if defined(_STYPES)
                    388: static
                    389: #else
                    390: extern
                    391: #endif
                    392:   int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *),int, int);
                    393: .
                    394:   /^extern int ftw(),/c
                    395: #if !defined(_STYPES)
                    396: static
                    397: #else
                    398: extern
                    399: #endif
                    400:   int ftw();
                    401: #if defined(_STYPES)
                    402: static
                    403: #else
                    404: extern
                    405: #endif
                    406:   int nftw();
                    407: .
                    408:   wq
                    409: EOF
                    410:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    411:     echo No change needed in $file_to_fix
                    412:   else
                    413:     echo Fixed $file_to_fix
                    414:     rm -f ${LIB}/$file
                    415:     cp /tmp/$base ${LIB}/$file
                    416:   fi
                    417:   rm -f /tmp/$base
                    418: fi
                    419: 
                    420: # Add a `static' declaration of `getrnge' into <regexp.h>.
                    421: 
                    422: file=regexp.h
                    423: base=`basename $file`
                    424: if [ -r ${LIB}/$file ]; then
                    425:   file_to_fix=${LIB}/$file
                    426: else
                    427:   if [ -r ${INPUT}/$file ]; then
                    428:     file_to_fix=${INPUT}/$file
                    429:   else
                    430:     file_to_fix=""
                    431:   fi
                    432: fi
                    433: if [ \! -z "$file_to_fix" ]; then
                    434:   echo Checking $file_to_fix
                    435:   cp $file_to_fix /tmp/$base
                    436:   chmod +w /tmp/$base
                    437:   ex /tmp/$base <<EOF
                    438:   /^static int[        ]*size;/c
                    439: static int     size ;
                    440: 
                    441: static int getrnge ();
                    442: .
                    443:   wq
                    444: EOF
                    445:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    446:     echo No change needed in $file_to_fix
                    447:   else
                    448:     echo Fixed $file_to_fix
                    449:     rm -f ${LIB}/$file
                    450:     cp /tmp/$base ${LIB}/$file
                    451:   fi
                    452:   rm -f /tmp/$base
                    453: fi
                    454: 
                    455: # Add a #define of _SIGACTION_ into <sys/signal.h>.
                    456: 
                    457: file=sys/signal.h
                    458: base=`basename $file`
                    459: if [ -r ${LIB}/$file ]; then
                    460:   file_to_fix=${LIB}/$file
                    461: else
                    462:   if [ -r ${INPUT}/$file ]; then
                    463:     file_to_fix=${INPUT}/$file
                    464:   else
                    465:     file_to_fix=""
                    466:   fi
                    467: fi
                    468: if [ \! -z "$file_to_fix" ]; then
                    469:   echo Checking $file_to_fix
                    470:   cp $file_to_fix /tmp/$base
                    471:   chmod +w /tmp/$base
                    472:   ex /tmp/$base <<EOF
                    473:   /^struct sigaction {/c
                    474: #define _SIGACTION_
                    475: struct  sigaction  {
                    476: .
                    477:   wq
                    478: EOF
                    479:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    480:     echo No change needed in $file_to_fix
                    481:   else
                    482:     echo Fixed $file_to_fix
                    483:     rm -f ${LIB}/$file
                    484:     cp /tmp/$base ${LIB}/$file
                    485:   fi
                    486:   rm -f /tmp/$base
                    487: fi
                    488: 
                    489: # Fix declarations of `makedev', `major', and `minor' in <sys/mkdev.h>.
                    490: 
                    491: file=sys/mkdev.h
                    492: base=`basename $file`
                    493: if [ -r ${LIB}/$file ]; then
                    494:   file_to_fix=${LIB}/$file
                    495: else
                    496:   if [ -r ${INPUT}/$file ]; then
                    497:     file_to_fix=${INPUT}/$file
                    498:   else
                    499:     file_to_fix=""
                    500:   fi
                    501: fi
                    502: if [ \! -z "$file_to_fix" ]; then
                    503:   echo Checking $file_to_fix
                    504:   cp $file_to_fix /tmp/$base
                    505:   chmod +w /tmp/$base
                    506:   ex /tmp/$base <<EOF
                    507:   /^dev_t makedev(const/c
                    508: static dev_t makedev(const major_t, const minor_t);
                    509: .
                    510:   /^dev_t makedev()/c
                    511: static dev_t makedev();
                    512: .
                    513:   /^major_t major(const/c
                    514: static major_t major(const dev_t);
                    515: .
                    516:   /^major_t major()/c
                    517: static major_t major();
                    518: .
                    519:   /^minor_t minor(const/c
                    520: static minor_t minor(const dev_t);
                    521: .
                    522:   /^minor_t minor()/c
                    523: static minor_t minor();
                    524: .
                    525:   wq
                    526: EOF
                    527:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    528:     echo No change needed in $file_to_fix
                    529:   else
                    530:     echo Fixed $file_to_fix
                    531:     rm -f ${LIB}/$file
                    532:     cp /tmp/$base ${LIB}/$file
                    533:   fi
                    534:   rm -f /tmp/$base
                    535: fi
                    536: 
                    537: # Fix reference to NMSZ in <sys/adv.h>.
                    538: 
                    539: file=sys/adv.h
                    540: base=`basename $file`
                    541: if [ -r ${LIB}/$file ]; then
                    542:   file_to_fix=${LIB}/$file
                    543: else
                    544:   if [ -r ${INPUT}/$file ]; then
                    545:     file_to_fix=${INPUT}/$file
                    546:   else
                    547:     file_to_fix=""
                    548:   fi
                    549: fi
                    550: if [ \! -z "$file_to_fix" ]; then
                    551:   echo Checking $file_to_fix
                    552:   sed 's/\[NMSZ\]/\[RFS_NMSZ\]/g' $file_to_fix > /tmp/$base
                    553:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    554:     echo No change needed in $file_to_fix
                    555:   else
                    556:     echo Fixed $file_to_fix
                    557:     rm -f ${LIB}/$file
                    558:     cp /tmp/$base ${LIB}/$file
                    559:   fi
                    560:   rm -f /tmp/$base
                    561: fi
                    562: 
                    563: # Fix reference to NC_NPI_RAW in <sys/netcspace.h>.  Also fix types of
                    564: # array initializers.
                    565: 
                    566: file=sys/netcspace.h
                    567: base=`basename $file`
                    568: if [ -r ${LIB}/$file ]; then
                    569:   file_to_fix=${LIB}/$file
                    570: else
                    571:   if [ -r ${INPUT}/$file ]; then
                    572:     file_to_fix=${INPUT}/$file
                    573:   else
                    574:     file_to_fix=""
                    575:   fi
                    576: fi
                    577: if [ \! -z "$file_to_fix" ]; then
                    578:   echo Checking $file_to_fix
                    579:   sed 's/NC_NPI_RAW/NC_TPI_RAW/g' $file_to_fix \
                    580:     | sed 's/NC_/(unsigned long) NC_/' > /tmp/$base
                    581:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    582:     echo No change needed in $file_to_fix
                    583:   else
                    584:     echo Fixed $file_to_fix
                    585:     rm -f ${LIB}/$file
                    586:     cp /tmp/$base ${LIB}/$file
                    587:   fi
                    588:   rm -f /tmp/$base
                    589: fi
                    590: 
                    591: # Conditionalize all of <fs/rfs/rf_cache.h> on _KERNEL being defined.
                    592: 
                    593: file=fs/rfs/rf_cache.h
                    594: base=`basename $file`
                    595: if [ -r ${LIB}/$file ]; then
                    596:   file_to_fix=${LIB}/$file
                    597: else
                    598:   if [ -r ${INPUT}/$file ]; then
                    599:     file_to_fix=${INPUT}/$file
                    600:   else
                    601:     file_to_fix=""
                    602:   fi
                    603: fi
                    604: if [ \! -z "$file_to_fix" ]; then
                    605:   echo Checking $file_to_fix
                    606:   if grep _KERNEL $file_to_fix > /dev/null; then
                    607:     echo No change needed in $file_to_fix
                    608:   else
                    609:     echo '#ifdef _KERNEL' > /tmp/$base
                    610:     cat $file_to_fix >> /tmp/$base
                    611:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    612:     echo Fixed $file_to_fix
                    613:     rm -f ${LIB}/$file
                    614:     cp /tmp/$base ${LIB}/$file
                    615:     rm -f /tmp/$base
                    616:   fi
                    617: fi
                    618: 
                    619: # Conditionalize all of <sys/erec.h> on _KERNEL being defined.
                    620: 
                    621: file=sys/erec.h
                    622: base=`basename $file`
                    623: if [ -r ${LIB}/$file ]; then
                    624:   file_to_fix=${LIB}/$file
                    625: else
                    626:   if [ -r ${INPUT}/$file ]; then
                    627:     file_to_fix=${INPUT}/$file
                    628:   else
                    629:     file_to_fix=""
                    630:   fi
                    631: fi
                    632: if [ \! -z "$file_to_fix" ]; then
                    633:   echo Checking $file_to_fix
                    634:   if grep _KERNEL $file_to_fix > /dev/null; then
                    635:     echo No change needed in $file_to_fix
                    636:   else
                    637:     echo '#ifdef _KERNEL' > /tmp/$base
                    638:     cat $file_to_fix >> /tmp/$base
                    639:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    640:     echo Fixed $file_to_fix
                    641:     rm -f ${LIB}/$file
                    642:     cp /tmp/$base ${LIB}/$file
                    643:     rm -f /tmp/$base
                    644:   fi
                    645: fi
                    646: 
                    647: # Conditionalize all of <sys/err.h> on _KERNEL being defined.
                    648: 
                    649: file=sys/err.h
                    650: base=`basename $file`
                    651: if [ -r ${LIB}/$file ]; then
                    652:   file_to_fix=${LIB}/$file
                    653: else
                    654:   if [ -r ${INPUT}/$file ]; then
                    655:     file_to_fix=${INPUT}/$file
                    656:   else
                    657:     file_to_fix=""
                    658:   fi
                    659: fi
                    660: if [ \! -z "$file_to_fix" ]; then
                    661:   echo Checking $file_to_fix
                    662:   if grep _KERNEL $file_to_fix > /dev/null; then
                    663:     echo No change needed in $file_to_fix
                    664:   else
                    665:     echo '#ifdef _KERNEL' > /tmp/$base
                    666:     cat $file_to_fix >> /tmp/$base
                    667:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    668:     echo Fixed $file_to_fix
                    669:     rm -f ${LIB}/$file
                    670:     cp /tmp/$base ${LIB}/$file
                    671:     rm -f /tmp/$base
                    672:   fi
                    673: fi
                    674: 
                    675: # Conditionalize all of <sys/char.h> on _KERNEL being defined.
                    676: 
                    677: file=sys/char.h
                    678: base=`basename $file`
                    679: if [ -r ${LIB}/$file ]; then
                    680:   file_to_fix=${LIB}/$file
                    681: else
                    682:   if [ -r ${INPUT}/$file ]; then
                    683:     file_to_fix=${INPUT}/$file
                    684:   else
                    685:     file_to_fix=""
                    686:   fi
                    687: fi
                    688: if [ \! -z "$file_to_fix" ]; then
                    689:   echo Checking $file_to_fix
                    690:   if grep _KERNEL $file_to_fix > /dev/null; then
                    691:     echo No change needed in $file_to_fix
                    692:   else
                    693:     echo '#ifdef _KERNEL' > /tmp/$base
                    694:     cat $file_to_fix >> /tmp/$base
                    695:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    696:     echo Fixed $file_to_fix
                    697:     rm -f ${LIB}/$file
                    698:     cp /tmp/$base ${LIB}/$file
                    699:     rm -f /tmp/$base
                    700:   fi
                    701: fi
                    702: 
                    703: # Conditionalize all of <sys/getpages.h> on _KERNEL being defined.
                    704: 
                    705: file=sys/getpages.h
                    706: base=`basename $file`
                    707: if [ -r ${LIB}/$file ]; then
                    708:   file_to_fix=${LIB}/$file
                    709: else
                    710:   if [ -r ${INPUT}/$file ]; then
                    711:     file_to_fix=${INPUT}/$file
                    712:   else
                    713:     file_to_fix=""
                    714:   fi
                    715: fi
                    716: if [ \! -z "$file_to_fix" ]; then
                    717:   echo Checking $file_to_fix
                    718:   if grep _KERNEL $file_to_fix > /dev/null; then
                    719:     echo No change needed in $file_to_fix
                    720:   else
                    721:     echo '#ifdef _KERNEL' > /tmp/$base
                    722:     cat $file_to_fix >> /tmp/$base
                    723:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    724:     echo Fixed $file_to_fix
                    725:     rm -f ${LIB}/$file
                    726:     cp /tmp/$base ${LIB}/$file
                    727:     rm -f /tmp/$base
                    728:   fi
                    729: fi
                    730: 
                    731: # Conditionalize all of <sys/map.h> on _KERNEL being defined.
                    732: 
                    733: file=sys/map.h
                    734: base=`basename $file`
                    735: if [ -r ${LIB}/$file ]; then
                    736:   file_to_fix=${LIB}/$file
                    737: else
                    738:   if [ -r ${INPUT}/$file ]; then
                    739:     file_to_fix=${INPUT}/$file
                    740:   else
                    741:     file_to_fix=""
                    742:   fi
                    743: fi
                    744: if [ \! -z "$file_to_fix" ]; then
                    745:   echo Checking $file_to_fix
                    746:   if grep _KERNEL $file_to_fix > /dev/null; then
                    747:     echo No change needed in $file_to_fix
                    748:   else
                    749:     echo '#ifdef _KERNEL' > /tmp/$base
                    750:     cat $file_to_fix >> /tmp/$base
                    751:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    752:     echo Fixed $file_to_fix
                    753:     rm -f ${LIB}/$file
                    754:     cp /tmp/$base ${LIB}/$file
                    755:     rm -f /tmp/$base
                    756:   fi
                    757: fi
                    758: 
                    759: # Conditionalize all of <sys/cmn_err.h> on _KERNEL being defined.
                    760: 
                    761: file=sys/cmn_err.h
                    762: base=`basename $file`
                    763: if [ -r ${LIB}/$file ]; then
                    764:   file_to_fix=${LIB}/$file
                    765: else
                    766:   if [ -r ${INPUT}/$file ]; then
                    767:     file_to_fix=${INPUT}/$file
                    768:   else
                    769:     file_to_fix=""
                    770:   fi
                    771: fi
                    772: if [ \! -z "$file_to_fix" ]; then
                    773:   echo Checking $file_to_fix
                    774:   if grep _KERNEL $file_to_fix > /dev/null; then
                    775:     echo No change needed in $file_to_fix
                    776:   else
                    777:     echo '#ifdef _KERNEL' > /tmp/$base
                    778:     cat $file_to_fix >> /tmp/$base
                    779:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    780:     echo Fixed $file_to_fix
                    781:     rm -f ${LIB}/$file
                    782:     cp /tmp/$base ${LIB}/$file
                    783:     rm -f /tmp/$base
                    784:   fi
                    785: fi
                    786: 
                    787: # Conditionalize all of <sys/kdebugger.h> on _KERNEL being defined.
                    788: 
                    789: file=sys/kdebugger.h
                    790: base=`basename $file`
                    791: if [ -r ${LIB}/$file ]; then
                    792:   file_to_fix=${LIB}/$file
                    793: else
                    794:   if [ -r ${INPUT}/$file ]; then
                    795:     file_to_fix=${INPUT}/$file
                    796:   else
                    797:     file_to_fix=""
                    798:   fi
                    799: fi
                    800: if [ \! -z "$file_to_fix" ]; then
                    801:   echo Checking $file_to_fix
                    802:   if grep _KERNEL $file_to_fix > /dev/null; then
                    803:     echo No change needed in $file_to_fix
                    804:   else
                    805:     echo '#ifdef _KERNEL' > /tmp/$base
                    806:     cat $file_to_fix >> /tmp/$base
                    807:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    808:     echo Fixed $file_to_fix
                    809:     rm -f ${LIB}/$file
                    810:     cp /tmp/$base ${LIB}/$file
                    811:     rm -f /tmp/$base
                    812:   fi
                    813: fi
                    814: 
1.1.1.2 ! root      815: # Sony NEWSOS 5.0 does not support the complete ANSI C standard.
        !           816: 
        !           817: if [ -x /bin/sony ]; then
        !           818:   if /bin/sony; then
        !           819: 
        !           820:     # Change <stdio.h> to not define __filbuf, __flsbuf, and __iob
        !           821: 
        !           822:     file=stdio.h
        !           823:     base=`basename $file`
        !           824:     if [ -r ${LIB}/$file ]; then
        !           825:       file_to_fix=${LIB}/$file
        !           826:     else
        !           827:       if [ -r ${INPUT}/$file ]; then
        !           828:         file_to_fix=${INPUT}/$file
        !           829:       else
        !           830:         file_to_fix=""
        !           831:       fi
        !           832:     fi
        !           833:     if [ \! -z "$file_to_fix" ]; then
        !           834:       echo Checking $file_to_fix
        !           835:       cp $file_to_fix /tmp/$base
        !           836:       chmod +w /tmp/$base
        !           837:       sed -e '
        !           838:         s/__filbuf/_filbuf/g
        !           839:         s/__flsbuf/_flsbuf/g
        !           840:         s/__iob/_iob/g
        !           841:       ' /tmp/$base > /tmp/$base.sed
        !           842:       mv /tmp/$base.sed /tmp/$base
        !           843:       if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then
        !           844:         echo No change needed in $file_to_fix
        !           845:       else
        !           846:         echo Fixed $file_to_fix
        !           847:         rm -f ${LIB}/$file
        !           848:         cp /tmp/$base ${LIB}/$file
        !           849:       fi
        !           850:       rm -f /tmp/$base
        !           851:     fi
        !           852: 
        !           853:     # Change <ctype.h> to not define __ctype
        !           854: 
        !           855:     file=ctype.h
        !           856:     base=`basename $file`
        !           857:     if [ -r ${LIB}/$file ]; then
        !           858:       file_to_fix=${LIB}/$file
        !           859:     else
        !           860:       if [ -r ${INPUT}/$file ]; then
        !           861:         file_to_fix=${INPUT}/$file
        !           862:       else
        !           863:         file_to_fix=""
        !           864:       fi
        !           865:     fi
        !           866:     if [ \! -z "$file_to_fix" ]; then
        !           867:       echo Checking $file_to_fix
        !           868:       cp $file_to_fix /tmp/$base
        !           869:       chmod +w /tmp/$base
        !           870:       sed -e '
        !           871:         s/__ctype/_ctype/g
        !           872:       ' /tmp/$base > /tmp/$base.sed
        !           873:       mv /tmp/$base.sed /tmp/$base
        !           874:       if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then
        !           875:         echo No change needed in $file_to_fix
        !           876:       else
        !           877:         echo Fixed $file_to_fix
        !           878:         rm -f ${LIB}/$file
        !           879:         cp /tmp/$base ${LIB}/$file
        !           880:       fi
        !           881:       rm -f /tmp/$base
        !           882:     fi
        !           883:   fi
        !           884: fi
        !           885: 
1.1       root      886: echo 'Removing unneeded directories:'
                    887: cd $LIB
                    888: files=`find . -type d -print | sort -r`
                    889: for file in $files; do
                    890:   rmdir $LIB/$file > /dev/null 2>&1
                    891: done
                    892: 
                    893: if $LINKS; then
                    894:   echo 'Making internal symbolic non-directory links'
                    895:   cd ${INPUT}
                    896:   files=`find . -type l -print`
                    897:   for file in $files; do
                    898:     dest=`ls -ld $file | sed -n 's/.*-> //p'`
                    899:     if expr "$dest" : '[^/].*' > /dev/null; then    
                    900:       target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
                    901:       if [ -f $target ]; then
                    902:         ln -s $dest ${LIB}/$file >/dev/null 2>&1
                    903:       fi
                    904:     fi
                    905:   done
                    906: fi
                    907: 
                    908: cd ${ORIG_DIR}
                    909: 
                    910: echo 'Replacing <sys/byteorder.h>'
                    911: rm -f ${LIB}/sys/byteorder.h
                    912: cp byteorder.h ${LIB}/sys/byteorder.h
                    913: 
                    914: exit 0
                    915: 

unix.superglobalmegacorp.com

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