Annotation of gcc/fixinc.svr4, revision 1.1.1.3

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
1.1.1.3 ! root      159:          /#[a-z]*if.*[  (]__i386\([^_]\)/      s/__i386/__i386__/g
1.1.1.2   root      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: 
1.1.1.3 ! root      322: # Likewise fix the definition of NULL in <dbm.h> so that it is conditional
        !           323: # and so that it is correct for both C and C++.
        !           324: 
        !           325: file=dbm.h
        !           326: base=`basename $file`
        !           327: if [ -r ${LIB}/$file ]; then
        !           328:   file_to_fix=${LIB}/$file
        !           329: else
        !           330:   if [ -r ${INPUT}/$file ]; then
        !           331:     file_to_fix=${INPUT}/$file
        !           332:   else
        !           333:     file_to_fix=""
        !           334:   fi
        !           335: fi
        !           336: if [ \! -z "$file_to_fix" ]; then
        !           337:   echo Checking $file_to_fix
        !           338:   cp $file_to_fix /tmp/$base
        !           339:   chmod +w /tmp/$base
        !           340:   ex /tmp/$base <<EOF
        !           341:   /^#define[   ]*NULL[         ]*((char \*) 0)$/c
        !           342: #ifndef NULL
        !           343: #ifdef __cplusplus
        !           344: #define __NULL_TYPE
        !           345: #else /* !defined(__cplusplus) */
        !           346: #define __NULL_TYPE (void *)
        !           347: #endif /* !defined(__cplusplus) */
        !           348: #define NULL (__NULL_TYPE 0)
        !           349: #endif /* !defined(NULL) */
        !           350: .
        !           351:   wq
        !           352: EOF
        !           353:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
        !           354:     echo No change needed in $file_to_fix
        !           355:   else
        !           356:     echo Fixed $file_to_fix
        !           357:     rm -f ${LIB}/$file
        !           358:     cp /tmp/$base ${LIB}/$file
        !           359:   fi
        !           360:   rm -f /tmp/$base
        !           361: fi
        !           362: 
1.1       root      363: # Add some missing declarations to <sys/mman.h>.
                    364: 
                    365: file=sys/mman.h
                    366: base=`basename $file`
                    367: if [ -r ${LIB}/$file ]; then
                    368:   file_to_fix=${LIB}/$file
                    369: else
                    370:   if [ -r ${INPUT}/$file ]; then
                    371:     file_to_fix=${INPUT}/$file
                    372:   else
                    373:     file_to_fix=""
                    374:   fi
                    375: fi
                    376: if [ \! -z "$file_to_fix" ]; then
                    377:   echo Checking $file_to_fix
                    378:   cp $file_to_fix /tmp/$base
                    379:   chmod +w /tmp/$base
                    380:   ex /tmp/$base <<EOF
                    381:   /^extern caddr_t mmap();$/c
                    382: #ifdef __STDC__
                    383: extern caddr_t mmap (caddr_t addr, size_t len, int prot, int flags,
                    384:                      int fd, off_t off);
                    385: #else /* !defined(__STDC__) */
                    386: extern caddr_t mmap ();
                    387: #endif /* !defined(__STDC__) */
                    388: .
                    389:   wq
                    390: EOF
                    391:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    392:     echo No changed needed in $file_to_fix
                    393:   else
                    394:     echo Fixed $file_to_fix
                    395:     rm -f ${LIB}/$file
                    396:     cp /tmp/$base ${LIB}/$file
                    397:   fi
                    398:   rm -f /tmp/$base
                    399: fi
                    400: 
                    401: # Fix declarations of `ftw' and `nftw' in <ftw.h>.
                    402: 
                    403: file=ftw.h
                    404: base=`basename $file`
                    405: if [ -r ${LIB}/$file ]; then
                    406:   file_to_fix=${LIB}/$file
                    407: else
                    408:   if [ -r ${INPUT}/$file ]; then
                    409:     file_to_fix=${INPUT}/$file
                    410:   else
                    411:     file_to_fix=""
                    412:   fi
                    413: fi
                    414: if [ \! -z "$file_to_fix" ]; then
                    415:   echo Checking $file_to_fix
                    416:   cp $file_to_fix /tmp/$base
                    417:   chmod +w /tmp/$base
                    418:   ex /tmp/$base <<EOF
                    419:   /^extern int ftw(const/c
                    420: #if !defined(_STYPES)
                    421: static
                    422: #else
                    423: extern
                    424: #endif
                    425:   int ftw(const char *, int (*)(const char *, const struct stat *, int), int);
                    426: .
                    427:   /^extern int nftw/c
                    428: #if defined(_STYPES)
                    429: static
                    430: #else
                    431: extern
                    432: #endif
                    433:   int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *),int, int);
                    434: .
                    435:   /^extern int ftw(),/c
                    436: #if !defined(_STYPES)
                    437: static
                    438: #else
                    439: extern
                    440: #endif
                    441:   int ftw();
                    442: #if defined(_STYPES)
                    443: static
                    444: #else
                    445: extern
                    446: #endif
                    447:   int nftw();
                    448: .
                    449:   wq
                    450: EOF
                    451:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    452:     echo No change needed in $file_to_fix
                    453:   else
                    454:     echo Fixed $file_to_fix
                    455:     rm -f ${LIB}/$file
                    456:     cp /tmp/$base ${LIB}/$file
                    457:   fi
                    458:   rm -f /tmp/$base
                    459: fi
                    460: 
                    461: # Add a `static' declaration of `getrnge' into <regexp.h>.
                    462: 
                    463: file=regexp.h
                    464: base=`basename $file`
                    465: if [ -r ${LIB}/$file ]; then
                    466:   file_to_fix=${LIB}/$file
                    467: else
                    468:   if [ -r ${INPUT}/$file ]; then
                    469:     file_to_fix=${INPUT}/$file
                    470:   else
                    471:     file_to_fix=""
                    472:   fi
                    473: fi
                    474: if [ \! -z "$file_to_fix" ]; then
                    475:   echo Checking $file_to_fix
                    476:   cp $file_to_fix /tmp/$base
                    477:   chmod +w /tmp/$base
                    478:   ex /tmp/$base <<EOF
                    479:   /^static int[        ]*size;/c
                    480: static int     size ;
                    481: 
                    482: static int getrnge ();
                    483: .
                    484:   wq
                    485: EOF
                    486:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    487:     echo No change needed in $file_to_fix
                    488:   else
                    489:     echo Fixed $file_to_fix
                    490:     rm -f ${LIB}/$file
                    491:     cp /tmp/$base ${LIB}/$file
                    492:   fi
                    493:   rm -f /tmp/$base
                    494: fi
                    495: 
                    496: # Add a #define of _SIGACTION_ into <sys/signal.h>.
                    497: 
                    498: file=sys/signal.h
                    499: base=`basename $file`
                    500: if [ -r ${LIB}/$file ]; then
                    501:   file_to_fix=${LIB}/$file
                    502: else
                    503:   if [ -r ${INPUT}/$file ]; then
                    504:     file_to_fix=${INPUT}/$file
                    505:   else
                    506:     file_to_fix=""
                    507:   fi
                    508: fi
                    509: if [ \! -z "$file_to_fix" ]; then
                    510:   echo Checking $file_to_fix
                    511:   cp $file_to_fix /tmp/$base
                    512:   chmod +w /tmp/$base
                    513:   ex /tmp/$base <<EOF
                    514:   /^struct sigaction {/c
                    515: #define _SIGACTION_
                    516: struct  sigaction  {
                    517: .
                    518:   wq
                    519: EOF
                    520:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    521:     echo No change needed in $file_to_fix
                    522:   else
                    523:     echo Fixed $file_to_fix
                    524:     rm -f ${LIB}/$file
                    525:     cp /tmp/$base ${LIB}/$file
                    526:   fi
                    527:   rm -f /tmp/$base
                    528: fi
                    529: 
                    530: # Fix declarations of `makedev', `major', and `minor' in <sys/mkdev.h>.
                    531: 
                    532: file=sys/mkdev.h
                    533: base=`basename $file`
                    534: if [ -r ${LIB}/$file ]; then
                    535:   file_to_fix=${LIB}/$file
                    536: else
                    537:   if [ -r ${INPUT}/$file ]; then
                    538:     file_to_fix=${INPUT}/$file
                    539:   else
                    540:     file_to_fix=""
                    541:   fi
                    542: fi
                    543: if [ \! -z "$file_to_fix" ]; then
                    544:   echo Checking $file_to_fix
                    545:   cp $file_to_fix /tmp/$base
                    546:   chmod +w /tmp/$base
                    547:   ex /tmp/$base <<EOF
                    548:   /^dev_t makedev(const/c
                    549: static dev_t makedev(const major_t, const minor_t);
                    550: .
                    551:   /^dev_t makedev()/c
                    552: static dev_t makedev();
                    553: .
                    554:   /^major_t major(const/c
                    555: static major_t major(const dev_t);
                    556: .
                    557:   /^major_t major()/c
                    558: static major_t major();
                    559: .
                    560:   /^minor_t minor(const/c
                    561: static minor_t minor(const dev_t);
                    562: .
                    563:   /^minor_t minor()/c
                    564: static minor_t minor();
                    565: .
                    566:   wq
                    567: EOF
                    568:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    569:     echo No change needed in $file_to_fix
                    570:   else
                    571:     echo Fixed $file_to_fix
                    572:     rm -f ${LIB}/$file
                    573:     cp /tmp/$base ${LIB}/$file
                    574:   fi
                    575:   rm -f /tmp/$base
                    576: fi
                    577: 
                    578: # Fix reference to NMSZ in <sys/adv.h>.
                    579: 
                    580: file=sys/adv.h
                    581: base=`basename $file`
                    582: if [ -r ${LIB}/$file ]; then
                    583:   file_to_fix=${LIB}/$file
                    584: else
                    585:   if [ -r ${INPUT}/$file ]; then
                    586:     file_to_fix=${INPUT}/$file
                    587:   else
                    588:     file_to_fix=""
                    589:   fi
                    590: fi
                    591: if [ \! -z "$file_to_fix" ]; then
                    592:   echo Checking $file_to_fix
                    593:   sed 's/\[NMSZ\]/\[RFS_NMSZ\]/g' $file_to_fix > /tmp/$base
                    594:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    595:     echo No change needed in $file_to_fix
                    596:   else
                    597:     echo Fixed $file_to_fix
                    598:     rm -f ${LIB}/$file
                    599:     cp /tmp/$base ${LIB}/$file
                    600:   fi
                    601:   rm -f /tmp/$base
                    602: fi
                    603: 
                    604: # Fix reference to NC_NPI_RAW in <sys/netcspace.h>.  Also fix types of
                    605: # array initializers.
                    606: 
                    607: file=sys/netcspace.h
                    608: base=`basename $file`
                    609: if [ -r ${LIB}/$file ]; then
                    610:   file_to_fix=${LIB}/$file
                    611: else
                    612:   if [ -r ${INPUT}/$file ]; then
                    613:     file_to_fix=${INPUT}/$file
                    614:   else
                    615:     file_to_fix=""
                    616:   fi
                    617: fi
                    618: if [ \! -z "$file_to_fix" ]; then
                    619:   echo Checking $file_to_fix
                    620:   sed 's/NC_NPI_RAW/NC_TPI_RAW/g' $file_to_fix \
                    621:     | sed 's/NC_/(unsigned long) NC_/' > /tmp/$base
                    622:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    623:     echo No change needed in $file_to_fix
                    624:   else
                    625:     echo Fixed $file_to_fix
                    626:     rm -f ${LIB}/$file
                    627:     cp /tmp/$base ${LIB}/$file
                    628:   fi
                    629:   rm -f /tmp/$base
                    630: fi
                    631: 
                    632: # Conditionalize all of <fs/rfs/rf_cache.h> on _KERNEL being defined.
                    633: 
                    634: file=fs/rfs/rf_cache.h
                    635: base=`basename $file`
                    636: if [ -r ${LIB}/$file ]; then
                    637:   file_to_fix=${LIB}/$file
                    638: else
                    639:   if [ -r ${INPUT}/$file ]; then
                    640:     file_to_fix=${INPUT}/$file
                    641:   else
                    642:     file_to_fix=""
                    643:   fi
                    644: fi
                    645: if [ \! -z "$file_to_fix" ]; then
                    646:   echo Checking $file_to_fix
                    647:   if grep _KERNEL $file_to_fix > /dev/null; then
                    648:     echo No change needed in $file_to_fix
                    649:   else
                    650:     echo '#ifdef _KERNEL' > /tmp/$base
                    651:     cat $file_to_fix >> /tmp/$base
                    652:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    653:     echo Fixed $file_to_fix
                    654:     rm -f ${LIB}/$file
                    655:     cp /tmp/$base ${LIB}/$file
                    656:     rm -f /tmp/$base
                    657:   fi
                    658: fi
                    659: 
                    660: # Conditionalize all of <sys/erec.h> on _KERNEL being defined.
                    661: 
                    662: file=sys/erec.h
                    663: base=`basename $file`
                    664: if [ -r ${LIB}/$file ]; then
                    665:   file_to_fix=${LIB}/$file
                    666: else
                    667:   if [ -r ${INPUT}/$file ]; then
                    668:     file_to_fix=${INPUT}/$file
                    669:   else
                    670:     file_to_fix=""
                    671:   fi
                    672: fi
                    673: if [ \! -z "$file_to_fix" ]; then
                    674:   echo Checking $file_to_fix
                    675:   if grep _KERNEL $file_to_fix > /dev/null; then
                    676:     echo No change needed in $file_to_fix
                    677:   else
                    678:     echo '#ifdef _KERNEL' > /tmp/$base
                    679:     cat $file_to_fix >> /tmp/$base
                    680:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    681:     echo Fixed $file_to_fix
                    682:     rm -f ${LIB}/$file
                    683:     cp /tmp/$base ${LIB}/$file
                    684:     rm -f /tmp/$base
                    685:   fi
                    686: fi
                    687: 
                    688: # Conditionalize all of <sys/err.h> on _KERNEL being defined.
                    689: 
                    690: file=sys/err.h
                    691: base=`basename $file`
                    692: if [ -r ${LIB}/$file ]; then
                    693:   file_to_fix=${LIB}/$file
                    694: else
                    695:   if [ -r ${INPUT}/$file ]; then
                    696:     file_to_fix=${INPUT}/$file
                    697:   else
                    698:     file_to_fix=""
                    699:   fi
                    700: fi
                    701: if [ \! -z "$file_to_fix" ]; then
                    702:   echo Checking $file_to_fix
                    703:   if grep _KERNEL $file_to_fix > /dev/null; then
                    704:     echo No change needed in $file_to_fix
                    705:   else
                    706:     echo '#ifdef _KERNEL' > /tmp/$base
                    707:     cat $file_to_fix >> /tmp/$base
                    708:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    709:     echo Fixed $file_to_fix
                    710:     rm -f ${LIB}/$file
                    711:     cp /tmp/$base ${LIB}/$file
                    712:     rm -f /tmp/$base
                    713:   fi
                    714: fi
                    715: 
                    716: # Conditionalize all of <sys/char.h> on _KERNEL being defined.
                    717: 
                    718: file=sys/char.h
                    719: base=`basename $file`
                    720: if [ -r ${LIB}/$file ]; then
                    721:   file_to_fix=${LIB}/$file
                    722: else
                    723:   if [ -r ${INPUT}/$file ]; then
                    724:     file_to_fix=${INPUT}/$file
                    725:   else
                    726:     file_to_fix=""
                    727:   fi
                    728: fi
                    729: if [ \! -z "$file_to_fix" ]; then
                    730:   echo Checking $file_to_fix
                    731:   if grep _KERNEL $file_to_fix > /dev/null; then
                    732:     echo No change needed in $file_to_fix
                    733:   else
                    734:     echo '#ifdef _KERNEL' > /tmp/$base
                    735:     cat $file_to_fix >> /tmp/$base
                    736:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    737:     echo Fixed $file_to_fix
                    738:     rm -f ${LIB}/$file
                    739:     cp /tmp/$base ${LIB}/$file
                    740:     rm -f /tmp/$base
                    741:   fi
                    742: fi
                    743: 
                    744: # Conditionalize all of <sys/getpages.h> on _KERNEL being defined.
                    745: 
                    746: file=sys/getpages.h
                    747: base=`basename $file`
                    748: if [ -r ${LIB}/$file ]; then
                    749:   file_to_fix=${LIB}/$file
                    750: else
                    751:   if [ -r ${INPUT}/$file ]; then
                    752:     file_to_fix=${INPUT}/$file
                    753:   else
                    754:     file_to_fix=""
                    755:   fi
                    756: fi
                    757: if [ \! -z "$file_to_fix" ]; then
                    758:   echo Checking $file_to_fix
                    759:   if grep _KERNEL $file_to_fix > /dev/null; then
                    760:     echo No change needed in $file_to_fix
                    761:   else
                    762:     echo '#ifdef _KERNEL' > /tmp/$base
                    763:     cat $file_to_fix >> /tmp/$base
                    764:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    765:     echo Fixed $file_to_fix
                    766:     rm -f ${LIB}/$file
                    767:     cp /tmp/$base ${LIB}/$file
                    768:     rm -f /tmp/$base
                    769:   fi
                    770: fi
                    771: 
                    772: # Conditionalize all of <sys/map.h> on _KERNEL being defined.
                    773: 
                    774: file=sys/map.h
                    775: base=`basename $file`
                    776: if [ -r ${LIB}/$file ]; then
                    777:   file_to_fix=${LIB}/$file
                    778: else
                    779:   if [ -r ${INPUT}/$file ]; then
                    780:     file_to_fix=${INPUT}/$file
                    781:   else
                    782:     file_to_fix=""
                    783:   fi
                    784: fi
                    785: if [ \! -z "$file_to_fix" ]; then
                    786:   echo Checking $file_to_fix
                    787:   if grep _KERNEL $file_to_fix > /dev/null; then
                    788:     echo No change needed in $file_to_fix
                    789:   else
                    790:     echo '#ifdef _KERNEL' > /tmp/$base
                    791:     cat $file_to_fix >> /tmp/$base
                    792:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    793:     echo Fixed $file_to_fix
                    794:     rm -f ${LIB}/$file
                    795:     cp /tmp/$base ${LIB}/$file
                    796:     rm -f /tmp/$base
                    797:   fi
                    798: fi
                    799: 
                    800: # Conditionalize all of <sys/cmn_err.h> on _KERNEL being defined.
                    801: 
                    802: file=sys/cmn_err.h
                    803: base=`basename $file`
                    804: if [ -r ${LIB}/$file ]; then
                    805:   file_to_fix=${LIB}/$file
                    806: else
                    807:   if [ -r ${INPUT}/$file ]; then
                    808:     file_to_fix=${INPUT}/$file
                    809:   else
                    810:     file_to_fix=""
                    811:   fi
                    812: fi
                    813: if [ \! -z "$file_to_fix" ]; then
                    814:   echo Checking $file_to_fix
                    815:   if grep _KERNEL $file_to_fix > /dev/null; then
                    816:     echo No change needed in $file_to_fix
                    817:   else
                    818:     echo '#ifdef _KERNEL' > /tmp/$base
                    819:     cat $file_to_fix >> /tmp/$base
                    820:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    821:     echo Fixed $file_to_fix
                    822:     rm -f ${LIB}/$file
                    823:     cp /tmp/$base ${LIB}/$file
                    824:     rm -f /tmp/$base
                    825:   fi
                    826: fi
                    827: 
                    828: # Conditionalize all of <sys/kdebugger.h> on _KERNEL being defined.
                    829: 
                    830: file=sys/kdebugger.h
                    831: base=`basename $file`
                    832: if [ -r ${LIB}/$file ]; then
                    833:   file_to_fix=${LIB}/$file
                    834: else
                    835:   if [ -r ${INPUT}/$file ]; then
                    836:     file_to_fix=${INPUT}/$file
                    837:   else
                    838:     file_to_fix=""
                    839:   fi
                    840: fi
                    841: if [ \! -z "$file_to_fix" ]; then
                    842:   echo Checking $file_to_fix
                    843:   if grep _KERNEL $file_to_fix > /dev/null; then
                    844:     echo No change needed in $file_to_fix
                    845:   else
                    846:     echo '#ifdef _KERNEL' > /tmp/$base
                    847:     cat $file_to_fix >> /tmp/$base
                    848:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    849:     echo Fixed $file_to_fix
                    850:     rm -f ${LIB}/$file
                    851:     cp /tmp/$base ${LIB}/$file
                    852:     rm -f /tmp/$base
                    853:   fi
                    854: fi
                    855: 
1.1.1.2   root      856: # Sony NEWSOS 5.0 does not support the complete ANSI C standard.
                    857: 
                    858: if [ -x /bin/sony ]; then
                    859:   if /bin/sony; then
                    860: 
                    861:     # Change <stdio.h> to not define __filbuf, __flsbuf, and __iob
                    862: 
                    863:     file=stdio.h
                    864:     base=`basename $file`
                    865:     if [ -r ${LIB}/$file ]; then
                    866:       file_to_fix=${LIB}/$file
                    867:     else
                    868:       if [ -r ${INPUT}/$file ]; then
                    869:         file_to_fix=${INPUT}/$file
                    870:       else
                    871:         file_to_fix=""
                    872:       fi
                    873:     fi
                    874:     if [ \! -z "$file_to_fix" ]; then
                    875:       echo Checking $file_to_fix
                    876:       cp $file_to_fix /tmp/$base
                    877:       chmod +w /tmp/$base
                    878:       sed -e '
                    879:         s/__filbuf/_filbuf/g
                    880:         s/__flsbuf/_flsbuf/g
                    881:         s/__iob/_iob/g
                    882:       ' /tmp/$base > /tmp/$base.sed
                    883:       mv /tmp/$base.sed /tmp/$base
                    884:       if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then
                    885:         echo No change needed in $file_to_fix
                    886:       else
                    887:         echo Fixed $file_to_fix
                    888:         rm -f ${LIB}/$file
                    889:         cp /tmp/$base ${LIB}/$file
                    890:       fi
                    891:       rm -f /tmp/$base
                    892:     fi
                    893: 
                    894:     # Change <ctype.h> to not define __ctype
                    895: 
                    896:     file=ctype.h
                    897:     base=`basename $file`
                    898:     if [ -r ${LIB}/$file ]; then
                    899:       file_to_fix=${LIB}/$file
                    900:     else
                    901:       if [ -r ${INPUT}/$file ]; then
                    902:         file_to_fix=${INPUT}/$file
                    903:       else
                    904:         file_to_fix=""
                    905:       fi
                    906:     fi
                    907:     if [ \! -z "$file_to_fix" ]; then
                    908:       echo Checking $file_to_fix
                    909:       cp $file_to_fix /tmp/$base
                    910:       chmod +w /tmp/$base
                    911:       sed -e '
                    912:         s/__ctype/_ctype/g
                    913:       ' /tmp/$base > /tmp/$base.sed
                    914:       mv /tmp/$base.sed /tmp/$base
                    915:       if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then
                    916:         echo No change needed in $file_to_fix
                    917:       else
                    918:         echo Fixed $file_to_fix
                    919:         rm -f ${LIB}/$file
                    920:         cp /tmp/$base ${LIB}/$file
                    921:       fi
                    922:       rm -f /tmp/$base
                    923:     fi
                    924:   fi
                    925: fi
                    926: 
1.1       root      927: echo 'Removing unneeded directories:'
                    928: cd $LIB
                    929: files=`find . -type d -print | sort -r`
                    930: for file in $files; do
                    931:   rmdir $LIB/$file > /dev/null 2>&1
                    932: done
                    933: 
                    934: if $LINKS; then
                    935:   echo 'Making internal symbolic non-directory links'
                    936:   cd ${INPUT}
                    937:   files=`find . -type l -print`
                    938:   for file in $files; do
                    939:     dest=`ls -ld $file | sed -n 's/.*-> //p'`
                    940:     if expr "$dest" : '[^/].*' > /dev/null; then    
                    941:       target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
                    942:       if [ -f $target ]; then
                    943:         ln -s $dest ${LIB}/$file >/dev/null 2>&1
                    944:       fi
                    945:     fi
                    946:   done
                    947: fi
                    948: 
                    949: cd ${ORIG_DIR}
                    950: 
                    951: echo 'Replacing <sys/byteorder.h>'
                    952: rm -f ${LIB}/sys/byteorder.h
                    953: cp byteorder.h ${LIB}/sys/byteorder.h
                    954: 
                    955: exit 0
                    956: 

unix.superglobalmegacorp.com

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