|
|
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: ! 63: # Determine whether this system has symbolic links. ! 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 ' ! 151: s%^[ ]*#else[ ][ ]*\([^/ ].*\)%#else /* \1 */% ! 152: s%^[ ]*#endif[ ][ ]*\([^/ ].*\)%#endif /* \1 */% ! 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 ! 158: /#[a-z]*if.*[ (]m68k/ s/m68k/__m68k__/g ! 159: /#[a-z]*if.*[ (]__i386/ s/__i386/__i386__/g ! 160: /#[a-z]*if.*[ (]i386/ s/i386/__i386__/g ! 161: /#[a-z]*if.*[ (]sparc/ s/sparc/__sparc__/g ! 162: /#[a-z]*if.*[ (]mc68000/ s/mc68000/__mc68000__/g ! 163: /#[a-z]*if.*[ (]vax/ s/vax/__vax__/g ! 164: /#[a-z]*if.*[ (]sun3x/ s/sun3x/__sun3x__/g ! 165: /#[a-z]*if.*[ (]sun3/ s/sun3/__sun3__/g ! 166: /#[a-z]*if.*[ (]sun2/ s/sun2/__sun2__/g ! 167: /#[a-z]*if.*[ (]sun4c/ s/sun4c/__sun4c__/g ! 168: /#[a-z]*if.*[ (]sun4/ s/sun4/__sun4__/g ! 169: /#[a-z]*if.*[ (]sun/ s/sun/__sun__/g ! 170: /#[a-z]*if.*[ (]ns32000/ s/ns32000/__ns32000__/g ! 171: /#[a-z]*if.*[ (]pyr/ s/pyr/__pyr__/g ! 172: /#[a-z]*if.*[ (]is68k/ s/is68k/__is68k__/g ! 173: /#[a-z]*if.*[ (]sun386/ s/sun386/__sun386__/g ! 174: s/u_char\([ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[ ]*:[ ]*[0-9][0-9]*\)/u_int\1/ ! 175: s/u_short\([ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[ ]*:[ ]*[0-9][0-9]*\)/u_int\1/ ! 176: s/ushort\([ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[ ]*:[ ]*[0-9][0-9]*\)/u_int\1/ ! 177: s/evcm_t\([ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[ ]*:[ ]*[0-9][0-9]*\)/u_int\1/ ! 178: s/Pbyte\([ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[ ]*:[ ]*SEQSIZ\)/unsigned int\1/ ! 179: s/__STDC__ == 0/!defined (__STRICT_ANSI__)/g ! 180: s/__STDC__ != 0/defined (__STRICT_ANSI__)/g ! 181: s/__STDC__ - 0 == 0/!defined (__STRICT_ANSI__)/g ! 182: ' $2/$file > $2/$file.sed ! 183: mv $2/$file.sed $2/$file ! 184: if cmp $file $2/$file >/dev/null 2>&1; then ! 185: echo Deleting $2/$file\; no fixes were needed. ! 186: rm $2/$file ! 187: fi ! 188: fi ! 189: done ! 190: shift; shift ! 191: done ! 192: ! 193: # Fix first broken decl of getcwd present on some svr4 systems. ! 194: ! 195: file=stdlib.h ! 196: base=`basename $file` ! 197: if [ -r ${LIB}/$file ]; then ! 198: file_to_fix=${LIB}/$file ! 199: else ! 200: if [ -r ${INPUT}/$file ]; then ! 201: file_to_fix=${INPUT}/$file ! 202: else ! 203: file_to_fix="" ! 204: fi ! 205: fi ! 206: if [ \! -z "$file_to_fix" ]; then ! 207: echo Checking $file_to_fix ! 208: sed -e 's/getcwd(char \*, int)/getcwd(char *, size_t)/' $file_to_fix > /tmp/$base ! 209: if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \ ! 210: echo No change needed in $file_to_fix ! 211: else ! 212: echo Fixed $file_to_fix ! 213: rm -f ${LIB}/$file ! 214: cp /tmp/$base ${LIB}/$file ! 215: fi ! 216: rm -f /tmp/$base ! 217: fi ! 218: ! 219: # Fix second broken decl of getcwd present on some svr4 systems. Also ! 220: # fix the incorrect decl of profil present on some svr4 systems. ! 221: ! 222: file=unistd.h ! 223: base=`basename $file` ! 224: if [ -r ${LIB}/$file ]; then ! 225: file_to_fix=${LIB}/$file ! 226: else ! 227: if [ -r ${INPUT}/$file ]; then ! 228: file_to_fix=${INPUT}/$file ! 229: else ! 230: file_to_fix="" ! 231: fi ! 232: fi ! 233: if [ \! -z "$file_to_fix" ]; then ! 234: echo Checking $file_to_fix ! 235: sed -e 's/getcwd(char \*, int)/getcwd(char *, size_t)/' $file_to_fix \ ! 236: | sed -e 's/profil(unsigned short \*, unsigned int, unsigned int, unsigned int)/profil(unsigned short *, size_t, int, unsigned)/' > /tmp/$base ! 237: if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \ ! 238: echo No change needed in $file_to_fix ! 239: else ! 240: echo Fixed $file_to_fix ! 241: rm -f ${LIB}/$file ! 242: cp /tmp/$base ${LIB}/$file ! 243: fi ! 244: rm -f /tmp/$base ! 245: fi ! 246: ! 247: # Fix the definition of NULL in <sys/param.h> so that it is conditional ! 248: # and so that it is correct for both C and C++. ! 249: ! 250: file=sys/param.h ! 251: base=`basename $file` ! 252: if [ -r ${LIB}/$file ]; then ! 253: file_to_fix=${LIB}/$file ! 254: else ! 255: if [ -r ${INPUT}/$file ]; then ! 256: file_to_fix=${INPUT}/$file ! 257: else ! 258: file_to_fix="" ! 259: fi ! 260: fi ! 261: if [ \! -z "$file_to_fix" ]; then ! 262: echo Checking $file_to_fix ! 263: cp $file_to_fix /tmp/$base ! 264: chmod +w /tmp/$base ! 265: ex /tmp/$base <<EOF ! 266: /^#define[ ]*NULL[ ]*0$/c ! 267: #ifndef NULL ! 268: #ifdef __cplusplus ! 269: #define __NULL_TYPE ! 270: #else /* !defined(__cplusplus) */ ! 271: #define __NULL_TYPE (void *) ! 272: #endif /* !defined(__cplusplus) */ ! 273: #define NULL (__NULL_TYPE 0) ! 274: #endif /* !defined(NULL) */ ! 275: . ! 276: wq ! 277: EOF ! 278: if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \ ! 279: echo No change needed in $file_to_fix ! 280: else ! 281: echo Fixed $file_to_fix ! 282: rm -f ${LIB}/$file ! 283: cp /tmp/$base ${LIB}/$file ! 284: fi ! 285: rm -f /tmp/$base ! 286: fi ! 287: ! 288: # Likewise fix the definition of NULL in <stdio.h> so that it is conditional ! 289: # and so that it is correct for both C and C++. ! 290: ! 291: file=stdio.h ! 292: base=`basename $file` ! 293: if [ -r ${LIB}/$file ]; then ! 294: file_to_fix=${LIB}/$file ! 295: else ! 296: if [ -r ${INPUT}/$file ]; then ! 297: file_to_fix=${INPUT}/$file ! 298: else ! 299: file_to_fix="" ! 300: fi ! 301: fi ! 302: if [ \! -z "$file_to_fix" ]; then ! 303: echo Checking $file_to_fix ! 304: cp $file_to_fix /tmp/$base ! 305: chmod +w /tmp/$base ! 306: ex /tmp/$base <<EOF ! 307: /^#define[ ]*NULL[ ]*0$/c ! 308: #ifdef __cplusplus ! 309: #define __NULL_TYPE ! 310: #else /* !defined(__cplusplus) */ ! 311: #define __NULL_TYPE (void *) ! 312: #endif /* !defined(__cplusplus) */ ! 313: #define NULL (__NULL_TYPE 0) ! 314: . ! 315: wq ! 316: EOF ! 317: if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \ ! 318: echo No change needed in $file_to_fix ! 319: else ! 320: echo Fixed $file_to_fix ! 321: rm -f ${LIB}/$file ! 322: cp /tmp/$base ${LIB}/$file ! 323: fi ! 324: rm -f /tmp/$base ! 325: fi ! 326: ! 327: # Add some missing declarations to <sys/mman.h>. ! 328: ! 329: file=sys/mman.h ! 330: base=`basename $file` ! 331: if [ -r ${LIB}/$file ]; then ! 332: file_to_fix=${LIB}/$file ! 333: else ! 334: if [ -r ${INPUT}/$file ]; then ! 335: file_to_fix=${INPUT}/$file ! 336: else ! 337: file_to_fix="" ! 338: fi ! 339: fi ! 340: if [ \! -z "$file_to_fix" ]; then ! 341: echo Checking $file_to_fix ! 342: cp $file_to_fix /tmp/$base ! 343: chmod +w /tmp/$base ! 344: ex /tmp/$base <<EOF ! 345: /^extern caddr_t mmap();$/c ! 346: #ifdef __STDC__ ! 347: extern caddr_t mmap (caddr_t addr, size_t len, int prot, int flags, ! 348: int fd, off_t off); ! 349: #else /* !defined(__STDC__) */ ! 350: extern caddr_t mmap (); ! 351: #endif /* !defined(__STDC__) */ ! 352: . ! 353: wq ! 354: EOF ! 355: if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \ ! 356: echo No changed needed in $file_to_fix ! 357: else ! 358: echo Fixed $file_to_fix ! 359: rm -f ${LIB}/$file ! 360: cp /tmp/$base ${LIB}/$file ! 361: fi ! 362: rm -f /tmp/$base ! 363: fi ! 364: ! 365: # Fix declarations of `ftw' and `nftw' in <ftw.h>. ! 366: ! 367: file=ftw.h ! 368: base=`basename $file` ! 369: if [ -r ${LIB}/$file ]; then ! 370: file_to_fix=${LIB}/$file ! 371: else ! 372: if [ -r ${INPUT}/$file ]; then ! 373: file_to_fix=${INPUT}/$file ! 374: else ! 375: file_to_fix="" ! 376: fi ! 377: fi ! 378: if [ \! -z "$file_to_fix" ]; then ! 379: echo Checking $file_to_fix ! 380: cp $file_to_fix /tmp/$base ! 381: chmod +w /tmp/$base ! 382: ex /tmp/$base <<EOF ! 383: /^extern int ftw(const/c ! 384: #if !defined(_STYPES) ! 385: static ! 386: #else ! 387: extern ! 388: #endif ! 389: int ftw(const char *, int (*)(const char *, const struct stat *, int), int); ! 390: . ! 391: /^extern int nftw/c ! 392: #if defined(_STYPES) ! 393: static ! 394: #else ! 395: extern ! 396: #endif ! 397: int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *),int, int); ! 398: . ! 399: /^extern int ftw(),/c ! 400: #if !defined(_STYPES) ! 401: static ! 402: #else ! 403: extern ! 404: #endif ! 405: int ftw(); ! 406: #if defined(_STYPES) ! 407: static ! 408: #else ! 409: extern ! 410: #endif ! 411: int nftw(); ! 412: . ! 413: wq ! 414: EOF ! 415: if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \ ! 416: echo No change needed in $file_to_fix ! 417: else ! 418: echo Fixed $file_to_fix ! 419: rm -f ${LIB}/$file ! 420: cp /tmp/$base ${LIB}/$file ! 421: fi ! 422: rm -f /tmp/$base ! 423: fi ! 424: ! 425: # Add a `static' declaration of `getrnge' into <regexp.h>. ! 426: ! 427: file=regexp.h ! 428: base=`basename $file` ! 429: if [ -r ${LIB}/$file ]; then ! 430: file_to_fix=${LIB}/$file ! 431: else ! 432: if [ -r ${INPUT}/$file ]; then ! 433: file_to_fix=${INPUT}/$file ! 434: else ! 435: file_to_fix="" ! 436: fi ! 437: fi ! 438: if [ \! -z "$file_to_fix" ]; then ! 439: echo Checking $file_to_fix ! 440: cp $file_to_fix /tmp/$base ! 441: chmod +w /tmp/$base ! 442: ex /tmp/$base <<EOF ! 443: /^static int[ ]*size;/c ! 444: static int size ; ! 445: ! 446: static int getrnge (); ! 447: . ! 448: wq ! 449: EOF ! 450: if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \ ! 451: echo No change needed in $file_to_fix ! 452: else ! 453: echo Fixed $file_to_fix ! 454: rm -f ${LIB}/$file ! 455: cp /tmp/$base ${LIB}/$file ! 456: fi ! 457: rm -f /tmp/$base ! 458: fi ! 459: ! 460: # Add a #define of _SIGACTION_ into <sys/signal.h>. ! 461: ! 462: file=sys/signal.h ! 463: base=`basename $file` ! 464: if [ -r ${LIB}/$file ]; then ! 465: file_to_fix=${LIB}/$file ! 466: else ! 467: if [ -r ${INPUT}/$file ]; then ! 468: file_to_fix=${INPUT}/$file ! 469: else ! 470: file_to_fix="" ! 471: fi ! 472: fi ! 473: if [ \! -z "$file_to_fix" ]; then ! 474: echo Checking $file_to_fix ! 475: cp $file_to_fix /tmp/$base ! 476: chmod +w /tmp/$base ! 477: ex /tmp/$base <<EOF ! 478: /^struct sigaction {/c ! 479: #define _SIGACTION_ ! 480: struct sigaction { ! 481: . ! 482: wq ! 483: EOF ! 484: if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \ ! 485: echo No change needed in $file_to_fix ! 486: else ! 487: echo Fixed $file_to_fix ! 488: rm -f ${LIB}/$file ! 489: cp /tmp/$base ${LIB}/$file ! 490: fi ! 491: rm -f /tmp/$base ! 492: fi ! 493: ! 494: # Fix declarations of `makedev', `major', and `minor' in <sys/mkdev.h>. ! 495: ! 496: file=sys/mkdev.h ! 497: base=`basename $file` ! 498: if [ -r ${LIB}/$file ]; then ! 499: file_to_fix=${LIB}/$file ! 500: else ! 501: if [ -r ${INPUT}/$file ]; then ! 502: file_to_fix=${INPUT}/$file ! 503: else ! 504: file_to_fix="" ! 505: fi ! 506: fi ! 507: if [ \! -z "$file_to_fix" ]; then ! 508: echo Checking $file_to_fix ! 509: cp $file_to_fix /tmp/$base ! 510: chmod +w /tmp/$base ! 511: ex /tmp/$base <<EOF ! 512: /^dev_t makedev(const/c ! 513: static dev_t makedev(const major_t, const minor_t); ! 514: . ! 515: /^dev_t makedev()/c ! 516: static dev_t makedev(); ! 517: . ! 518: /^major_t major(const/c ! 519: static major_t major(const dev_t); ! 520: . ! 521: /^major_t major()/c ! 522: static major_t major(); ! 523: . ! 524: /^minor_t minor(const/c ! 525: static minor_t minor(const dev_t); ! 526: . ! 527: /^minor_t minor()/c ! 528: static minor_t minor(); ! 529: . ! 530: wq ! 531: EOF ! 532: if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \ ! 533: echo No change needed in $file_to_fix ! 534: else ! 535: echo Fixed $file_to_fix ! 536: rm -f ${LIB}/$file ! 537: cp /tmp/$base ${LIB}/$file ! 538: fi ! 539: rm -f /tmp/$base ! 540: fi ! 541: ! 542: # Fix reference to NMSZ in <sys/adv.h>. ! 543: ! 544: file=sys/adv.h ! 545: base=`basename $file` ! 546: if [ -r ${LIB}/$file ]; then ! 547: file_to_fix=${LIB}/$file ! 548: else ! 549: if [ -r ${INPUT}/$file ]; then ! 550: file_to_fix=${INPUT}/$file ! 551: else ! 552: file_to_fix="" ! 553: fi ! 554: fi ! 555: if [ \! -z "$file_to_fix" ]; then ! 556: echo Checking $file_to_fix ! 557: sed 's/\[NMSZ\]/\[RFS_NMSZ\]/g' $file_to_fix > /tmp/$base ! 558: if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \ ! 559: echo No change needed in $file_to_fix ! 560: else ! 561: echo Fixed $file_to_fix ! 562: rm -f ${LIB}/$file ! 563: cp /tmp/$base ${LIB}/$file ! 564: fi ! 565: rm -f /tmp/$base ! 566: fi ! 567: ! 568: # Fix reference to NC_NPI_RAW in <sys/netcspace.h>. Also fix types of ! 569: # array initializers. ! 570: ! 571: file=sys/netcspace.h ! 572: base=`basename $file` ! 573: if [ -r ${LIB}/$file ]; then ! 574: file_to_fix=${LIB}/$file ! 575: else ! 576: if [ -r ${INPUT}/$file ]; then ! 577: file_to_fix=${INPUT}/$file ! 578: else ! 579: file_to_fix="" ! 580: fi ! 581: fi ! 582: if [ \! -z "$file_to_fix" ]; then ! 583: echo Checking $file_to_fix ! 584: sed 's/NC_NPI_RAW/NC_TPI_RAW/g' $file_to_fix \ ! 585: | sed 's/NC_/(unsigned long) NC_/' > /tmp/$base ! 586: if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \ ! 587: echo No change needed in $file_to_fix ! 588: else ! 589: echo Fixed $file_to_fix ! 590: rm -f ${LIB}/$file ! 591: cp /tmp/$base ${LIB}/$file ! 592: fi ! 593: rm -f /tmp/$base ! 594: fi ! 595: ! 596: # Conditionalize all of <fs/rfs/rf_cache.h> on _KERNEL being defined. ! 597: ! 598: file=fs/rfs/rf_cache.h ! 599: base=`basename $file` ! 600: if [ -r ${LIB}/$file ]; then ! 601: file_to_fix=${LIB}/$file ! 602: else ! 603: if [ -r ${INPUT}/$file ]; then ! 604: file_to_fix=${INPUT}/$file ! 605: else ! 606: file_to_fix="" ! 607: fi ! 608: fi ! 609: if [ \! -z "$file_to_fix" ]; then ! 610: echo Checking $file_to_fix ! 611: if grep _KERNEL $file_to_fix > /dev/null; then ! 612: echo No change needed in $file_to_fix ! 613: else ! 614: echo '#ifdef _KERNEL' > /tmp/$base ! 615: cat $file_to_fix >> /tmp/$base ! 616: echo '#endif /* defined(_KERNEL) */' >> /tmp/$base ! 617: echo Fixed $file_to_fix ! 618: rm -f ${LIB}/$file ! 619: cp /tmp/$base ${LIB}/$file ! 620: rm -f /tmp/$base ! 621: fi ! 622: fi ! 623: ! 624: # Conditionalize all of <sys/erec.h> on _KERNEL being defined. ! 625: ! 626: file=sys/erec.h ! 627: base=`basename $file` ! 628: if [ -r ${LIB}/$file ]; then ! 629: file_to_fix=${LIB}/$file ! 630: else ! 631: if [ -r ${INPUT}/$file ]; then ! 632: file_to_fix=${INPUT}/$file ! 633: else ! 634: file_to_fix="" ! 635: fi ! 636: fi ! 637: if [ \! -z "$file_to_fix" ]; then ! 638: echo Checking $file_to_fix ! 639: if grep _KERNEL $file_to_fix > /dev/null; then ! 640: echo No change needed in $file_to_fix ! 641: else ! 642: echo '#ifdef _KERNEL' > /tmp/$base ! 643: cat $file_to_fix >> /tmp/$base ! 644: echo '#endif /* defined(_KERNEL) */' >> /tmp/$base ! 645: echo Fixed $file_to_fix ! 646: rm -f ${LIB}/$file ! 647: cp /tmp/$base ${LIB}/$file ! 648: rm -f /tmp/$base ! 649: fi ! 650: fi ! 651: ! 652: # Conditionalize all of <sys/err.h> on _KERNEL being defined. ! 653: ! 654: file=sys/err.h ! 655: base=`basename $file` ! 656: if [ -r ${LIB}/$file ]; then ! 657: file_to_fix=${LIB}/$file ! 658: else ! 659: if [ -r ${INPUT}/$file ]; then ! 660: file_to_fix=${INPUT}/$file ! 661: else ! 662: file_to_fix="" ! 663: fi ! 664: fi ! 665: if [ \! -z "$file_to_fix" ]; then ! 666: echo Checking $file_to_fix ! 667: if grep _KERNEL $file_to_fix > /dev/null; then ! 668: echo No change needed in $file_to_fix ! 669: else ! 670: echo '#ifdef _KERNEL' > /tmp/$base ! 671: cat $file_to_fix >> /tmp/$base ! 672: echo '#endif /* defined(_KERNEL) */' >> /tmp/$base ! 673: echo Fixed $file_to_fix ! 674: rm -f ${LIB}/$file ! 675: cp /tmp/$base ${LIB}/$file ! 676: rm -f /tmp/$base ! 677: fi ! 678: fi ! 679: ! 680: # Conditionalize all of <sys/char.h> on _KERNEL being defined. ! 681: ! 682: file=sys/char.h ! 683: base=`basename $file` ! 684: if [ -r ${LIB}/$file ]; then ! 685: file_to_fix=${LIB}/$file ! 686: else ! 687: if [ -r ${INPUT}/$file ]; then ! 688: file_to_fix=${INPUT}/$file ! 689: else ! 690: file_to_fix="" ! 691: fi ! 692: fi ! 693: if [ \! -z "$file_to_fix" ]; then ! 694: echo Checking $file_to_fix ! 695: if grep _KERNEL $file_to_fix > /dev/null; then ! 696: echo No change needed in $file_to_fix ! 697: else ! 698: echo '#ifdef _KERNEL' > /tmp/$base ! 699: cat $file_to_fix >> /tmp/$base ! 700: echo '#endif /* defined(_KERNEL) */' >> /tmp/$base ! 701: echo Fixed $file_to_fix ! 702: rm -f ${LIB}/$file ! 703: cp /tmp/$base ${LIB}/$file ! 704: rm -f /tmp/$base ! 705: fi ! 706: fi ! 707: ! 708: # Conditionalize all of <sys/getpages.h> on _KERNEL being defined. ! 709: ! 710: file=sys/getpages.h ! 711: base=`basename $file` ! 712: if [ -r ${LIB}/$file ]; then ! 713: file_to_fix=${LIB}/$file ! 714: else ! 715: if [ -r ${INPUT}/$file ]; then ! 716: file_to_fix=${INPUT}/$file ! 717: else ! 718: file_to_fix="" ! 719: fi ! 720: fi ! 721: if [ \! -z "$file_to_fix" ]; then ! 722: echo Checking $file_to_fix ! 723: if grep _KERNEL $file_to_fix > /dev/null; then ! 724: echo No change needed in $file_to_fix ! 725: else ! 726: echo '#ifdef _KERNEL' > /tmp/$base ! 727: cat $file_to_fix >> /tmp/$base ! 728: echo '#endif /* defined(_KERNEL) */' >> /tmp/$base ! 729: echo Fixed $file_to_fix ! 730: rm -f ${LIB}/$file ! 731: cp /tmp/$base ${LIB}/$file ! 732: rm -f /tmp/$base ! 733: fi ! 734: fi ! 735: ! 736: # Conditionalize all of <sys/map.h> on _KERNEL being defined. ! 737: ! 738: file=sys/map.h ! 739: base=`basename $file` ! 740: if [ -r ${LIB}/$file ]; then ! 741: file_to_fix=${LIB}/$file ! 742: else ! 743: if [ -r ${INPUT}/$file ]; then ! 744: file_to_fix=${INPUT}/$file ! 745: else ! 746: file_to_fix="" ! 747: fi ! 748: fi ! 749: if [ \! -z "$file_to_fix" ]; then ! 750: echo Checking $file_to_fix ! 751: if grep _KERNEL $file_to_fix > /dev/null; then ! 752: echo No change needed in $file_to_fix ! 753: else ! 754: echo '#ifdef _KERNEL' > /tmp/$base ! 755: cat $file_to_fix >> /tmp/$base ! 756: echo '#endif /* defined(_KERNEL) */' >> /tmp/$base ! 757: echo Fixed $file_to_fix ! 758: rm -f ${LIB}/$file ! 759: cp /tmp/$base ${LIB}/$file ! 760: rm -f /tmp/$base ! 761: fi ! 762: fi ! 763: ! 764: # Conditionalize all of <sys/cmn_err.h> on _KERNEL being defined. ! 765: ! 766: file=sys/cmn_err.h ! 767: base=`basename $file` ! 768: if [ -r ${LIB}/$file ]; then ! 769: file_to_fix=${LIB}/$file ! 770: else ! 771: if [ -r ${INPUT}/$file ]; then ! 772: file_to_fix=${INPUT}/$file ! 773: else ! 774: file_to_fix="" ! 775: fi ! 776: fi ! 777: if [ \! -z "$file_to_fix" ]; then ! 778: echo Checking $file_to_fix ! 779: if grep _KERNEL $file_to_fix > /dev/null; then ! 780: echo No change needed in $file_to_fix ! 781: else ! 782: echo '#ifdef _KERNEL' > /tmp/$base ! 783: cat $file_to_fix >> /tmp/$base ! 784: echo '#endif /* defined(_KERNEL) */' >> /tmp/$base ! 785: echo Fixed $file_to_fix ! 786: rm -f ${LIB}/$file ! 787: cp /tmp/$base ${LIB}/$file ! 788: rm -f /tmp/$base ! 789: fi ! 790: fi ! 791: ! 792: # Conditionalize all of <sys/kdebugger.h> on _KERNEL being defined. ! 793: ! 794: file=sys/kdebugger.h ! 795: base=`basename $file` ! 796: if [ -r ${LIB}/$file ]; then ! 797: file_to_fix=${LIB}/$file ! 798: else ! 799: if [ -r ${INPUT}/$file ]; then ! 800: file_to_fix=${INPUT}/$file ! 801: else ! 802: file_to_fix="" ! 803: fi ! 804: fi ! 805: if [ \! -z "$file_to_fix" ]; then ! 806: echo Checking $file_to_fix ! 807: if grep _KERNEL $file_to_fix > /dev/null; then ! 808: echo No change needed in $file_to_fix ! 809: else ! 810: echo '#ifdef _KERNEL' > /tmp/$base ! 811: cat $file_to_fix >> /tmp/$base ! 812: echo '#endif /* defined(_KERNEL) */' >> /tmp/$base ! 813: echo Fixed $file_to_fix ! 814: rm -f ${LIB}/$file ! 815: cp /tmp/$base ${LIB}/$file ! 816: rm -f /tmp/$base ! 817: fi ! 818: fi ! 819: ! 820: echo 'Removing unneeded directories:' ! 821: cd $LIB ! 822: files=`find . -type d -print | sort -r` ! 823: for file in $files; do ! 824: rmdir $LIB/$file > /dev/null 2>&1 ! 825: done ! 826: ! 827: if $LINKS; then ! 828: echo 'Making internal symbolic non-directory links' ! 829: cd ${INPUT} ! 830: files=`find . -type l -print` ! 831: for file in $files; do ! 832: dest=`ls -ld $file | sed -n 's/.*-> //p'` ! 833: if expr "$dest" : '[^/].*' > /dev/null; then ! 834: target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"` ! 835: if [ -f $target ]; then ! 836: ln -s $dest ${LIB}/$file >/dev/null 2>&1 ! 837: fi ! 838: fi ! 839: done ! 840: fi ! 841: ! 842: cd ${ORIG_DIR} ! 843: ! 844: echo 'Replacing <sys/byteorder.h>' ! 845: rm -f ${LIB}/sys/byteorder.h ! 846: cp byteorder.h ${LIB}/sys/byteorder.h ! 847: ! 848: exit 0 ! 849:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.