Annotation of gcc/fixinc.svr4, revision 1.1.1.4

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: 
1.1.1.4 ! root       34: # Directory where gcc sources (and sometimes special include files) live.
        !            35: SRCDIR=${3-${SRCDIR-.}}
        !            36: 
1.1       root       37: # Directory containing the original header files.
                     38: INPUT=${2-${INPUT-/usr/include}}
                     39: 
                     40: # Fail if no arg to specify a directory for the output.
                     41: if [ x$1 = x ]
                     42: then echo fixincludes: no output directory specified
                     43: exit 1
                     44: fi
                     45: 
                     46: # Directory in which to store the results.
1.1.1.4 ! root       47: LIB=${1?"fixincludes: output directory not specified"}
1.1       root       48: 
                     49: # Make sure it exists.
                     50: if [ ! -d $LIB ]; then
                     51:   mkdir $LIB || exit 1
                     52: fi
                     53: 
                     54: ORIG_DIR=`pwd`
                     55: 
                     56: # Make LIB absolute.
                     57: cd $LIB; LIB=`pwd`
                     58: 
                     59: # This prevents /bin/ex from failing if the current terminal type is
                     60: # unrecognizable.
1.1.1.4 ! root       61: TERM=dumb
1.1       root       62: export TERM
1.1.1.4 ! root       63: # This prevents /bin/ex from failing if the EXINIT environment variable
        !            64: # was set to something invalid.
        !            65: EXINIT=""
        !            66: export EXINIT
1.1       root       67: 
                     68: echo 'Building fixincludes in ' ${LIB}
                     69: 
1.1.1.2   root       70: # Determine whether this filesystem has symbolic links.
1.1       root       71: if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
                     72:   rm -f $LIB/ShouldNotExist
                     73:   LINKS=true
                     74: else
                     75:   LINKS=false
                     76: fi
                     77: 
                     78: echo 'Making directories:'
                     79: cd ${INPUT}
                     80: if $LINKS; then
                     81:   files=`ls -LR | sed -n s/:$//p`
                     82: else
                     83:   files=`find . -type d -print | sed '/^.$/d'`
                     84: fi
                     85: for file in $files; do
                     86:   rm -rf $LIB/$file
                     87:   if [ ! -d $LIB/$file ]
                     88:   then mkdir $LIB/$file
                     89:   fi
                     90: done
                     91: 
                     92: # treetops gets an alternating list
                     93: # of old directories to copy
                     94: # and the new directories to copy to.
                     95: treetops="${INPUT} ${LIB}"
                     96: 
                     97: if $LINKS; then
                     98:   echo 'Making internal symbolic directory links'
                     99:   for file in $files; do
                    100:     dest=`ls -ld $file | sed -n 's/.*-> //p'`
                    101:     if [ "$dest" ]; then    
                    102:       cwd=`pwd`
                    103:       # In case $dest is relative, get to $file's dir first.
                    104:       cd ${INPUT}
                    105:       cd `echo ./$file | sed -n 's&[^/]*$&&p'`
                    106:       # Check that the target directory exists.
                    107:       # Redirections changed to avoid bug in sh on Ultrix.
                    108:       (cd $dest) > /dev/null 2>&1
                    109:       if [ $? = 0 ]; then
                    110:        cd $dest
                    111:        # X gets the dir that the link actually leads to.
                    112:        x=`pwd`
                    113:        # If link leads back into ${INPUT},
                    114:        # make a similar link here.
                    115:        if expr $x : "${INPUT}/.*" > /dev/null; then
                    116:          # Y gets the actual target dir name, relative to ${INPUT}.
                    117:          y=`echo $x | sed -n "s&${INPUT}/&&p"`
                    118:          echo $file '->' $y ': Making link'
                    119:          rm -fr ${LIB}/$file > /dev/null 2>&1
                    120:          ln -s ${LIB}/$y ${LIB}/$file > /dev/null 2>&1
                    121:        else
                    122:          # If the link is to outside ${INPUT},
                    123:          # treat this directory as if it actually contained the files.
                    124: # This line used to have $dest instead of $x.
                    125: # $dest seemed to be wrong for links found in subdirectories
                    126: # of ${INPUT}.  Does this change break anything?
                    127:          treetops="$treetops $x ${LIB}/$file"
                    128:        fi
                    129:       fi
                    130:       cd $cwd
                    131:     fi
                    132:   done
                    133: fi
                    134: 
                    135: set - $treetops
                    136: while [ $# != 0 ]; do
                    137:   # $1 is an old directory to copy, and $2 is the new directory to copy to.
                    138:   echo "Finding header files in $1:"
                    139:   cd ${INPUT}
                    140:   cd $1
                    141:   files=`find . -name '*.h' -type f -print`
                    142:   echo 'Checking header files:'
                    143:   for file in $files; do
                    144:       echo Fixing $file
                    145:       if [ -r $file ]; then
                    146:        cp $file $2/$file >/dev/null 2>&1 || echo "Can't copy $file"
                    147:        chmod +w $2/$file
                    148: 
                    149: # The following have been removed from the sed command below
                    150: # because it is more useful to leave these things in.
                    151: # The only reason to remove them was for -pedantic,
                    152: # which isn't much of a reason. -- rms.
                    153: #        /^[   ]*#[    ]*ident/d
                    154: 
1.1.1.4 ! root      155: # This code makes Solaris SCSI fail, because it changes the
        !           156: # alignment within some critical structures.  See <sys/scsi/impl/commands.h>.
        !           157: #        s/u_char\([   ][      ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[    ]*:[    ]*[0-9][0-9]*\)/u_int\1/
        !           158: # Disable these also, since they probably aren't safe either.
        !           159: #        s/u_short\([  ][      ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[    ]*:[    ]*[0-9][0-9]*\)/u_int\1/
        !           160: #        s/ushort\([   ][      ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[    ]*:[    ]*[0-9][0-9]*\)/u_int\1/
        !           161: #        s/evcm_t\([   ][      ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[    ]*:[    ]*[0-9][0-9]*\)/u_int\1/
        !           162: #        s/Pbyte\([    ][      ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[    ]*:[    ]*SEQSIZ\)/unsigned int\1/
        !           163: 
1.1       root      164: # The change of u_char, etc, to u_int
                    165: # applies to bit fields.
                    166:        sed -e '
1.1.1.2   root      167:          s%^\([        ]*#[    ]*endif[        ]*\)\([^/       ].*\)$%\1/* \2 */%
                    168:          s%^\([        ]*#[    ]*else[         ]*\)\([^/       ].*\)$%\1/* \2 */%
1.1       root      169:          s/#lint(on)/defined(lint)/g
                    170:          s/#lint(off)/!defined(lint)/g
                    171:          s/#machine(\([^)]*\))/defined(__\1__)/g
                    172:          s/#system(\([^)]*\))/defined(__\1__)/g
                    173:          s/#cpu(\([^)]*\))/defined(__\1__)/g
1.1.1.2   root      174:          /#[a-z]*if.*[  (]m68k/                s/\([^_]\)m68k/\1__m68k__/g
1.1.1.3   root      175:          /#[a-z]*if.*[  (]__i386\([^_]\)/      s/__i386/__i386__/g
1.1.1.2   root      176:          /#[a-z]*if.*[  (]i386/                s/\([^_]\)i386/\1__i386__/g
                    177:          /#[a-z]*if.*[  (]sparc/       s/\([^_]\)sparc/\1__sparc__/g
                    178:          /#[a-z]*if.*[  (]mc68000/     s/\([^_]\)mc68000/\1__mc68000__/g
                    179:          /#[a-z]*if.*[  (]vax/         s/\([^_]\)vax/\1__vax__/g
                    180:          /#[a-z]*if.*[  (]sun/         s/\([^_]\)\(sun[a-z0-9]*\)\([^a-z0-9_]\)/\1__\2__\3/g
                    181:          /#[a-z]*if.*[  (]sun/         s/\([^_]\)\(sun[a-z0-9]*\)$/\1__\2__/g
                    182:          /#[a-z]*if.*[  (]ns32000/     s/\([^_]\)ns32000/\1__ns32000__/g
                    183:          /#[a-z]*if.*[  (]pyr/         s/\([^_]\)pyr/\1__pyr__/g
                    184:          /#[a-z]*if.*[  (]is68k/       s/\([^_]\)is68k/\1__is68k__/g
1.1       root      185:          s/__STDC__ == 0/!defined (__STRICT_ANSI__)/g
                    186:          s/__STDC__ != 0/defined (__STRICT_ANSI__)/g
                    187:          s/__STDC__ - 0 == 0/!defined (__STRICT_ANSI__)/g
                    188:        ' $2/$file > $2/$file.sed
                    189:        mv $2/$file.sed $2/$file
                    190:        if cmp $file $2/$file >/dev/null 2>&1; then
                    191:           echo Deleting $2/$file\; no fixes were needed.
                    192:           rm $2/$file
                    193:        fi
                    194:       fi
                    195:   done
                    196:   shift; shift
                    197: done
                    198: 
                    199: # Fix first broken decl of getcwd present on some svr4 systems.
                    200: 
                    201: file=stdlib.h
                    202: base=`basename $file`
                    203: if [ -r ${LIB}/$file ]; then
                    204:   file_to_fix=${LIB}/$file
                    205: else
                    206:   if [ -r ${INPUT}/$file ]; then
                    207:     file_to_fix=${INPUT}/$file
                    208:   else
                    209:     file_to_fix=""
                    210:   fi
                    211: fi
                    212: if [ \! -z "$file_to_fix" ]; then
                    213:   echo Checking $file_to_fix
                    214:   sed -e 's/getcwd(char \*, int)/getcwd(char *, size_t)/' $file_to_fix > /tmp/$base
                    215:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    216:     echo No change needed in $file_to_fix
                    217:   else
                    218:     echo Fixed $file_to_fix
                    219:     rm -f ${LIB}/$file
                    220:     cp /tmp/$base ${LIB}/$file
                    221:   fi
                    222:   rm -f /tmp/$base
                    223: fi
                    224: 
                    225: # Fix second broken decl of getcwd present on some svr4 systems.  Also
                    226: # fix the incorrect decl of profil present on some svr4 systems.
                    227: 
                    228: file=unistd.h
                    229: base=`basename $file`
                    230: if [ -r ${LIB}/$file ]; then
                    231:   file_to_fix=${LIB}/$file
                    232: else
                    233:   if [ -r ${INPUT}/$file ]; then
                    234:     file_to_fix=${INPUT}/$file
                    235:   else
                    236:     file_to_fix=""
                    237:   fi
                    238: fi
                    239: if [ \! -z "$file_to_fix" ]; then
                    240:   echo Checking $file_to_fix
                    241:   sed -e 's/getcwd(char \*, int)/getcwd(char *, size_t)/' $file_to_fix \
                    242:     | sed -e 's/profil(unsigned short \*, unsigned int, unsigned int, unsigned int)/profil(unsigned short *, size_t, int, unsigned)/' > /tmp/$base
                    243:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    244:     echo No change needed in $file_to_fix
                    245:   else
                    246:     echo Fixed $file_to_fix
                    247:     rm -f ${LIB}/$file
                    248:     cp /tmp/$base ${LIB}/$file
                    249:   fi
                    250:   rm -f /tmp/$base
                    251: fi
                    252: 
                    253: # Fix the definition of NULL in <sys/param.h> so that it is conditional
                    254: # and so that it is correct for both C and C++.
                    255: 
                    256: file=sys/param.h
                    257: base=`basename $file`
                    258: if [ -r ${LIB}/$file ]; then
                    259:   file_to_fix=${LIB}/$file
                    260: else
                    261:   if [ -r ${INPUT}/$file ]; then
                    262:     file_to_fix=${INPUT}/$file
                    263:   else
                    264:     file_to_fix=""
                    265:   fi
                    266: fi
                    267: if [ \! -z "$file_to_fix" ]; then
                    268:   echo Checking $file_to_fix
                    269:   cp $file_to_fix /tmp/$base
                    270:   chmod +w /tmp/$base
                    271:   ex /tmp/$base <<EOF
                    272:   /^#define[   ]*NULL[         ]*0$/c
                    273: #ifndef NULL
                    274: #ifdef __cplusplus
                    275: #define __NULL_TYPE
                    276: #else /* !defined(__cplusplus) */
                    277: #define __NULL_TYPE (void *)
                    278: #endif /* !defined(__cplusplus) */
                    279: #define NULL (__NULL_TYPE 0)
                    280: #endif /* !defined(NULL) */
                    281: .
                    282:   wq
                    283: EOF
                    284:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    285:     echo No change needed in $file_to_fix
                    286:   else
                    287:     echo Fixed $file_to_fix
                    288:     rm -f ${LIB}/$file
                    289:     cp /tmp/$base ${LIB}/$file
                    290:   fi
                    291:   rm -f /tmp/$base
                    292: fi
                    293: 
                    294: # Likewise fix the definition of NULL in <stdio.h> so that it is conditional
                    295: # and so that it is correct for both C and C++.
                    296: 
                    297: file=stdio.h
                    298: base=`basename $file`
                    299: if [ -r ${LIB}/$file ]; then
                    300:   file_to_fix=${LIB}/$file
                    301: else
                    302:   if [ -r ${INPUT}/$file ]; then
                    303:     file_to_fix=${INPUT}/$file
                    304:   else
                    305:     file_to_fix=""
                    306:   fi
                    307: fi
                    308: if [ \! -z "$file_to_fix" ]; then
                    309:   echo Checking $file_to_fix
                    310:   cp $file_to_fix /tmp/$base
                    311:   chmod +w /tmp/$base
                    312:   ex /tmp/$base <<EOF
                    313:   /^#define[   ]*NULL[         ]*0$/c
                    314: #ifdef __cplusplus
                    315: #define __NULL_TYPE
                    316: #else /* !defined(__cplusplus) */
                    317: #define __NULL_TYPE (void *)
                    318: #endif /* !defined(__cplusplus) */
                    319: #define NULL (__NULL_TYPE 0)
                    320: .
                    321:   wq
                    322: EOF
                    323:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    324:     echo No change needed in $file_to_fix
                    325:   else
                    326:     echo Fixed $file_to_fix
                    327:     rm -f ${LIB}/$file
                    328:     cp /tmp/$base ${LIB}/$file
                    329:   fi
                    330:   rm -f /tmp/$base
                    331: fi
                    332: 
1.1.1.3   root      333: # Likewise fix the definition of NULL in <dbm.h> so that it is conditional
                    334: # and so that it is correct for both C and C++.
                    335: 
                    336: file=dbm.h
                    337: base=`basename $file`
                    338: if [ -r ${LIB}/$file ]; then
                    339:   file_to_fix=${LIB}/$file
                    340: else
                    341:   if [ -r ${INPUT}/$file ]; then
                    342:     file_to_fix=${INPUT}/$file
                    343:   else
                    344:     file_to_fix=""
                    345:   fi
                    346: fi
                    347: if [ \! -z "$file_to_fix" ]; then
                    348:   echo Checking $file_to_fix
                    349:   cp $file_to_fix /tmp/$base
                    350:   chmod +w /tmp/$base
                    351:   ex /tmp/$base <<EOF
                    352:   /^#define[   ]*NULL[         ]*((char \*) 0)$/c
                    353: #ifndef NULL
                    354: #ifdef __cplusplus
                    355: #define __NULL_TYPE
                    356: #else /* !defined(__cplusplus) */
                    357: #define __NULL_TYPE (void *)
                    358: #endif /* !defined(__cplusplus) */
                    359: #define NULL (__NULL_TYPE 0)
                    360: #endif /* !defined(NULL) */
                    361: .
                    362:   wq
                    363: EOF
                    364:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    365:     echo No change needed in $file_to_fix
                    366:   else
                    367:     echo Fixed $file_to_fix
                    368:     rm -f ${LIB}/$file
                    369:     cp /tmp/$base ${LIB}/$file
                    370:   fi
                    371:   rm -f /tmp/$base
                    372: fi
                    373: 
1.1.1.4 ! root      374: # Add a prototyped declaration of mmap to <sys/mman.h>.
1.1       root      375: 
                    376: file=sys/mman.h
                    377: base=`basename $file`
                    378: if [ -r ${LIB}/$file ]; then
                    379:   file_to_fix=${LIB}/$file
                    380: else
                    381:   if [ -r ${INPUT}/$file ]; then
                    382:     file_to_fix=${INPUT}/$file
                    383:   else
                    384:     file_to_fix=""
                    385:   fi
                    386: fi
                    387: if [ \! -z "$file_to_fix" ]; then
                    388:   echo Checking $file_to_fix
                    389:   cp $file_to_fix /tmp/$base
                    390:   chmod +w /tmp/$base
                    391:   ex /tmp/$base <<EOF
                    392:   /^extern caddr_t mmap();$/c
                    393: #ifdef __STDC__
                    394: extern caddr_t mmap (caddr_t addr, size_t len, int prot, int flags,
                    395:                      int fd, off_t off);
                    396: #else /* !defined(__STDC__) */
                    397: extern caddr_t mmap ();
                    398: #endif /* !defined(__STDC__) */
                    399: .
                    400:   wq
                    401: EOF
                    402:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    403:     echo No changed needed in $file_to_fix
                    404:   else
                    405:     echo Fixed $file_to_fix
                    406:     rm -f ${LIB}/$file
                    407:     cp /tmp/$base ${LIB}/$file
                    408:   fi
                    409:   rm -f /tmp/$base
                    410: fi
                    411: 
                    412: # Fix declarations of `ftw' and `nftw' in <ftw.h>.
                    413: 
                    414: file=ftw.h
                    415: base=`basename $file`
                    416: if [ -r ${LIB}/$file ]; then
                    417:   file_to_fix=${LIB}/$file
                    418: else
                    419:   if [ -r ${INPUT}/$file ]; then
                    420:     file_to_fix=${INPUT}/$file
                    421:   else
                    422:     file_to_fix=""
                    423:   fi
                    424: fi
                    425: if [ \! -z "$file_to_fix" ]; then
                    426:   echo Checking $file_to_fix
                    427:   cp $file_to_fix /tmp/$base
                    428:   chmod +w /tmp/$base
                    429:   ex /tmp/$base <<EOF
                    430:   /^extern int ftw(const/c
                    431: #if !defined(_STYPES)
                    432: static
                    433: #else
                    434: extern
                    435: #endif
                    436:   int ftw(const char *, int (*)(const char *, const struct stat *, int), int);
                    437: .
                    438:   /^extern int nftw/c
                    439: #if defined(_STYPES)
                    440: static
                    441: #else
                    442: extern
                    443: #endif
                    444:   int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *),int, int);
                    445: .
                    446:   /^extern int ftw(),/c
                    447: #if !defined(_STYPES)
                    448: static
                    449: #else
                    450: extern
                    451: #endif
                    452:   int ftw();
                    453: #if defined(_STYPES)
                    454: static
                    455: #else
                    456: extern
                    457: #endif
                    458:   int nftw();
                    459: .
                    460:   wq
                    461: EOF
                    462:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    463:     echo No change needed in $file_to_fix
                    464:   else
                    465:     echo Fixed $file_to_fix
                    466:     rm -f ${LIB}/$file
                    467:     cp /tmp/$base ${LIB}/$file
                    468:   fi
                    469:   rm -f /tmp/$base
                    470: fi
                    471: 
                    472: # Add a `static' declaration of `getrnge' into <regexp.h>.
                    473: 
1.1.1.4 ! root      474: # Don't do this if there is already a `static void getrnge' declaration
        !           475: # present, since this would cause a redeclaration error.  Solaris 2.x has
        !           476: # such a declaration.
        !           477: 
1.1       root      478: file=regexp.h
                    479: base=`basename $file`
                    480: if [ -r ${LIB}/$file ]; then
                    481:   file_to_fix=${LIB}/$file
                    482: else
                    483:   if [ -r ${INPUT}/$file ]; then
                    484:     file_to_fix=${INPUT}/$file
                    485:   else
                    486:     file_to_fix=""
                    487:   fi
                    488: fi
                    489: if [ \! -z "$file_to_fix" ]; then
                    490:   echo Checking $file_to_fix
1.1.1.4 ! root      491:   if grep "static void getrnge" $file_to_fix > /dev/null; then
        !           492:     true
        !           493:   else
        !           494:     cp $file_to_fix /tmp/$base
        !           495:     chmod +w /tmp/$base
        !           496:     ex /tmp/$base <<EOF
        !           497:     /^static int[      ]*size;/c
1.1       root      498: static int     size ;
                    499: 
                    500: static int getrnge ();
                    501: .
1.1.1.4 ! root      502:     wq
        !           503: EOF
        !           504:     if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
        !           505:       No change needed in $file_to_fix
        !           506:     else
        !           507:       echo Fixed $file_to_fix
        !           508:       rm -f ${LIB}/$file
        !           509:       cp /tmp/$base ${LIB}/$file
        !           510:     fi
        !           511:   fi
        !           512:   rm -f /tmp/$base
        !           513: fi
        !           514: 
        !           515: # Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
        !           516: # that is visible to any ANSI compiler using this include.  Simply
        !           517: # delete the lines the #define some string functions to internal forms.
        !           518: 
        !           519: file=string.h
        !           520: base=`basename $file`
        !           521: if [ -r ${LIB}/$file ]; then
        !           522:   file_to_fix=${LIB}/$file
        !           523: else
        !           524:   if [ -r ${INPUT}/$file ]; then
        !           525:     file_to_fix=${INPUT}/$file
        !           526:   else
        !           527:     file_to_fix=""
        !           528:   fi
        !           529: fi
        !           530: if [ \! -z "$file_to_fix" ]; then
        !           531:   echo Checking $file_to_fix
        !           532:   cp $file_to_fix /tmp/$base
        !           533:   chmod +w /tmp/$base
        !           534:   ex /tmp/$base <<EOF
        !           535:   g/#define.*__std_hdr_/d
1.1       root      536:   wq
                    537: EOF
                    538:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    539:     echo No change needed in $file_to_fix
                    540:   else
                    541:     echo Fixed $file_to_fix
                    542:     rm -f ${LIB}/$file
                    543:     cp /tmp/$base ${LIB}/$file
                    544:   fi
                    545:   rm -f /tmp/$base
                    546: fi
                    547: 
                    548: # Add a #define of _SIGACTION_ into <sys/signal.h>.
1.1.1.4 ! root      549: # Also fix types of SIG_DFL, SIG_ERR, SIG_IGN, and SIG_HOLD.
1.1       root      550: 
                    551: file=sys/signal.h
                    552: base=`basename $file`
                    553: if [ -r ${LIB}/$file ]; then
                    554:   file_to_fix=${LIB}/$file
                    555: else
                    556:   if [ -r ${INPUT}/$file ]; then
                    557:     file_to_fix=${INPUT}/$file
                    558:   else
                    559:     file_to_fix=""
                    560:   fi
                    561: fi
                    562: if [ \! -z "$file_to_fix" ]; then
                    563:   echo Checking $file_to_fix
                    564:   cp $file_to_fix /tmp/$base
                    565:   chmod +w /tmp/$base
                    566:   ex /tmp/$base <<EOF
                    567:   /^struct sigaction {/c
                    568: #define _SIGACTION_
                    569: struct  sigaction  {
                    570: .
1.1.1.4 ! root      571:   1,\$s/(void *(\*)())/(void (*)(int))/
1.1       root      572:   wq
                    573: EOF
                    574:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    575:     echo No change needed in $file_to_fix
                    576:   else
                    577:     echo Fixed $file_to_fix
                    578:     rm -f ${LIB}/$file
                    579:     cp /tmp/$base ${LIB}/$file
                    580:   fi
                    581:   rm -f /tmp/$base
                    582: fi
                    583: 
                    584: # Fix declarations of `makedev', `major', and `minor' in <sys/mkdev.h>.
                    585: 
                    586: file=sys/mkdev.h
                    587: base=`basename $file`
                    588: if [ -r ${LIB}/$file ]; then
                    589:   file_to_fix=${LIB}/$file
                    590: else
                    591:   if [ -r ${INPUT}/$file ]; then
                    592:     file_to_fix=${INPUT}/$file
                    593:   else
                    594:     file_to_fix=""
                    595:   fi
                    596: fi
                    597: if [ \! -z "$file_to_fix" ]; then
                    598:   echo Checking $file_to_fix
                    599:   cp $file_to_fix /tmp/$base
                    600:   chmod +w /tmp/$base
                    601:   ex /tmp/$base <<EOF
                    602:   /^dev_t makedev(const/c
                    603: static dev_t makedev(const major_t, const minor_t);
                    604: .
                    605:   /^dev_t makedev()/c
                    606: static dev_t makedev();
                    607: .
                    608:   /^major_t major(const/c
                    609: static major_t major(const dev_t);
                    610: .
                    611:   /^major_t major()/c
                    612: static major_t major();
                    613: .
                    614:   /^minor_t minor(const/c
                    615: static minor_t minor(const dev_t);
                    616: .
                    617:   /^minor_t minor()/c
                    618: static minor_t minor();
                    619: .
                    620:   wq
                    621: EOF
                    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: # Fix reference to NMSZ in <sys/adv.h>.
                    633: 
                    634: file=sys/adv.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:   sed 's/\[NMSZ\]/\[RFS_NMSZ\]/g' $file_to_fix > /tmp/$base
                    648:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    649:     echo No change needed in $file_to_fix
                    650:   else
                    651:     echo Fixed $file_to_fix
                    652:     rm -f ${LIB}/$file
                    653:     cp /tmp/$base ${LIB}/$file
                    654:   fi
                    655:   rm -f /tmp/$base
                    656: fi
                    657: 
                    658: # Fix reference to NC_NPI_RAW in <sys/netcspace.h>.  Also fix types of
                    659: # array initializers.
                    660: 
                    661: file=sys/netcspace.h
                    662: base=`basename $file`
                    663: if [ -r ${LIB}/$file ]; then
                    664:   file_to_fix=${LIB}/$file
                    665: else
                    666:   if [ -r ${INPUT}/$file ]; then
                    667:     file_to_fix=${INPUT}/$file
                    668:   else
                    669:     file_to_fix=""
                    670:   fi
                    671: fi
                    672: if [ \! -z "$file_to_fix" ]; then
                    673:   echo Checking $file_to_fix
                    674:   sed 's/NC_NPI_RAW/NC_TPI_RAW/g' $file_to_fix \
                    675:     | sed 's/NC_/(unsigned long) NC_/' > /tmp/$base
                    676:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
                    677:     echo No change needed in $file_to_fix
                    678:   else
                    679:     echo Fixed $file_to_fix
                    680:     rm -f ${LIB}/$file
                    681:     cp /tmp/$base ${LIB}/$file
                    682:   fi
                    683:   rm -f /tmp/$base
                    684: fi
                    685: 
                    686: # Conditionalize all of <fs/rfs/rf_cache.h> on _KERNEL being defined.
                    687: 
                    688: file=fs/rfs/rf_cache.h
                    689: base=`basename $file`
                    690: if [ -r ${LIB}/$file ]; then
                    691:   file_to_fix=${LIB}/$file
                    692: else
                    693:   if [ -r ${INPUT}/$file ]; then
                    694:     file_to_fix=${INPUT}/$file
                    695:   else
                    696:     file_to_fix=""
                    697:   fi
                    698: fi
                    699: if [ \! -z "$file_to_fix" ]; then
                    700:   echo Checking $file_to_fix
                    701:   if grep _KERNEL $file_to_fix > /dev/null; then
                    702:     echo No change needed in $file_to_fix
                    703:   else
                    704:     echo '#ifdef _KERNEL' > /tmp/$base
                    705:     cat $file_to_fix >> /tmp/$base
                    706:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    707:     echo Fixed $file_to_fix
                    708:     rm -f ${LIB}/$file
                    709:     cp /tmp/$base ${LIB}/$file
                    710:     rm -f /tmp/$base
                    711:   fi
                    712: fi
                    713: 
                    714: # Conditionalize all of <sys/erec.h> on _KERNEL being defined.
                    715: 
                    716: file=sys/erec.h
                    717: base=`basename $file`
                    718: if [ -r ${LIB}/$file ]; then
                    719:   file_to_fix=${LIB}/$file
                    720: else
                    721:   if [ -r ${INPUT}/$file ]; then
                    722:     file_to_fix=${INPUT}/$file
                    723:   else
                    724:     file_to_fix=""
                    725:   fi
                    726: fi
                    727: if [ \! -z "$file_to_fix" ]; then
                    728:   echo Checking $file_to_fix
                    729:   if grep _KERNEL $file_to_fix > /dev/null; then
                    730:     echo No change needed in $file_to_fix
                    731:   else
                    732:     echo '#ifdef _KERNEL' > /tmp/$base
                    733:     cat $file_to_fix >> /tmp/$base
                    734:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    735:     echo Fixed $file_to_fix
                    736:     rm -f ${LIB}/$file
                    737:     cp /tmp/$base ${LIB}/$file
                    738:     rm -f /tmp/$base
                    739:   fi
                    740: fi
                    741: 
                    742: # Conditionalize all of <sys/err.h> on _KERNEL being defined.
                    743: 
                    744: file=sys/err.h
                    745: base=`basename $file`
                    746: if [ -r ${LIB}/$file ]; then
                    747:   file_to_fix=${LIB}/$file
                    748: else
                    749:   if [ -r ${INPUT}/$file ]; then
                    750:     file_to_fix=${INPUT}/$file
                    751:   else
                    752:     file_to_fix=""
                    753:   fi
                    754: fi
                    755: if [ \! -z "$file_to_fix" ]; then
                    756:   echo Checking $file_to_fix
                    757:   if grep _KERNEL $file_to_fix > /dev/null; then
                    758:     echo No change needed in $file_to_fix
                    759:   else
                    760:     echo '#ifdef _KERNEL' > /tmp/$base
                    761:     cat $file_to_fix >> /tmp/$base
                    762:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    763:     echo Fixed $file_to_fix
                    764:     rm -f ${LIB}/$file
                    765:     cp /tmp/$base ${LIB}/$file
                    766:     rm -f /tmp/$base
                    767:   fi
                    768: fi
                    769: 
                    770: # Conditionalize all of <sys/char.h> on _KERNEL being defined.
                    771: 
                    772: file=sys/char.h
                    773: base=`basename $file`
                    774: if [ -r ${LIB}/$file ]; then
                    775:   file_to_fix=${LIB}/$file
                    776: else
                    777:   if [ -r ${INPUT}/$file ]; then
                    778:     file_to_fix=${INPUT}/$file
                    779:   else
                    780:     file_to_fix=""
                    781:   fi
                    782: fi
                    783: if [ \! -z "$file_to_fix" ]; then
                    784:   echo Checking $file_to_fix
                    785:   if grep _KERNEL $file_to_fix > /dev/null; then
                    786:     echo No change needed in $file_to_fix
                    787:   else
                    788:     echo '#ifdef _KERNEL' > /tmp/$base
                    789:     cat $file_to_fix >> /tmp/$base
                    790:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    791:     echo Fixed $file_to_fix
                    792:     rm -f ${LIB}/$file
                    793:     cp /tmp/$base ${LIB}/$file
                    794:     rm -f /tmp/$base
                    795:   fi
                    796: fi
                    797: 
                    798: # Conditionalize all of <sys/getpages.h> on _KERNEL being defined.
                    799: 
                    800: file=sys/getpages.h
                    801: base=`basename $file`
                    802: if [ -r ${LIB}/$file ]; then
                    803:   file_to_fix=${LIB}/$file
                    804: else
                    805:   if [ -r ${INPUT}/$file ]; then
                    806:     file_to_fix=${INPUT}/$file
                    807:   else
                    808:     file_to_fix=""
                    809:   fi
                    810: fi
                    811: if [ \! -z "$file_to_fix" ]; then
                    812:   echo Checking $file_to_fix
                    813:   if grep _KERNEL $file_to_fix > /dev/null; then
                    814:     echo No change needed in $file_to_fix
                    815:   else
                    816:     echo '#ifdef _KERNEL' > /tmp/$base
                    817:     cat $file_to_fix >> /tmp/$base
                    818:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    819:     echo Fixed $file_to_fix
                    820:     rm -f ${LIB}/$file
                    821:     cp /tmp/$base ${LIB}/$file
                    822:     rm -f /tmp/$base
                    823:   fi
                    824: fi
                    825: 
                    826: # Conditionalize all of <sys/map.h> on _KERNEL being defined.
                    827: 
                    828: file=sys/map.h
                    829: base=`basename $file`
                    830: if [ -r ${LIB}/$file ]; then
                    831:   file_to_fix=${LIB}/$file
                    832: else
                    833:   if [ -r ${INPUT}/$file ]; then
                    834:     file_to_fix=${INPUT}/$file
                    835:   else
                    836:     file_to_fix=""
                    837:   fi
                    838: fi
                    839: if [ \! -z "$file_to_fix" ]; then
                    840:   echo Checking $file_to_fix
                    841:   if grep _KERNEL $file_to_fix > /dev/null; then
                    842:     echo No change needed in $file_to_fix
                    843:   else
                    844:     echo '#ifdef _KERNEL' > /tmp/$base
                    845:     cat $file_to_fix >> /tmp/$base
                    846:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    847:     echo Fixed $file_to_fix
                    848:     rm -f ${LIB}/$file
                    849:     cp /tmp/$base ${LIB}/$file
                    850:     rm -f /tmp/$base
                    851:   fi
                    852: fi
                    853: 
                    854: # Conditionalize all of <sys/cmn_err.h> on _KERNEL being defined.
                    855: 
                    856: file=sys/cmn_err.h
                    857: base=`basename $file`
                    858: if [ -r ${LIB}/$file ]; then
                    859:   file_to_fix=${LIB}/$file
                    860: else
                    861:   if [ -r ${INPUT}/$file ]; then
                    862:     file_to_fix=${INPUT}/$file
                    863:   else
                    864:     file_to_fix=""
                    865:   fi
                    866: fi
                    867: if [ \! -z "$file_to_fix" ]; then
                    868:   echo Checking $file_to_fix
                    869:   if grep _KERNEL $file_to_fix > /dev/null; then
                    870:     echo No change needed in $file_to_fix
                    871:   else
                    872:     echo '#ifdef _KERNEL' > /tmp/$base
                    873:     cat $file_to_fix >> /tmp/$base
                    874:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    875:     echo Fixed $file_to_fix
                    876:     rm -f ${LIB}/$file
                    877:     cp /tmp/$base ${LIB}/$file
                    878:     rm -f /tmp/$base
                    879:   fi
                    880: fi
                    881: 
                    882: # Conditionalize all of <sys/kdebugger.h> on _KERNEL being defined.
                    883: 
                    884: file=sys/kdebugger.h
                    885: base=`basename $file`
                    886: if [ -r ${LIB}/$file ]; then
                    887:   file_to_fix=${LIB}/$file
                    888: else
                    889:   if [ -r ${INPUT}/$file ]; then
                    890:     file_to_fix=${INPUT}/$file
                    891:   else
                    892:     file_to_fix=""
                    893:   fi
                    894: fi
                    895: if [ \! -z "$file_to_fix" ]; then
                    896:   echo Checking $file_to_fix
                    897:   if grep _KERNEL $file_to_fix > /dev/null; then
                    898:     echo No change needed in $file_to_fix
                    899:   else
                    900:     echo '#ifdef _KERNEL' > /tmp/$base
                    901:     cat $file_to_fix >> /tmp/$base
                    902:     echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
                    903:     echo Fixed $file_to_fix
                    904:     rm -f ${LIB}/$file
                    905:     cp /tmp/$base ${LIB}/$file
                    906:     rm -f /tmp/$base
                    907:   fi
                    908: fi
                    909: 
1.1.1.4 ! root      910: # Conditionalize some of <netinet/in.h> on _KERNEL being defined.
        !           911: 
        !           912: file=netinet/in.h
        !           913: base=`basename $file`
        !           914: if [ -r ${LIB}/$file ]; then
        !           915:   file_to_fix=${LIB}/$file
        !           916: else
        !           917:   if [ -r ${INPUT}/$file ]; then
        !           918:     file_to_fix=${INPUT}/$file
        !           919:   else
        !           920:     file_to_fix=""
        !           921:   fi
        !           922: fi
        !           923: if [ \! -z "$file_to_fix" ]; then
        !           924:   echo Checking $file_to_fix
        !           925:   if grep _KERNEL $file_to_fix > /dev/null; then
        !           926:     echo No change needed in $file_to_fix
        !           927:   else
        !           928:     sed -e '/#ifdef INKERNEL/i\
        !           929: #ifdef _KERNEL' \
        !           930:     -e '/#endif[       ]*\/\* INKERNEL \*\//a\
        !           931: #endif /* _KERNEL */' \
        !           932:     $file_to_fix > ${LIB}/${file}.sed
        !           933:     rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !           934:     echo Fixed $file_to_fix
        !           935:   fi
        !           936: fi
        !           937: 
        !           938: # Conditionalize some of <sys/endian.h> on __GNUC__ and __GNUG__.
        !           939: 
        !           940: file=sys/endian.h
        !           941: base=`basename $file`
        !           942: if [ -r ${LIB}/$file ]; then
        !           943:   file_to_fix=${LIB}/$file
        !           944: else
        !           945:   if [ -r ${INPUT}/$file ]; then
        !           946:     file_to_fix=${INPUT}/$file
        !           947:   else
        !           948:     file_to_fix=""
        !           949:   fi
        !           950: fi
        !           951: if [ \! -z "$file_to_fix" ]; then
        !           952:   echo Checking $file_to_fix
        !           953:   if grep __GNUC__ $file_to_fix > /dev/null; then
        !           954:     echo No change needed in $file_to_fix
        !           955:   else
        !           956:     sed -e '/# ifdef   __STDC__/i\
        !           957: #   if !defined (__GNUC__) && !defined (__GNUG__)' \
        !           958:     -e '/#             include <sys\/byteorder.h>/s/           /   /'\
        !           959:     -e '/#   include   <sys\/byteorder.h>/i\
        !           960: #   endif /* !defined (__GNUC__) && !defined (__GNUG__) */'\
        !           961:     $file_to_fix > ${LIB}/${file}.sed
        !           962:     rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !           963:     echo Fixed $file_to_fix
        !           964:   fi
        !           965: fi
        !           966: 
        !           967: # Commented out because [email protected] says we don't clearly need it
        !           968: # and the text in types.h is not erroneous.
        !           969: ## In sys/types.h, don't name the enum for booleans.
        !           970: #
        !           971: #file=sys/types.h
        !           972: #base=`basename $file`
        !           973: #if [ -r ${LIB}/$file ]; then
        !           974: #  file_to_fix=${LIB}/$file
        !           975: #else
        !           976: #  if [ -r ${INPUT}/$file ]; then
        !           977: #    file_to_fix=${INPUT}/$file
        !           978: #  else
        !           979: #    file_to_fix=""
        !           980: #  fi
        !           981: #fi
        !           982: #if [ \! -z "$file_to_fix" ]; then
        !           983: #  echo Checking $file_to_fix
        !           984: #  if grep "enum boolean" $file_to_fix > /dev/null; then
        !           985: #    sed -e 's/enum boolean/enum/' ${LIB}/$file > ${LIB}/${file}.sed
        !           986: #    rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
        !           987: #    echo Fixed $file_to_fix
        !           988: #  else
        !           989: #    echo No change needed in $file_to_fix
        !           990: #  fi
        !           991: #fi
        !           992: 
        !           993: # Remove useless extern keyword from struct forward declarations in
        !           994: # <sys/stream.h> and <sys/strsubr.h>
        !           995: 
        !           996: file=sys/stream.h
        !           997: base=`basename $file`
        !           998: if [ -r ${LIB}/$file ]; then
        !           999:   file_to_fix=${LIB}/$file
        !          1000: else
        !          1001:   if [ -r ${INPUT}/$file ]; then
        !          1002:     file_to_fix=${INPUT}/$file
        !          1003:   else
        !          1004:     file_to_fix=""
        !          1005:   fi
        !          1006: fi
        !          1007: if [ \! -z "$file_to_fix" ]; then
        !          1008:   echo Checking $file_to_fix
        !          1009:   sed -e '
        !          1010:     s/extern struct stdata;/struct stdata;/g
        !          1011:     s/extern struct strevent;/struct strevent;/g
        !          1012:   ' $file_to_fix > /tmp/$base 
        !          1013:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
        !          1014:     echo No change needed in $file_to_fix
        !          1015:   else
        !          1016:     echo Fixed $file_to_fix
        !          1017:     rm -f ${LIB}/$file
        !          1018:     cp /tmp/$base ${LIB}/$file
        !          1019:   fi
        !          1020:   rm -f /tmp/$base
        !          1021: fi
        !          1022: 
        !          1023: file=sys/strsubr.h
        !          1024: base=`basename $file`
        !          1025: if [ -r ${LIB}/$file ]; then
        !          1026:   file_to_fix=${LIB}/$file
        !          1027: else
        !          1028:   if [ -r ${INPUT}/$file ]; then
        !          1029:     file_to_fix=${INPUT}/$file
        !          1030:   else
        !          1031:     file_to_fix=""
        !          1032:   fi
        !          1033: fi
        !          1034: if [ \! -z "$file_to_fix" ]; then
        !          1035:   echo Checking $file_to_fix
        !          1036:   sed -e '
        !          1037:     s/extern struct strbuf;/struct strbuf;/g
        !          1038:     s/extern struct uio;/struct uio;/g
        !          1039:     s/extern struct thread;/struct thread;/g
        !          1040:     s/extern struct proc;/struct proc;/g
        !          1041:   ' $file_to_fix > /tmp/$base 
        !          1042:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
        !          1043:     echo No change needed in $file_to_fix
        !          1044:   else
        !          1045:     echo Fixed $file_to_fix
        !          1046:     rm -f ${LIB}/$file
        !          1047:     cp /tmp/$base ${LIB}/$file
        !          1048:   fi
        !          1049:   rm -f /tmp/$base
        !          1050: fi
        !          1051: 
        !          1052: # Convert functions to prototype form, and fix arg names in <sys/stat.h>.
        !          1053: 
        !          1054: file=sys/stat.h
        !          1055: base=`basename $file`
        !          1056: if [ -r ${LIB}/$file ]; then
        !          1057:   file_to_fix=${LIB}/$file
        !          1058: else
        !          1059:   if [ -r ${INPUT}/$file ]; then
        !          1060:     file_to_fix=${INPUT}/$file
        !          1061:   else
        !          1062:     file_to_fix=""
        !          1063:   fi
        !          1064: fi
        !          1065: if [ \! -z "$file_to_fix" ]; then
        !          1066:   echo Checking $file_to_fix
        !          1067:   cp $file_to_fix /tmp/$base
        !          1068:   chmod +w /tmp/$base
        !          1069:   ex /tmp/$base <<EOF
        !          1070: /^stat(path, buf)/j
        !          1071: j
        !          1072: -
        !          1073: /^stat(path, buf)/c
        !          1074: stat (const char *path, struct stat *buf)
        !          1075: .
        !          1076: /^lstat(path, buf)/j
        !          1077: j
        !          1078: -
        !          1079: /^lstat(path, buf)/c
        !          1080: lstat (const char *path, struct stat *buf)
        !          1081: .
        !          1082: /^fstat(fd, buf)/j
        !          1083: j
        !          1084: -
        !          1085: /^fstat(fd, buf)/c
        !          1086: fstat (int fd, struct stat *buf)
        !          1087: .
        !          1088: /^mknod(path, mode, dev)/j
        !          1089: j
        !          1090: j
        !          1091: -
        !          1092: /^mknod(path, mode, dev)/c
        !          1093: mknod (const char *path, mode_t mode, dev_t dev)
        !          1094: .
        !          1095: 1,\$s/path/__path/g
        !          1096: 1,\$s/buf/__buf/g
        !          1097: 1,\$s/fd/__fd/g
        !          1098: 1,\$s/ret\\([^u]\\)/__ret\1/g
        !          1099: 1,\$s/\\([^_]\\)mode\\([^_]\\)/\\1__mode\\2/g
        !          1100: 1,\$s/\\([^_r]\\)dev\\([^_]\\)/\\1__dev\\2/g
        !          1101: wq
        !          1102: EOF
        !          1103:   echo Fixed $file_to_fix
        !          1104:   rm -f ${LIB}/$file
        !          1105:   cp /tmp/$base ${LIB}/$file
        !          1106:   rm -f /tmp/$base
        !          1107: fi
        !          1108: 
1.1.1.2   root     1109: # Sony NEWSOS 5.0 does not support the complete ANSI C standard.
                   1110: 
                   1111: if [ -x /bin/sony ]; then
                   1112:   if /bin/sony; then
                   1113: 
                   1114:     # Change <stdio.h> to not define __filbuf, __flsbuf, and __iob
                   1115: 
                   1116:     file=stdio.h
                   1117:     base=`basename $file`
                   1118:     if [ -r ${LIB}/$file ]; then
                   1119:       file_to_fix=${LIB}/$file
                   1120:     else
                   1121:       if [ -r ${INPUT}/$file ]; then
                   1122:         file_to_fix=${INPUT}/$file
                   1123:       else
                   1124:         file_to_fix=""
                   1125:       fi
                   1126:     fi
                   1127:     if [ \! -z "$file_to_fix" ]; then
                   1128:       echo Checking $file_to_fix
                   1129:       cp $file_to_fix /tmp/$base
                   1130:       chmod +w /tmp/$base
                   1131:       sed -e '
                   1132:         s/__filbuf/_filbuf/g
                   1133:         s/__flsbuf/_flsbuf/g
                   1134:         s/__iob/_iob/g
                   1135:       ' /tmp/$base > /tmp/$base.sed
                   1136:       mv /tmp/$base.sed /tmp/$base
                   1137:       if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then
                   1138:         echo No change needed in $file_to_fix
                   1139:       else
                   1140:         echo Fixed $file_to_fix
                   1141:         rm -f ${LIB}/$file
                   1142:         cp /tmp/$base ${LIB}/$file
                   1143:       fi
                   1144:       rm -f /tmp/$base
                   1145:     fi
                   1146: 
                   1147:     # Change <ctype.h> to not define __ctype
                   1148: 
                   1149:     file=ctype.h
                   1150:     base=`basename $file`
                   1151:     if [ -r ${LIB}/$file ]; then
                   1152:       file_to_fix=${LIB}/$file
                   1153:     else
                   1154:       if [ -r ${INPUT}/$file ]; then
                   1155:         file_to_fix=${INPUT}/$file
                   1156:       else
                   1157:         file_to_fix=""
                   1158:       fi
                   1159:     fi
                   1160:     if [ \! -z "$file_to_fix" ]; then
                   1161:       echo Checking $file_to_fix
                   1162:       cp $file_to_fix /tmp/$base
                   1163:       chmod +w /tmp/$base
                   1164:       sed -e '
                   1165:         s/__ctype/_ctype/g
                   1166:       ' /tmp/$base > /tmp/$base.sed
                   1167:       mv /tmp/$base.sed /tmp/$base
                   1168:       if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then
                   1169:         echo No change needed in $file_to_fix
                   1170:       else
                   1171:         echo Fixed $file_to_fix
                   1172:         rm -f ${LIB}/$file
                   1173:         cp /tmp/$base ${LIB}/$file
                   1174:       fi
                   1175:       rm -f /tmp/$base
                   1176:     fi
                   1177:   fi
                   1178: fi
                   1179: 
1.1.1.4 ! root     1180: # In limits.h, put #ifndefs around things that are supposed to be defined
        !          1181: # in float.h to avoid redefinition errors if float.h is included first.
        !          1182: # Solaris 2.1 has this problem.
        !          1183: 
        !          1184: file=limits.h
        !          1185: base=`basename $file`
        !          1186: if [ -r ${LIB}/$file ]; then
        !          1187:   file_to_fix=${LIB}/$file
        !          1188: else
        !          1189:   if [ -r ${INPUT}/$file ]; then
        !          1190:     file_to_fix=${INPUT}/$file
        !          1191:   else
        !          1192:     file_to_fix=""
        !          1193:   fi
        !          1194: fi
        !          1195: if [ \! -z "$file_to_fix" ]; then
        !          1196:   echo Checking $file_to_fix
        !          1197:   sed -e '/[   ]FLT_MIN[       ]/i\
        !          1198: #ifndef FLT_MIN'\
        !          1199:       -e '/[   ]FLT_MIN[       ]/a\
        !          1200: #endif'\
        !          1201:       -e '/[   ]FLT_MAX[       ]/i\
        !          1202: #ifndef FLT_MAX'\
        !          1203:       -e '/[   ]FLT_MAX[       ]/a\
        !          1204: #endif'\
        !          1205:       -e '/[   ]FLT_DIG[       ]/i\
        !          1206: #ifndef FLT_DIG'\
        !          1207:       -e '/[   ]FLT_DIG[       ]/a\
        !          1208: #endif'\
        !          1209:       -e '/[   ]DBL_MIN[       ]/i\
        !          1210: #ifndef DBL_MIN'\
        !          1211:       -e '/[   ]DBL_MIN[       ]/a\
        !          1212: #endif'\
        !          1213:       -e '/[   ]DBL_MAX[       ]/i\
        !          1214: #ifndef DBL_MAX'\
        !          1215:       -e '/[   ]DBL_MAX[       ]/a\
        !          1216: #endif'\
        !          1217:       -e '/[   ]DBL_DIG[       ]/i\
        !          1218: #ifndef DBL_DIG'\
        !          1219:       -e '/[   ]DBL_DIG[       ]/a\
        !          1220: #endif' $file_to_fix > /tmp/$base
        !          1221:   if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
        !          1222:     echo No change needed in $file_to_fix
        !          1223:   else
        !          1224:     echo Fixed $file_to_fix
        !          1225:     rm -f ${LIB}/$file
        !          1226:     cp /tmp/$base ${LIB}/$file
        !          1227:   fi
        !          1228:   rm -f /tmp/$base
        !          1229: fi
        !          1230: 
1.1       root     1231: echo 'Removing unneeded directories:'
                   1232: cd $LIB
                   1233: files=`find . -type d -print | sort -r`
                   1234: for file in $files; do
                   1235:   rmdir $LIB/$file > /dev/null 2>&1
                   1236: done
                   1237: 
                   1238: if $LINKS; then
                   1239:   echo 'Making internal symbolic non-directory links'
                   1240:   cd ${INPUT}
                   1241:   files=`find . -type l -print`
                   1242:   for file in $files; do
                   1243:     dest=`ls -ld $file | sed -n 's/.*-> //p'`
                   1244:     if expr "$dest" : '[^/].*' > /dev/null; then    
                   1245:       target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
                   1246:       if [ -f $target ]; then
                   1247:         ln -s $dest ${LIB}/$file >/dev/null 2>&1
                   1248:       fi
                   1249:     fi
                   1250:   done
                   1251: fi
                   1252: 
                   1253: cd ${ORIG_DIR}
                   1254: 
                   1255: echo 'Replacing <sys/byteorder.h>'
                   1256: rm -f ${LIB}/sys/byteorder.h
1.1.1.4 ! root     1257: cp ${SRCDIR}/byteorder.h ${LIB}/sys/byteorder.h
1.1       root     1258: 
                   1259: exit 0
                   1260: 

unix.superglobalmegacorp.com

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