]> gcc.gnu.org Git - gcc.git/blame - gcc/fixinc/inclhack.sh
The generated files
[gcc.git] / gcc / fixinc / inclhack.sh
CommitLineData
06bbab1b
BK
1#!/bin/sh
2#
3# DO NOT EDIT THIS FILE (inclhack.sh)
4#
5# It has been autogen-ed Friday October 16, 1998 at 07:29:49 AM PDT
6# From the definitions inclhack.def
7# and the template file inclhack.tpl
8#
9# Install modified versions of certain ANSI-incompatible system header
10# files which are fixed to work correctly with ANSI C and placed in a
11# directory that GNU C will search.
12#
13# This script contains 104 fixup scripts.
14#
15# See README-fixinc for more information.
16#
17# fixincludes is free software.
18#
19# You may redistribute it and/or modify it under the terms of the
20# GNU General Public License, as published by the Free Software
21# Foundation; either version 2, or (at your option) any later version.
22#
23# fixincludes is distributed in the hope that it will be useful,
24# but WITHOUT ANY WARRANTY; without even the implied warranty of
25# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
26# See the GNU General Public License for more details.
27#
28# You should have received a copy of the GNU General Public License
29# along with fixincludes. See the file "COPYING". If not,
30# write to: The Free Software Foundation, Inc.,
31# 59 Temple Place - Suite 330,
32# Boston, MA 02111-1307, USA.
33#
34# # # # # # # # # # # # # # # # # # # # #
35#
36# Directory in which to store the results.
37# Fail if no arg to specify a directory for the output.
38if [ "x$1" = "x" ]
39then echo fixincludes: no output directory specified
40exit 1
41fi
42
43LIB=${1}
44shift
45
46# Make sure it exists.
47if [ ! -d $LIB ]; then
48 mkdir $LIB || {
49 echo fixincludes: output dir '`'$LIB"' cannot be created"
50 exit 1
51 }
52else
53 ( \cd $LIB && touch DONE && rm DONE ) || {
54 echo fixincludes: output dir '`'$LIB"' is an invalid directory"
55 exit 1
56 }
57fi
58
59# Define what target system we're fixing.
60#
61if test -r ./Makefile; then
62 target_canonical="`sed -n -e 's,^target[ ]*=[ ]*\(.*\)$,\1,p' < Makefile`"
63fi
64
65# If not from the Makefile, then try config.guess
66#
67if test -z "${target_canonical}" ; then
68 if test -x ./config.guess ; then
69 target_canonical="`config.guess`" ; fi
70 test -z "${target_canonical}" && target_canonical=unknown
71fi
72export target_canonical
73
74# # # # # # # # # # # # # # # # # # # # #
75#
76# Define PWDCMD as a command to use to get the working dir
77# in the form that we want.
78PWDCMD=pwd
79
80case "`$PWDCMD`" in
81//*)
82 # On an Apollo, discard everything before `/usr'.
83 PWDCMD="eval pwd | sed -e 's,.*/usr/,/usr/,'"
84 ;;
85esac
86
87# Original directory.
88ORIGDIR=`${PWDCMD}`
89
90# Make LIB absolute only if needed to avoid problems with the amd.
91case $LIB in
92/*)
93 ;;
94*)
95 cd $LIB; LIB=`${PWDCMD}`
96 ;;
97esac
98
99echo Fixing headers into ${LIB} for ${target_canonical} target
100
101# Determine whether this system has symbolic links.
102if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
103 rm -f $LIB/ShouldNotExist
104 LINKS=true
105elif ln -s X /tmp/ShouldNotExist 2>/dev/null; then
106 rm -f /tmp/ShouldNotExist
107 LINKS=true
108else
109 LINKS=false
110fi
111
112# # # # # # # # # # # # # # # # # # # # #
113#
114# Search each input directory for broken header files.
115# This loop ends near the end of the file.
116#
117if test $# -eq 0
118then
119 INPUTLIST="/usr/include"
120else
121 INPUTLIST="$@"
122fi
123
124for INPUT in ${INPUTLIST} ; do
125
126cd ${ORIGDIR}
127
128cd ${INPUT} || {
129 echo 'fixincludes: input dir `'$INPUT"' is an invalid directory"
130 exit 1
131}
132
133#
134# # # # # # # # # # # # # # # # # # # # #
135#
136echo Finding directories and links to directories
137
138# Find all directories and all symlinks that point to directories.
139# Put the list in $files.
140# Each time we find a symlink, add it to newdirs
141# so that we do another find within the dir the link points to.
142# Note that $files may have duplicates in it;
143# later parts of this file are supposed to ignore them.
144dirs="."
145levels=2
146while [ -n "$dirs" ] && [ $levels -gt 0 ]
147do
148 levels=`expr $levels - 1`
149 newdirs=
150 for d in $dirs
151 do
152 echo " Searching $INPUT/$d"
153
154 # Find all directories under $d, relative to $d, excluding $d itself.
155 # (The /. is needed after $d in case $d is a symlink.)
156 files="$files `find $d/. -type d -print | \
157 sed -e '/\/\.$/d' -e 's@/./@/@g'`"
158 # Find all links to directories.
159 # Using `-exec test -d' in find fails on some systems,
160 # and trying to run test via sh fails on others,
161 # so this is the simplest alternative left.
162 # First find all the links, then test each one.
163 theselinks=
164 $LINKS && \
165 theselinks=`find $d/. -type l -print | sed -e 's@/./@/@g'`
166 for d1 in $theselinks --dummy--
167 do
168 # If the link points to a directory,
169 # add that dir to $newdirs
170 if [ -d $d1 ]
171 then
172 files="$files $d1"
173 if [ "`ls -ld $d1 | sed -n 's/.*-> //p'`" != "." ]
174 then
175 newdirs="$newdirs $d1"
176 fi
177 fi
178 done
179 done
180
181 dirs="$newdirs"
182done
183
184# # # # # # # # # # # # # # # # # # # # #
185#
186dirs=
187echo "All directories (including links to directories):"
188echo $files
189
190for file in $files; do
191 rm -rf $LIB/$file
192 if [ ! -d $LIB/$file ]
193 then mkdir $LIB/$file
194 fi
195done
196mkdir $LIB/root
197
198# # # # # # # # # # # # # # # # # # # # #
199#
200# treetops gets an alternating list
201# of old directories to copy
202# and the new directories to copy to.
203treetops="${INPUT} ${LIB}"
204
205if $LINKS; then
206 echo 'Making symbolic directory links'
207 for file in $files; do
208 dest=`ls -ld $file | sed -n 's/.*-> //p'`
209 if [ "$dest" ]; then
210 cwd=`${PWDCMD}`
211 # In case $dest is relative, get to $file's dir first.
212 cd ${INPUT}
213 cd `echo ./$file | sed -n 's&[^/]*$&&p'`
214 # Check that the target directory exists.
215 # Redirections changed to avoid bug in sh on Ultrix.
216 (cd $dest) > /dev/null 2>&1
217 if [ $? = 0 ]; then
218 cd $dest
219 # X gets the dir that the link actually leads to.
220 x=`${PWDCMD}`
221 # Canonicalize ${INPUT} now to minimize the time an
222 # automounter has to change the result of ${PWDCMD}.
223 cinput=`cd ${INPUT}; ${PWDCMD}`
224 # If a link points to ., make a similar link to .
225 if [ $x = ${cinput} ]; then
226 echo $file '->' . ': Making link'
227 rm -fr ${LIB}/$file > /dev/null 2>&1
228 ln -s . ${LIB}/$file > /dev/null 2>&1
229 # If link leads back into ${INPUT},
230 # make a similar link here.
231 elif expr $x : "${cinput}/.*" > /dev/null; then
232 # Y gets the actual target dir name, relative to ${INPUT}.
233 y=`echo $x | sed -n "s&${cinput}/&&p"`
234 # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
235 dots=`echo "$file" |
236 sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
237 echo $file '->' $dots$y ': Making link'
238 rm -fr ${LIB}/$file > /dev/null 2>&1
239 ln -s $dots$y ${LIB}/$file > /dev/null 2>&1
240 else
241 # If the link is to a dir $target outside ${INPUT},
242 # repoint the link at ${INPUT}/root$target
243 # and process $target into ${INPUT}/root$target
244 # treat this directory as if it actually contained the files.
245 echo $file '->' root$x ': Making link'
246 if [ -d $LIB/root$x ]
247 then true
248 else
249 dirname=root$x/
250 dirmade=.
251 cd $LIB
252 while [ x$dirname != x ]; do
253 component=`echo $dirname | sed -e 's|/.*$||'`
254 mkdir $component >/dev/null 2>&1
255 cd $component
256 dirmade=$dirmade/$component
257 dirname=`echo $dirname | sed -e 's|[^/]*/||'`
258 done
259 fi
260 # Duplicate directory structure created in ${LIB}/$file in new
261 # root area.
262 for file2 in $files; do
263 case $file2 in
264 $file/*)
265 dupdir=${LIB}/root$x/`echo $file2 | sed -n "s|^${file}/||p"`
266 echo "Duplicating ${file}'s ${dupdir}"
267 if [ -d ${dupdir} ]
268 then true
269 else
270 mkdir ${dupdir}
271 fi
272 ;;
273 *)
274 ;;
275 esac
276 done
277 # Get the path from ${LIB} to $file, accounting for symlinks.
278 parent=`echo "$file" | sed -e 's@/[^/]*$@@'`
279 libabs=`cd ${LIB}; ${PWDCMD}`
280 file2=`cd ${LIB}; cd $parent; ${PWDCMD} | sed -e "s@^${libabs}@@"`
281 # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
282 dots=`echo "$file2" | sed -e 's@/[^/]*@../@g'`
283 rm -fr ${LIB}/$file > /dev/null 2>&1
284 ln -s ${dots}root$x ${LIB}/$file > /dev/null 2>&1
285 treetops="$treetops $x ${LIB}/root$x"
286 fi
287 fi
288 cd $cwd
289 fi
290 done
291fi
292
293# # # # # # # # # # # # # # # # # # # # #
294#
295required=
296set x $treetops
297shift
298while [ $# != 0 ]; do
299 # $1 is an old directory to copy, and $2 is the new directory to copy to.
300 #
301 SRCDIR=`cd ${INPUT} ; cd $1 ; ${PWDCMD}`
302 export SRCDIR
303 shift
304
305 DESTDIR=`cd $1;${PWDCMD}`
306 export DESTDIR
307 shift
308
309 # The same dir can appear more than once in treetops.
310 # There's no need to scan it more than once.
311 #
312 if [ -f ${DESTDIR}/DONE ]
313 then continue ; fi
314
315 touch ${DESTDIR}/DONE
316 echo Fixing directory ${SRCDIR} into ${DESTDIR}
317
318 # Check .h files which are symlinks as well as those which are files.
319 # A link to a header file will not be processed by anything but this.
320 #
321 cd ${SRCDIR}
322
323 if $LINKS; then
324 files=`find . -name '*.h' \( -type f -o -type l \) -print`
325 else
326 files=`find . -name '*.h' -type f -print`
327 fi
328 echo Checking header files
329 for file in $files; do
330
331 if ( test ! -r $file -o \
332 -n "`fgrep 'This file is part of the GNU C Library' $file`" )
333 then continue ; fi
334
335 fixlist=""
336
337 #
338 # Fix 1: Aix_Syswait
339 #
340 case "$file" in ./sys/wait.h )
341 if ( test -n "`egrep 'bos325,' $file`"
342 ) > /dev/null 2>&1 ; then
343 fixlist="${fixlist}
344 aix_syswait"
345 if [ ! -r ${DESTDIR}/$file ]
346 then infile=$file
347 else infile=${DESTDIR}/$file ; fi
348
349 sed -e '/^extern pid_t wait3();$/i\
350struct rusage;
351' \
352 < $infile > ${DESTDIR}/$file.
353
354 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
355 fi # end of selection 'if'
356 ;; # case end for file name test
357 esac
358
359
360 #
361 # Fix 2: Aix_Volatile
362 #
363 case "$file" in ./sys/signal.h )
364 if ( test -n "`egrep 'typedef volatile int sig_atomic_t' $file`"
365 ) > /dev/null 2>&1 ; then
366 fixlist="${fixlist}
367 aix_volatile"
368 if [ ! -r ${DESTDIR}/$file ]
369 then infile=$file
370 else infile=${DESTDIR}/$file ; fi
371
372 sed -e 's/typedef volatile int sig_atomic_t/typedef int sig_atomic_t/' \
373 < $infile > ${DESTDIR}/$file.
374
375 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
376 fi # end of selection 'if'
377 ;; # case end for file name test
378 esac
379
380
381 #
382 # Fix 3: Alpha_Getopt
383 #
384 case "$file" in ./stdio.h | \
385 ./stdlib.h )
386 if ( test -n "`egrep 'getopt\\(int, char \\*\\[' $file`"
387 ) > /dev/null 2>&1 ; then
388 fixlist="${fixlist}
389 alpha_getopt"
390 if [ ! -r ${DESTDIR}/$file ]
391 then infile=$file
392 else infile=${DESTDIR}/$file ; fi
393
394 sed -e 's/getopt(int, char \*\[\],[ ]*char \*)/getopt(int, char *const[], const char *)/' \
395 < $infile > ${DESTDIR}/$file.
396
397 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
398 fi # end of selection 'if'
399 ;; # case end for file name test
400 esac
401
402
403 #
404 # Fix 4: Alpha_Parens
405 #
406 case "$file" in ./sym.h )
407 if ( test -n "`egrep '#ifndef\\(__mips64\\)' $file`"
408 ) > /dev/null 2>&1 ; then
409 fixlist="${fixlist}
410 alpha_parens"
411 if [ ! -r ${DESTDIR}/$file ]
412 then infile=$file
413 else infile=${DESTDIR}/$file ; fi
414
415 sed -e 's/#ifndef(__mips64)/#ifndef __mips64/' \
416 < $infile > ${DESTDIR}/$file.
417
418 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
419 fi # end of selection 'if'
420 ;; # case end for file name test
421 esac
422
423
424 #
425 # Fix 5: Alpha_Sbrk
426 #
427 case "$file" in ./unistd.h )
428 if ( test -n "`egrep 'char[ ]*\\*[ ]*sbrk[ ]*\\(' $file`"
429 ) > /dev/null 2>&1 ; then
430 fixlist="${fixlist}
431 alpha_sbrk"
432 if [ ! -r ${DESTDIR}/$file ]
433 then infile=$file
434 else infile=${DESTDIR}/$file ; fi
435
436 sed -e 's/char\([ ]*\*[ ]*sbrk[ ]*(\)/void\1/' \
437 < $infile > ${DESTDIR}/$file.
438
439 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
440 fi # end of selection 'if'
441 ;; # case end for file name test
442 esac
443
444
445 #
446 # Fix 6: Arm_Norcroft_Hint
447 #
448 case "$file" in ./X11/Intrinsic.h )
449 fixlist="${fixlist}
450 arm_norcroft_hint"
451 if [ ! -r ${DESTDIR}/$file ]
452 then infile=$file
453 else infile=${DESTDIR}/$file ; fi
454
455 sed -e 's/___type p_type/p_type/' \
456 < $infile > ${DESTDIR}/$file.
457
458 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
459 ;; # case end for file name test
460 esac
461
462
463 #
464 # Fix 7: Arm_Wchar
465 #
466 case "$file" in ./stdlib.h )
467 if ( test -n "`egrep '#[ ]*define[ ]*__wchar_t' $file`"
468 ) > /dev/null 2>&1 ; then
469 fixlist="${fixlist}
470 arm_wchar"
471 if [ ! -r ${DESTDIR}/$file ]
472 then infile=$file
473 else infile=${DESTDIR}/$file ; fi
474
475 sed -e 's/\(#[ ]*ifndef[ ]*\)__wchar_t/\1_GCC_WCHAR_T/' \
476 -e 's/\(#[ ]*define[ ]*\)__wchar_t/\1_GCC_WCHAR_T/' \
477 < $infile > ${DESTDIR}/$file.
478
479 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
480 fi # end of selection 'if'
481 ;; # case end for file name test
482 esac
483
484
485 #
486 # Fix 8: Aux_Asm
487 #
488 case "$file" in ./sys/param.h )
489 if ( test -n "`egrep '#ifndef NOINLINE' $file`"
490 ) > /dev/null 2>&1 ; then
491 fixlist="${fixlist}
492 aux_asm"
493 if [ ! -r ${DESTDIR}/$file ]
494 then infile=$file
495 else infile=${DESTDIR}/$file ; fi
496
497 sed -e 's|#ifndef NOINLINE|#if !defined(NOINLINE) \&\& !defined(__GNUC__)|' \
498 < $infile > ${DESTDIR}/$file.
499
500 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
501 fi # end of selection 'if'
502 ;; # case end for file name test
503 esac
504
505
506 #
507 # Fix 9: Avoid_Bool
508 #
509 case "$file" in ./curses.h | \
510 ./term.h | \
511 ./tinfo.h )
512 fixlist="${fixlist}
513 avoid_bool"
514 if [ ! -r ${DESTDIR}/$file ]
515 then infile=$file
516 else infile=${DESTDIR}/$file ; fi
517
518 sed -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/i\
519#ifndef __cplusplus
520' \
521 -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/a\
522#endif
523' \
524 -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/i\
525#ifndef __cplusplus
526' \
527 -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/a\
528#endif
529' \
530 < $infile > ${DESTDIR}/$file.
531
532 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
533 ;; # case end for file name test
534 esac
535
536
537 #
538 # Fix 10: Bad_Malloc_Decl
539 #
540 case "$file" in ./rpc/types.h )
541 if ( test -z "`egrep '\"C\"' $file`"
542 ) > /dev/null 2>&1 ; then
543 fixlist="${fixlist}
544 bad_malloc_decl"
545 if [ ! -r ${DESTDIR}/$file ]
546 then infile=$file
547 else infile=${DESTDIR}/$file ; fi
548
549 sed -e '1i\
550#ifdef __cplusplus\
551extern "C" {\
552#endif\
553
554' \
555 -e '$a\
556#ifdef __cplusplus\
557}\
558#endif
559' \
560 < $infile > ${DESTDIR}/$file.
561
562 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
563 fi # end of selection 'if'
564 ;; # case end for file name test
565 esac
566
567
568 #
569 # Fix 11: Bad_Struct_Term
570 #
571 case "$file" in ./curses.h )
572 if ( test -n "`egrep '^[ ]*typedef[ ]+struct[ ]+term[ ]*;' $file`"
573 ) > /dev/null 2>&1 ; then
574 fixlist="${fixlist}
575 bad_struct_term"
576 if [ ! -r ${DESTDIR}/$file ]
577 then infile=$file
578 else infile=${DESTDIR}/$file ; fi
579
580 sed -e 's/^[ ]*typedef[ ][ ]*\(struct[ ][ ]*term[ ]*;[ ]*\)$/\1/' \
581 < $infile > ${DESTDIR}/$file.
582
583 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
584 fi # end of selection 'if'
585 ;; # case end for file name test
586 esac
587
588
589 #
590 # Fix 12: Badquote
591 #
592 case "$file" in ./sundev/vuid_event.h )
593 fixlist="${fixlist}
594 badquote"
595 if [ ! -r ${DESTDIR}/$file ]
596 then infile=$file
597 else infile=${DESTDIR}/$file ; fi
598
599 sed -e 's/doesn'\''t/does not/' \
600 < $infile > ${DESTDIR}/$file.
601
602 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
603 ;; # case end for file name test
604 esac
605
606
607 #
608 # Fix 13: Bad_Lval
609 #
610 case "$file" in ./libgen.h | \
611 ./dirent.h | \
612 ./ftw.h | \
613 ./grp.h | \
614 ./ndbm.h | \
615 ./pthread.h | \
616 ./pwd.h | \
617 ./signal.h | \
618 ./standards.h | \
619 ./stdlib.h | \
620 ./string.h | \
621 ./stropts.h | \
622 ./time.h | \
623 ./unistd.h )
624 if ( test -n "`egrep '^[ ]*#[ ]*pragma[ ]extern_prefix' $file`"
625 ) > /dev/null 2>&1 ; then
626 fixlist="${fixlist}
627 bad_lval"
628 if [ ! -r ${DESTDIR}/$file ]
629 then infile=$file
630 else infile=${DESTDIR}/$file ; fi
631
632 sed -e 's/^[ ]*#[ ]*define[ ]*\([^(]*\)\(([^)]*)\)[ ]*\(_.\)\1\2[ ]*$/#define \1 \3\1/' \
633 < $infile > ${DESTDIR}/$file.
634
635 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
636 fi # end of selection 'if'
637 ;; # case end for file name test
638 esac
639
640
641 #
642 # Fix 14: Broken_Assert_Stdio
643 #
644 case "$file" in ./assert.h )
645 if ( test -n "`egrep 'stderr' $file`" -a \
646 -z "`egrep 'include.*stdio.h' $file`"
647 ) > /dev/null 2>&1 ; then
648 fixlist="${fixlist}
649 broken_assert_stdio"
650 if [ ! -r ${DESTDIR}/$file ]
651 then infile=$file
652 else infile=${DESTDIR}/$file ; fi
653
654 sed -e '1i\
655#include <stdio.h>
656' \
657 < $infile > ${DESTDIR}/$file.
658
659 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
660 fi # end of selection 'if'
661 ;; # case end for file name test
662 esac
663
664
665 #
666 # Fix 15: Broken_Assert_Stdlib
667 #
668 case "$file" in ./assert.h )
669 if ( test -n "`egrep 'exit *\\(|abort *\\(' $file`" -a \
670 -z "`egrep 'include.*stdlib.h' $file`"
671 ) > /dev/null 2>&1 ; then
672 fixlist="${fixlist}
673 broken_assert_stdlib"
674 if [ ! -r ${DESTDIR}/$file ]
675 then infile=$file
676 else infile=${DESTDIR}/$file ; fi
677
678 sed -e '1i\
679#ifdef __cplusplus\
680#include <stdlib.h>\
681#endif
682' \
683 < $infile > ${DESTDIR}/$file.
684
685 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
686 fi # end of selection 'if'
687 ;; # case end for file name test
688 esac
689
690
691 #
692 # Fix 16: Bsd43_Io_Macros
693 #
694 if ( test -n "`egrep 'BSD43__IO' $file`"
695 ) > /dev/null 2>&1 ; then
696 fixlist="${fixlist}
697 bsd43_io_macros"
698 if [ ! -r ${DESTDIR}/$file ]
699 then infile=$file
700 else infile=${DESTDIR}/$file ; fi
701
702 sed -e '/[ ]BSD43__IO[A-Z]*[ ]*(/s/(\(.\),/('\''\1'\'',/' \
703 -e '/#[ ]*define[ ]*[ ]BSD43__IO/s/'\''\([cgx]\)'\''/\1/g' \
704 < $infile > ${DESTDIR}/$file.
705
706 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
707 fi # end of selection 'if'
708
709
710 #
711 # Fix 17: No_Double_Slash
712 #
713 if ( test -n "`egrep '//[^*]' $file`" -a \
714 '(' -z "`echo ${file}|egrep '++$|\.hh$|\.H$'`" ')'
715 ) > /dev/null 2>&1 ; then
716 fixlist="${fixlist}
717 no_double_slash"
718 if [ ! -r ${DESTDIR}/$file ]
719 then infile=$file
720 else infile=${DESTDIR}/$file ; fi
721
722 sed -e '/\/\/[^*]/s|//.*$||g' \
723 < $infile > ${DESTDIR}/$file.
724
725 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
726 fi # end of selection 'if'
727
728
729 #
730 # Fix 18: Irix_Bogus_Cxx_Cmnt
731 #
732 case "$file" in ./elf_abi.h | \
733 ./elf.h )
734 fixlist="${fixlist}
735 irix_bogus_cxx_cmnt"
736 if [ ! -r ${DESTDIR}/$file ]
737 then infile=$file
738 else infile=${DESTDIR}/$file ; fi
739
740 sed -e 's@"/\*"\*/@"//"@' \
741 < $infile > ${DESTDIR}/$file.
742
743 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
744 ;; # case end for file name test
745 esac
746
747
748 #
749 # Fix 19: Ecd_Cursor
750 #
751 case "$file" in ./sunwindow/win_lock.h | \
752 ./sunwindow/win_cursor.h )
753 fixlist="${fixlist}
754 ecd_cursor"
755 if [ ! -r ${DESTDIR}/$file ]
756 then infile=$file
757 else infile=${DESTDIR}/$file ; fi
758
759 sed -e 's/ecd.cursor/ecd_cursor/' \
760 < $infile > ${DESTDIR}/$file.
761
762 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
763 ;; # case end for file name test
764 esac
765
766
767 #
768 # Fix 20: Else_Label
769 #
770 if ( test -n "`egrep '^[ ]*#[ ]*else[ ]+[!-.0-~]' $file`"
771 ) > /dev/null 2>&1 ; then
772 fixlist="${fixlist}
773 else_label"
774 if [ ! -r ${DESTDIR}/$file ]
775 then infile=$file
776 else infile=${DESTDIR}/$file ; fi
777
778 sed -e ':loop
779/\\$/N
780s/\\$/\\+++fixinc_eol+++/
781/\\$/b loop
782s/\\+++fixinc_eol+++/\\/g
783s%^\([ ]*#[ ]*else\)[ ]*/[^*].*%\1%
784s%^\([ ]*#[ ]*else\)[ ]*[^/ ].*%\1%' \
785 < $infile > ${DESTDIR}/$file.
786
787 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
788 fi # end of selection 'if'
789
790
791 #
792 # Fix 21: Endif_Label
793 #
794 if ( test -n "`egrep '^[ ]*#[ ]*endif[ ]+[!-.0-z{|}~]' $file`"
795 ) > /dev/null 2>&1 ; then
796 fixlist="${fixlist}
797 endif_label"
798 if [ ! -r ${DESTDIR}/$file ]
799 then infile=$file
800 else infile=${DESTDIR}/$file ; fi
801
802 sed -e ':loop
803/\\$/N
804s/\\$/\\+++fixinc_eol+++/
805/\\$/b loop
806s/\\+++fixinc_eol+++/\\/g
807s%^\([ ]*#[ ]*endif\)[ ]*/[^*].*%\1%
808s%^\([ ]*#[ ]*endif\)[ ]*\*[^/].*%\1%
809s%^\([ ]*#[ ]*endif\)[ ]*[^/* ].*%\1%' \
810 < $infile > ${DESTDIR}/$file.
811
812 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
813 fi # end of selection 'if'
814
815
816 #
817 # Fix 22: Hp_Inline
818 #
819 case "$file" in ./sys/spinlock.h )
820 if ( test -n "`egrep 'include.*\"\\.\\./machine/' $file`"
821 ) > /dev/null 2>&1 ; then
822 fixlist="${fixlist}
823 hp_inline"
824 if [ ! -r ${DESTDIR}/$file ]
825 then infile=$file
826 else infile=${DESTDIR}/$file ; fi
827
828 sed -e 's,"../machine/inline.h",<machine/inline.h>,' \
829 -e 's,"../machine/psl.h",<machine/psl.h>,' \
830 < $infile > ${DESTDIR}/$file.
831
832 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
833 fi # end of selection 'if'
834 ;; # case end for file name test
835 esac
836
837
838 #
839 # Fix 23: Hp_Sysfile
840 #
841 case "$file" in ./sys/file.h )
842 if ( test -n "`egrep 'HPUX_SOURCE' $file`"
843 ) > /dev/null 2>&1 ; then
844 fixlist="${fixlist}
845 hp_sysfile"
846 if [ ! -r ${DESTDIR}/$file ]
847 then infile=$file
848 else infile=${DESTDIR}/$file ; fi
849
850 sed -e 's/(\.\.\.)/(struct file * ...)/' \
851 < $infile > ${DESTDIR}/$file.
852
853 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
854 fi # end of selection 'if'
855 ;; # case end for file name test
856 esac
857
858
859 #
860 # Fix 24: Hpux_Cxx_Unready
861 #
862 case "$file" in ./sys/mman.h )
863 if ( test -z "`egrep '\"C\"|__BEGIN_DECLS' $file`"
864 ) > /dev/null 2>&1 ; then
865 fixlist="${fixlist}
866 hpux_cxx_unready"
867 if [ ! -r ${DESTDIR}/$file ]
868 then infile=$file
869 else infile=${DESTDIR}/$file ; fi
870
871 sed -e '1i\
872#ifdef __cplusplus\
873extern "C" {\
874#endif\
875
876' \
877 -e '$a\
878#ifdef __cplusplus\
879}\
880#endif
881' \
882 < $infile > ${DESTDIR}/$file.
883
884 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
885 fi # end of selection 'if'
886 ;; # case end for file name test
887 esac
888
889
890 #
891 # Fix 25: Hpux_Maxint
892 #
893 case "$file" in ./sys/param.h )
894 fixlist="${fixlist}
895 hpux_maxint"
896 if [ ! -r ${DESTDIR}/$file ]
897 then infile=$file
898 else infile=${DESTDIR}/$file ; fi
899
900 sed -e '/^#[ ]*define[ ]*MAXINT[ ]/i\
901#ifndef MAXINT
902' \
903 -e '/^#[ ]*define[ ]*MAXINT[ ]/a\
904#endif
905' \
906 < $infile > ${DESTDIR}/$file.
907
908 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
909 ;; # case end for file name test
910 esac
911
912
913 #
914 # Fix 26: Hpux_Systime
915 #
916 case "$file" in ./sys/time.h )
917 if ( test -n "`egrep '^extern struct sigevent;' $file`"
918 ) > /dev/null 2>&1 ; then
919 fixlist="${fixlist}
920 hpux_systime"
921 if [ ! -r ${DESTDIR}/$file ]
922 then infile=$file
923 else infile=${DESTDIR}/$file ; fi
924
925 sed -e 's/^extern struct sigevent;/struct sigevent;/' \
926 < $infile > ${DESTDIR}/$file.
927
928 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
929 fi # end of selection 'if'
930 ;; # case end for file name test
931 esac
932
933
934 #
935 # Fix 27: Interactv_Add1
936 #
937 case "$file" in ./stdio.h | \
938 ./math.h | \
939 ./ctype.h | \
940 ./sys/limits.h | \
941 ./sys/fcntl.h | \
942 ./sys/dirent.h )
943 if ( test '(' -d /etc/conf/kconfig.d ')' -a \
944 '(' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`" ')'
945 ) > /dev/null 2>&1 ; then
946 fixlist="${fixlist}
947 interactv_add1"
948 if [ ! -r ${DESTDIR}/$file ]
949 then infile=$file
950 else infile=${DESTDIR}/$file ; fi
951
952 sed -e 's/!defined(__STDC__) && !defined(_POSIX_SOURCE)/!defined(_POSIX_SOURCE)/' \
953 < $infile > ${DESTDIR}/$file.
954
955 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
956 fi # end of selection 'if'
957 ;; # case end for file name test
958 esac
959
960
961 #
962 # Fix 28: Interactv_Add2
963 #
964 case "$file" in ./math.h )
965 if ( test '(' -d /etc/conf/kconfig.d ')' -a \
966 '(' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`" ')'
967 ) > /dev/null 2>&1 ; then
968 fixlist="${fixlist}
969 interactv_add2"
970 if [ ! -r ${DESTDIR}/$file ]
971 then infile=$file
972 else infile=${DESTDIR}/$file ; fi
973
974 sed -e 's/fmod(double)/fmod(double, double)/' \
975 < $infile > ${DESTDIR}/$file.
976
977 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
978 fi # end of selection 'if'
979 ;; # case end for file name test
980 esac
981
982
983 #
984 # Fix 29: Interactv_Add3
985 #
986 case "$file" in ./sys/limits.h )
987 if ( test '(' -d /etc/conf/kconfig.d ')' -a \
988 '(' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`" ')'
989 ) > /dev/null 2>&1 ; then
990 fixlist="${fixlist}
991 interactv_add3"
992 if [ ! -r ${DESTDIR}/$file ]
993 then infile=$file
994 else infile=${DESTDIR}/$file ; fi
995
996 sed -e '/CHILD_MAX/s,/\* Max, Max,' \
997 -e '/OPEN_MAX/s,/\* Max, Max,' \
998 < $infile > ${DESTDIR}/$file.
999
1000 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1001 fi # end of selection 'if'
1002 ;; # case end for file name test
1003 esac
1004
1005
1006 #
1007 # Fix 30: Io_Def_Quotes
1008 #
1009 if ( test -n "`egrep '[ ]_IO[A-Z]*[ ]*\\([A-Za-z]' $file`"
1010 ) > /dev/null 2>&1 ; then
1011 fixlist="${fixlist}
1012 io_def_quotes"
1013 if [ ! -r ${DESTDIR}/$file ]
1014 then infile=$file
1015 else infile=${DESTDIR}/$file ; fi
1016
1017 sed -e 's/\([ ]_IO[A-Z]*[ ]*(\)\([A-Za-z]\),/\1'\''\2'\'',/' \
1018 -e '/#[ ]*define[ ]*[ ]_IO/s/'\''\([cgxtf]\)'\''/\1/g' \
1019 -e '/#[ ]*define[ ]*[ ]DESIOC/s/'\''\([cdgx]\)'\''/\1/g' \
1020 < $infile > ${DESTDIR}/$file.
1021
1022 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1023 fi # end of selection 'if'
1024
1025
1026 #
1027 # Fix 31: Ioctl_Fix_Ctrl
1028 #
1029 if ( test -n "`egrep 'CTRL[ ]' $file`"
1030 ) > /dev/null 2>&1 ; then
1031 fixlist="${fixlist}
1032 ioctl_fix_ctrl"
1033 if [ ! -r ${DESTDIR}/$file ]
1034 then infile=$file
1035 else infile=${DESTDIR}/$file ; fi
1036
1037 sed -e '/[^A-Z0-9_]CTRL[ ]*(/s/\([^'\'']\))/'\''\1'\'')/' \
1038 -e '/[^A-Z0-9]_CTRL[ ]*(/s/\([^'\'']\))/'\''\1'\'')/' \
1039 -e '/#[ ]*define[ ]*[ ]CTRL/s/'\''\([cgx]\)'\''/\1/g' \
1040 -e '/#[ ]*define[ ]*[ ]_CTRL/s/'\''\([cgx]\)'\''/\1/g' \
1041 -e '/#[ ]*define[ ]*[ ]BSD43_CTRL/s/'\''\([cgx]\)'\''/\1/g' \
1042 < $infile > ${DESTDIR}/$file.
1043
1044 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1045 fi # end of selection 'if'
1046
1047
1048 #
1049 # Fix 32: Ip_Missing_Semi
1050 #
1051 case "$file" in ./netinet/ip.h )
1052 fixlist="${fixlist}
1053 ip_missing_semi"
1054 if [ ! -r ${DESTDIR}/$file ]
1055 then infile=$file
1056 else infile=${DESTDIR}/$file ; fi
1057
1058 sed -e '/^struct/,/^};/s/}$/};/' \
1059 < $infile > ${DESTDIR}/$file.
1060
1061 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1062 ;; # case end for file name test
1063 esac
1064
1065
1066 #
1067 # Fix 33: Irix_Multiline_Cmnt
1068 #
1069 case "$file" in ./sys/types.h )
1070 fixlist="${fixlist}
1071 irix_multiline_cmnt"
1072 if [ ! -r ${DESTDIR}/$file ]
1073 then infile=$file
1074 else infile=${DESTDIR}/$file ; fi
1075
1076 sed -e 's@type of the result@type of the result */@' \
1077 -e 's@of the sizeof@/* of the sizeof@' \
1078 < $infile > ${DESTDIR}/$file.
1079
1080 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1081 ;; # case end for file name test
1082 esac
1083
1084
1085 #
1086 # Fix 34: Irix_Sockaddr
1087 #
1088 case "$file" in ./rpc/auth.h )
1089 if ( test -n "`egrep 'authdes_create.*struct sockaddr' $file`"
1090 ) > /dev/null 2>&1 ; then
1091 fixlist="${fixlist}
1092 irix_sockaddr"
1093 if [ ! -r ${DESTDIR}/$file ]
1094 then infile=$file
1095 else infile=${DESTDIR}/$file ; fi
1096
1097 sed -e '/authdes_create.*struct sockaddr/i\
1098struct sockaddr;
1099' \
1100 < $infile > ${DESTDIR}/$file.
1101
1102 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1103 fi # end of selection 'if'
1104 ;; # case end for file name test
1105 esac
1106
1107
1108 #
1109 # Fix 35: Irix_Struct__File
1110 #
1111 case "$file" in ./rpc/xdr.h )
1112 fixlist="${fixlist}
1113 irix_struct__file"
1114 if [ ! -r ${DESTDIR}/$file ]
1115 then infile=$file
1116 else infile=${DESTDIR}/$file ; fi
1117
1118 sed -e '/xdrstdio_create.*struct __file_s/i\
1119struct __file_s;
1120' \
1121 < $infile > ${DESTDIR}/$file.
1122
1123 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1124 ;; # case end for file name test
1125 esac
1126
1127
1128 #
1129 # Fix 36: Isc_Fmod
1130 #
1131 case "$file" in ./math.h )
1132 if ( test -n "`egrep 'fmod\\(double\\)' $file`"
1133 ) > /dev/null 2>&1 ; then
1134 fixlist="${fixlist}
1135 isc_fmod"
1136 if [ ! -r ${DESTDIR}/$file ]
1137 then infile=$file
1138 else infile=${DESTDIR}/$file ; fi
1139
1140 sed -e 's/fmod(double)/fmod(double, double)/' \
1141 < $infile > ${DESTDIR}/$file.
1142
1143 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1144 fi # end of selection 'if'
1145 ;; # case end for file name test
1146 esac
1147
1148
1149 #
1150 # Fix 37: Motorola_Nested
1151 #
1152 case "$file" in ./limits.h | \
1153 ./sys/limits.h )
1154 fixlist="${fixlist}
1155 motorola_nested"
1156 if [ ! -r ${DESTDIR}/$file ]
1157 then infile=$file
1158 else infile=${DESTDIR}/$file ; fi
1159
1160 sed -e 's@^\(#undef[ ][ ]*PIPE_BUF[ ]*/\* max # bytes atomic in write to a\)$@\1 */@' \
1161 -e 's@\(/\*#define HUGE_VAL 3.40282346638528860e+38 \)\(/\*error value returned by Math lib\*/\)$@\1*/ \2@' \
1162 < $infile > ${DESTDIR}/$file.
1163
1164 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1165 ;; # case end for file name test
1166 esac
1167
1168
1169 #
1170 # Fix 38: Isc_Sys_Limits
1171 #
1172 case "$file" in ./sys/limits.h )
1173 if ( test -n "`egrep 'CHILD_MAX' $file`"
1174 ) > /dev/null 2>&1 ; then
1175 fixlist="${fixlist}
1176 isc_sys_limits"
1177 if [ ! -r ${DESTDIR}/$file ]
1178 then infile=$file
1179 else infile=${DESTDIR}/$file ; fi
1180
1181 sed -e '/CHILD_MAX/s,/\* Max, Max,' \
1182 -e '/OPEN_MAX/s,/\* Max, Max,' \
1183 < $infile > ${DESTDIR}/$file.
1184
1185 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1186 fi # end of selection 'if'
1187 ;; # case end for file name test
1188 esac
1189
1190
1191 #
1192 # Fix 39: Kandr_Concat
1193 #
1194 case "$file" in ./sparc/asm_linkage.h | \
1195 ./sun3/asm_linkage.h | \
1196 ./sun3x/asm_linkage.h | \
1197 ./sun4/asm_linkage.h | \
1198 ./sun4c/asm_linkage.h | \
1199 ./sun4m/asm_linkage.h | \
1200 ./sun4c/debug/asm_linkage.h | \
1201 ./sun4m/debug/asm_linkage.h | \
1202 ./arm/as_support.h | \
1203 ./arm/mc_type.h | \
1204 ./arm/xcb.h | \
1205 ./dev/chardefmac.h | \
1206 ./dev/ps_irq.h | \
1207 ./dev/screen.h | \
1208 ./dev/scsi.h | \
1209 ./sys/tty.h | \
1210 ./Xm.acorn/XmP.h | \
1211 ./bsd43/bsd43_.h )
1212 if ( test -n "`egrep '/\\*\\*/' $file`"
1213 ) > /dev/null 2>&1 ; then
1214 fixlist="${fixlist}
1215 kandr_concat"
1216 if [ ! -r ${DESTDIR}/$file ]
1217 then infile=$file
1218 else infile=${DESTDIR}/$file ; fi
1219
1220 sed -e 's|/\*\*/| ## |g' \
1221 < $infile > ${DESTDIR}/$file.
1222
1223 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1224 fi # end of selection 'if'
1225 ;; # case end for file name test
1226 esac
1227
1228
1229 #
1230 # Fix 40: Limits_Ifndefs
1231 #
1232 case "$file" in ./limits.h )
1233 if ( test -z "`egrep 'ifndef[ ]+FLT_MIN' $file`"
1234 ) > /dev/null 2>&1 ; then
1235 fixlist="${fixlist}
1236 limits_ifndefs"
1237 if [ ! -r ${DESTDIR}/$file ]
1238 then infile=$file
1239 else infile=${DESTDIR}/$file ; fi
1240
1241 sed -e '/[ ]FLT_MIN[ ]/i\
1242#ifndef FLT_MIN
1243' \
1244 -e '/[ ]FLT_MIN[ ]/a\
1245#endif
1246' \
1247 -e '/[ ]FLT_MAX[ ]/i\
1248#ifndef FLT_MAX
1249' \
1250 -e '/[ ]FLT_MAX[ ]/a\
1251#endif
1252' \
1253 -e '/[ ]FLT_DIG[ ]/i\
1254#ifndef FLT_DIG
1255' \
1256 -e '/[ ]FLT_DIG[ ]/a\
1257#endif
1258' \
1259 -e '/[ ]DBL_MIN[ ]/i\
1260#ifndef DBL_MIN
1261' \
1262 -e '/[ ]DBL_MIN[ ]/a\
1263#endif
1264' \
1265 -e '/[ ]DBL_MAX[ ]/i\
1266#ifndef DBL_MAX
1267' \
1268 -e '/[ ]DBL_MAX[ ]/a\
1269#endif
1270' \
1271 -e '/[ ]DBL_DIG[ ]/i\
1272#ifndef DBL_DIG
1273' \
1274 -e '/[ ]DBL_DIG[ ]/a\
1275#endif
1276' \
1277 -e '/^\(\/\*#define HUGE_VAL 3\.[0-9e+]* *\)\/\*/s//\1/' \
1278 < $infile > ${DESTDIR}/$file.
1279
1280 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1281 fi # end of selection 'if'
1282 ;; # case end for file name test
1283 esac
1284
1285
1286 #
1287 # Fix 41: Lynx_Void_Int
1288 #
1289 case "$file" in ./curses.h )
1290 if ( test -n "`egrep '#[ ]*define[ ]+void[ ]+int' $file`"
1291 ) > /dev/null 2>&1 ; then
1292 fixlist="${fixlist}
1293 lynx_void_int"
1294 if [ ! -r ${DESTDIR}/$file ]
1295 then infile=$file
1296 else infile=${DESTDIR}/$file ; fi
1297
1298 sed -e '/#[ ]*define[ ][ ]*void[ ]int/d' \
1299 < $infile > ${DESTDIR}/$file.
1300
1301 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1302 fi # end of selection 'if'
1303 ;; # case end for file name test
1304 esac
1305
1306
1307 #
1308 # Fix 42: Lynxos_Fcntl_Proto
1309 #
1310 case "$file" in ./fcntl.h )
1311 fixlist="${fixlist}
1312 lynxos_fcntl_proto"
1313 if [ ! -r ${DESTDIR}/$file ]
1314 then infile=$file
1315 else infile=${DESTDIR}/$file ; fi
1316
1317 sed -e 's/\(fcntl.*(int, int, \)int)/\1...)/' \
1318 < $infile > ${DESTDIR}/$file.
1319
1320 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1321 ;; # case end for file name test
1322 esac
1323
1324
1325 #
1326 # Fix 43: M88k_Bad_Hypot_Opt
1327 #
1328 case "$file" in ./math.h )
1329 case "$target_canonical" in m88k-motorola-sysv3* )
1330 fixlist="${fixlist}
1331 m88k_bad_hypot_opt"
1332 if [ ! -r ${DESTDIR}/$file ]
1333 then infile=$file
1334 else infile=${DESTDIR}/$file ; fi
1335
1336 sed -e 's/extern double floor(), ceil(), fmod(), fabs();/extern double floor(), ceil(), fmod(), fabs _PARAMS((double));/' \
1337 -e '/^extern double hypot();$/a\
1338\/* Workaround a stupid Motorola optimization if one\
1339 of x or y is 0.0 and the other is negative! *\/\
1340#ifdef __STDC__\
1341static __inline__ double fake_hypot (double x, double y)\
1342#else\
1343static __inline__ double fake_hypot (x, y)\
1344 double x, y;\
1345#endif\
1346{\
1347 return fabs (hypot (x, y));\
1348}\
1349#define hypot fake_hypot
1350' \
1351 < $infile > ${DESTDIR}/$file.
1352
1353 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1354 ;; # case end for machine type test
1355 esac
1356 ;; # case end for file name test
1357 esac
1358
1359
1360 #
1361 # Fix 44: M88k_Bad_S_If
1362 #
1363 case "$file" in ./sys/stat.h )
1364 case "$target_canonical" in m88k-*-sysv3* )
1365 if ( test -n "`egrep '#define[ ]+S_IS[A-Z]*(m)[ ]' $file`"
1366 ) > /dev/null 2>&1 ; then
1367 fixlist="${fixlist}
1368 m88k_bad_s_if"
1369 if [ ! -r ${DESTDIR}/$file ]
1370 then infile=$file
1371 else infile=${DESTDIR}/$file ; fi
1372
1373 sed -e 's/^\(#define[ ]*S_IS[A-Z]*(m)\)[ ]*(m[ ]*&[ ]*\(S_IF[A-Z][A-Z][A-Z][A-Z]*\)[ ]*)/\1 (((m)\&S_IFMT)==\2)/' \
1374 -e 's/^\(#define[ ]*S_IS[A-Z]*(m)\)[ ]*(m[ ]*&[ ]*\(0[0-9]*\)[ ]*)/\1 (((m)\&S_IFMT)==\2)/' \
1375 < $infile > ${DESTDIR}/$file.
1376
1377 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1378 fi # end of selection 'if'
1379 ;; # case end for machine type test
1380 esac
1381 ;; # case end for file name test
1382 esac
1383
1384
1385 #
1386 # Fix 45: M88k_Multi_Incl
1387 #
1388 case "$file" in ./time.h )
1389 case "$target_canonical" in m88k-tektronix-sysv3* )
1390 if ( test -z "`egrep '#ifndef' $file`"
1391 ) > /dev/null 2>&1 ; then
1392 fixlist="${fixlist}
1393 m88k_multi_incl"
1394 if [ ! -r ${DESTDIR}/$file ]
1395 then infile=$file
1396 else infile=${DESTDIR}/$file ; fi
1397 ( echo Fixing $file, to protect against multiple inclusion. >&2
1398 cpp_wrapper=`echo $file | sed -e 's,\.,_,g' -e 's,/,_,g'`
1399 sed -e "1i\
1400#ifndef __GCC_GOT_${cpp_wrapper}_\
1401#define __GCC_GOT_${cpp_wrapper}_\
1402" \
1403 -e "$a\
1404#endif /* ! __GCC_GOT_${cpp_wrapper}_ */
1405" ) < $infile > ${DESTDIR}/$file.
1406
1407 # Shell scripts have the potential of removing the output
1408 # We interpret that to mean the file is not to be altered
1409 #
1410 if test ! -f ${DESTDIR}/$file.
1411 then continue ; fi
1412
1413 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1414 fi # end of selection 'if'
1415 ;; # case end for machine type test
1416 esac
1417 ;; # case end for file name test
1418 esac
1419
1420
1421 #
1422 # Fix 46: Machine_Name
1423 #
1424 if ( test -n "`egrep '^#[ ]*(if|elif).*[^a-zA-Z0-9_](_*[MSRrhim]|[Mbimnpstuv])[a-zA-Z0-9_]' $file`"
1425 ) > /dev/null 2>&1 ; then
1426 fixlist="${fixlist}
1427 machine_name"
1428 if [ ! -r ${DESTDIR}/$file ]
1429 then infile=$file
1430 else infile=${DESTDIR}/$file ; fi
1431
1432 sed -e ':loop
1433/\\$/N
1434s/\\$/\\+++fixinc_eol+++/
1435/\\$/b loop
1436s/\\+++fixinc_eol+++/\\/g
1437/#[ ]*[el]*if/ {
1438 s/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g
1439 s/ M32 / __M32__ /g
1440 s/ _*MIPSE\([LB]\) / __MIPSE\1__ /g
1441 s/ _*SYSTYPE_\([A-Z0-9]*\) / __SYSTYPE_\1__ /g
1442 s/ _*\([Rr][34]\)000 / __\1000__ /g
1443 s/ _*host_mips / __host_mips__ /g
1444 s/ _*i386 / __i386__ /g
1445 s/ _*mips / __mips__ /g
1446 s/ bsd4\([0-9]\) / __bsd4\1__ /g
1447 s/ is68k / __is68k__ /g
1448 s/ m68k / __m68k__ /g
1449 s/ m88k / __m88k__ /g
1450 s/ mc680\([0-9]\)0 / __mc680\10__ /g
1451 s/ news\([0-9]*\) / __news\1__ /g
1452 s/ ns32000 / __ns32000__ /g
1453 s/ pdp11 / __pdp11__ /g
1454 s/ pyr / __pyr__ /g
1455 s/ sel / __sel__ /g
1456 s/ sony_news / __sony_news__ /g
1457 s/ sparc / __sparc__ /g
1458 s/ sun\([a-z0-9]*\) / __sun\1__ /g
1459 s/ tahoe / __tahoe__ /g
1460 s/ tower\([_0-9]*\) / __tower\1__ /g
1461 s/ u370 / __u370__ /g
1462 s/ u3b\([0-9]*\) / __u3b\1__ /g
1463 s/ unix / __unix__ /g
1464 s/ vax / __vax__ /g
1465 s/ \([a-zA-Z0-9_][a-zA-Z0-9_]*\) /\1/g
1466 }' \
1467 < $infile > ${DESTDIR}/$file.
1468
1469 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1470 fi # end of selection 'if'
1471
1472
1473 #
1474 # Fix 47: Math_Exception
1475 #
1476 case "$file" in ./math.h )
1477 if ( test -n "`egrep 'struct exception' $file`"
1478 ) > /dev/null 2>&1 ; then
1479 fixlist="${fixlist}
1480 math_exception"
1481 if [ ! -r ${DESTDIR}/$file ]
1482 then infile=$file
1483 else infile=${DESTDIR}/$file ; fi
1484
1485 sed -e '/struct exception/i\
1486#ifdef __cplusplus\
1487#define exception __math_exception\
1488#endif
1489' \
1490 -e '/struct exception/a\
1491#ifdef __cplusplus\
1492#undef exception\
1493#endif
1494' \
1495 -e '/matherr/i\
1496#ifdef __cplusplus\
1497#define exception __math_exception\
1498#endif
1499' \
1500 -e '/matherr/a\
1501#ifdef __cplusplus\
1502#undef exception\
1503#endif
1504' \
1505 < $infile > ${DESTDIR}/$file.
1506
1507 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1508 fi # end of selection 'if'
1509 ;; # case end for file name test
1510 esac
1511
1512
1513 #
1514 # Fix 48: Math_Gcc_Ifndefs
1515 #
1516 case "$file" in ./math.h )
1517 fixlist="${fixlist}
1518 math_gcc_ifndefs"
1519 if [ ! -r ${DESTDIR}/$file ]
1520 then infile=$file
1521 else infile=${DESTDIR}/$file ; fi
1522 ( dbl_max_def="`egrep 'define[ ]+DBL_MAX[ ]+.*' ${SRCDIR}/float.h 2>/dev/null`"
1523
1524 if ( test -n "${dbl_max_def}" \
1525 -a -n "`egrep '#define[ ]*HUGE_VAL[ ]+DBL_MAX' $file`" \
1526 -a -z "`egrep '#define[ ]+DBL_MAX[ ]+' $file`"
1527 ) > /dev/null 2>&1
1528 then sed -e '/define[ ]HUGE_VAL[ ]/i\
1529#ifndef HUGE_VAL
1530' \
1531 -e '/define[ ]HUGE_VAL[ ]/a\
1532#endif
1533'\
1534 -e "/define[ ]HUGE_VAL[ ]DBL_MAX/s/DBL_MAX/$dbl_max_def/"
1535 else sed -e '/define[ ]HUGE_VAL[ ]/i\
1536#ifndef HUGE_VAL
1537' \
1538 -e '/define[ ]HUGE_VAL[ ]/a\
1539#endif
1540'
1541 fi ) < $infile > ${DESTDIR}/$file.
1542
1543 # Shell scripts have the potential of removing the output
1544 # We interpret that to mean the file is not to be altered
1545 #
1546 if test ! -f ${DESTDIR}/$file.
1547 then continue ; fi
1548
1549 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1550 ;; # case end for file name test
1551 esac
1552
1553
1554 #
1555 # Fix 49: Motorola_Stupid_Opt
1556 #
1557 case "$file" in ./math.h )
1558 case "$target_canonical" in m88k-motorola-sysv3* )
1559 if ( test -n "`egrep '^extern double hypot();$' $file`"
1560 ) > /dev/null 2>&1 ; then
1561 fixlist="${fixlist}
1562 motorola_stupid_opt"
1563 if [ ! -r ${DESTDIR}/$file ]
1564 then infile=$file
1565 else infile=${DESTDIR}/$file ; fi
1566
1567 sed -e '/^extern double hypot();$/a\
1568\/* Workaround a stupid Motorola optimization if one\
1569 of x or y is 0.0 and the other is negative! *\/\
1570#ifdef __STDC__\
1571static __inline__ double fake_hypot (double x, double y)\
1572#else\
1573static __inline__ double fake_hypot (x, y)\
1574 double x, y;\
1575#endif\
1576{\
1577 return fabs (hypot (x, y));\
1578}\
1579#define hypot fake_hypot
1580' \
1581 < $infile > ${DESTDIR}/$file.
1582
1583 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1584 fi # end of selection 'if'
1585 ;; # case end for machine type test
1586 esac
1587 ;; # case end for file name test
1588 esac
1589
1590
1591 #
1592 # Fix 50: Nested_Comment
1593 #
1594 case "$file" in ./rpc/rpc.h )
1595 fixlist="${fixlist}
1596 nested_comment"
1597 if [ ! -r ${DESTDIR}/$file ]
1598 then infile=$file
1599 else infile=${DESTDIR}/$file ; fi
1600
1601 sed -e 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@' \
1602 < $infile > ${DESTDIR}/$file.
1603
1604 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1605 ;; # case end for file name test
1606 esac
1607
1608
1609 #
1610 # Fix 51: News_Os_Recursion
1611 #
1612 case "$file" in ./stdlib.h )
1613 if ( test -n "`egrep '#include <stdlib.h>' $file`"
1614 ) > /dev/null 2>&1 ; then
1615 fixlist="${fixlist}
1616 news_os_recursion"
1617 if [ ! -r ${DESTDIR}/$file ]
1618 then infile=$file
1619 else infile=${DESTDIR}/$file ; fi
1620
1621 sed -e '/^#include <stdlib.h>/i\
1622#ifdef BOGUS_RECURSION
1623' \
1624 -e '/^#include <stdlib.h>/a\
1625#endif
1626' \
1627 < $infile > ${DESTDIR}/$file.
1628
1629 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1630 fi # end of selection 'if'
1631 ;; # case end for file name test
1632 esac
1633
1634
1635 #
1636 # Fix 52: Next_Math_Prefix
1637 #
1638 case "$file" in ./ansi/math.h )
1639 if ( test -n "`egrep '^extern.*double.*__const__.*' $file`"
1640 ) > /dev/null 2>&1 ; then
1641 fixlist="${fixlist}
1642 next_math_prefix"
1643 if [ ! -r ${DESTDIR}/$file ]
1644 then infile=$file
1645 else infile=${DESTDIR}/$file ; fi
1646
1647 sed -e '/^extern.*double.*__const__.*sqrt(/s/__const__//' \
1648 -e '/^extern.*double.*__const__.*fabs(/s/__const__//' \
1649 -e '/^extern.*double.*__const__.*cos(/s/__const__//' \
1650 -e '/^extern.*double.*__const__.*hypot(/s/__const__//' \
1651 -e '/^extern.*double.*__const__.*sin(/s/__const__//' \
1652 < $infile > ${DESTDIR}/$file.
1653
1654 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1655 fi # end of selection 'if'
1656 ;; # case end for file name test
1657 esac
1658
1659
1660 #
1661 # Fix 53: Next_Template
1662 #
1663 case "$file" in ./bsd/libc.h )
1664 if ( test -n "`egrep 'template' $file`"
1665 ) > /dev/null 2>&1 ; then
1666 fixlist="${fixlist}
1667 next_template"
1668 if [ ! -r ${DESTDIR}/$file ]
1669 then infile=$file
1670 else infile=${DESTDIR}/$file ; fi
1671
1672 sed -e '/\(.*template\)/s/template//' \
1673 -e '/extern.*volatile.*void.*abort/s/volatile//' \
1674 < $infile > ${DESTDIR}/$file.
1675
1676 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1677 fi # end of selection 'if'
1678 ;; # case end for file name test
1679 esac
1680
1681
1682 #
1683 # Fix 54: Next_Volitile
1684 #
1685 case "$file" in ./ansi/stdlib.h )
1686 if ( test -n "`egrep 'volatile' $file`"
1687 ) > /dev/null 2>&1 ; then
1688 fixlist="${fixlist}
1689 next_volitile"
1690 if [ ! -r ${DESTDIR}/$file ]
1691 then infile=$file
1692 else infile=${DESTDIR}/$file ; fi
1693
1694 sed -e '/extern.*volatile.*void.*exit/s/volatile//' \
1695 -e '/extern.*volatile.*void.*abort/s/volatile//' \
1696 < $infile > ${DESTDIR}/$file.
1697
1698 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1699 fi # end of selection 'if'
1700 ;; # case end for file name test
1701 esac
1702
1703
1704 #
1705 # Fix 55: Next_Wait_Union
1706 #
1707 case "$file" in ./sys/wait.h )
1708 if ( test -n "`egrep 'wait\\(union wait' $file`"
1709 ) > /dev/null 2>&1 ; then
1710 fixlist="${fixlist}
1711 next_wait_union"
1712 if [ ! -r ${DESTDIR}/$file ]
1713 then infile=$file
1714 else infile=${DESTDIR}/$file ; fi
1715
1716 sed -e 's@wait(union wait@wait(void@' \
1717 < $infile > ${DESTDIR}/$file.
1718
1719 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1720 fi # end of selection 'if'
1721 ;; # case end for file name test
1722 esac
1723
1724
1725 #
1726 # Fix 56: Nodeent_Syntax
1727 #
1728 case "$file" in ./netdnet/dnetdb.h )
1729 fixlist="${fixlist}
1730 nodeent_syntax"
1731 if [ ! -r ${DESTDIR}/$file ]
1732 then infile=$file
1733 else infile=${DESTDIR}/$file ; fi
1734
1735 sed -e 's/char.*na_addr *$/char *na_addr;/' \
1736 < $infile > ${DESTDIR}/$file.
1737
1738 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1739 ;; # case end for file name test
1740 esac
1741
1742
1743 #
1744 # Fix 57: Osf_Namespace_A
1745 #
1746 case "$file" in ./reg_types.h | \
1747 ./sys/lc_core.h )
1748 if ( test '(' -r reg_types.h-a -r sys/lc_core.h-a -n "`grep '} regex_t;' reg_types.h`"-a -z "`grep __regex_t regex.h`" ')'
1749 ) > /dev/null 2>&1 ; then
1750 fixlist="${fixlist}
1751 osf_namespace_a"
1752 if [ ! -r ${DESTDIR}/$file ]
1753 then infile=$file
1754 else infile=${DESTDIR}/$file ; fi
1755
1756 sed -e 's/regex_t/__regex_t/g' \
1757 -e 's/regoff_t/__regoff_t/g' \
1758 -e 's/regmatch_t/__regmatch_t/g' \
1759 < $infile > ${DESTDIR}/$file.
1760
1761 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1762 fi # end of selection 'if'
1763 ;; # case end for file name test
1764 esac
1765
1766
1767 #
1768 # Fix 58: Osf_Namespace_B
1769 #
1770 case "$file" in ./regex.h )
1771 if ( test '(' -r reg_types.h-a -r sys/lc_core.h-a -n "`grep '} regex_t;' reg_types.h`"-a -z "`grep __regex_t regex.h`" ')'
1772 ) > /dev/null 2>&1 ; then
1773 fixlist="${fixlist}
1774 osf_namespace_b"
1775 if [ ! -r ${DESTDIR}/$file ]
1776 then infile=$file
1777 else infile=${DESTDIR}/$file ; fi
1778
1779 sed -e '/#include <reg_types.h>/a\
1780typedef __regex_t regex_t;\
1781typedef __regoff_t regoff_t;\
1782typedef __regmatch_t regmatch_t;
1783' \
1784 < $infile > ${DESTDIR}/$file.
1785
1786 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1787 fi # end of selection 'if'
1788 ;; # case end for file name test
1789 esac
1790
1791
1792 #
1793 # Fix 59: Pthread_Page_Size
1794 #
1795 case "$file" in ./pthread.h )
1796 if ( test -n "`egrep '^int __page_size' $file`"
1797 ) > /dev/null 2>&1 ; then
1798 fixlist="${fixlist}
1799 pthread_page_size"
1800 if [ ! -r ${DESTDIR}/$file ]
1801 then infile=$file
1802 else infile=${DESTDIR}/$file ; fi
1803
1804 sed -e 's/^int __page_size/extern int __page_size/' \
1805 < $infile > ${DESTDIR}/$file.
1806
1807 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1808 fi # end of selection 'if'
1809 ;; # case end for file name test
1810 esac
1811
1812
1813 #
1814 # Fix 60: Rs6000_Double
1815 #
1816 case "$file" in ./math.h )
1817 if ( test -n "`egrep '[^a-zA-Z_]class\\(' $file`"
1818 ) > /dev/null 2>&1 ; then
1819 fixlist="${fixlist}
1820 rs6000_double"
1821 if [ ! -r ${DESTDIR}/$file ]
1822 then infile=$file
1823 else infile=${DESTDIR}/$file ; fi
1824
1825 sed -e '/class[(]/i\
1826#ifndef __cplusplus
1827' \
1828 -e '/class[(]/a\
1829#endif
1830' \
1831 < $infile > ${DESTDIR}/$file.
1832
1833 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1834 fi # end of selection 'if'
1835 ;; # case end for file name test
1836 esac
1837
1838
1839 #
1840 # Fix 61: Rs6000_Fchmod
1841 #
1842 case "$file" in ./sys/stat.h )
1843 if ( test -n "`egrep 'fchmod\\(char' $file`"
1844 ) > /dev/null 2>&1 ; then
1845 fixlist="${fixlist}
1846 rs6000_fchmod"
1847 if [ ! -r ${DESTDIR}/$file ]
1848 then infile=$file
1849 else infile=${DESTDIR}/$file ; fi
1850
1851 sed -e 's/fchmod(char \*/fchmod(int/' \
1852 < $infile > ${DESTDIR}/$file.
1853
1854 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1855 fi # end of selection 'if'
1856 ;; # case end for file name test
1857 esac
1858
1859
1860 #
1861 # Fix 62: Rs6000_Param
1862 #
1863 case "$file" in ./stdio.h | \
1864 ./unistd.h )
1865 fixlist="${fixlist}
1866 rs6000_param"
1867 if [ ! -r ${DESTDIR}/$file ]
1868 then infile=$file
1869 else infile=${DESTDIR}/$file ; fi
1870
1871 sed -e 's@rename(const char \*old, const char \*new)@rename(const char *_old, const char *_new)@' \
1872 < $infile > ${DESTDIR}/$file.
1873
1874 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1875 ;; # case end for file name test
1876 esac
1877
1878
1879 #
1880 # Fix 63: Sony_Include
1881 #
1882 case "$file" in ./machine/machparam.h )
1883 if ( test -n "`egrep '\"\\.\\./machine/endian.h\"' $file`"
1884 ) > /dev/null 2>&1 ; then
1885 fixlist="${fixlist}
1886 sony_include"
1887 if [ ! -r ${DESTDIR}/$file ]
1888 then infile=$file
1889 else infile=${DESTDIR}/$file ; fi
1890
1891 sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \
1892 < $infile > ${DESTDIR}/$file.
1893
1894 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1895 fi # end of selection 'if'
1896 ;; # case end for file name test
1897 esac
1898
1899
1900 #
1901 # Fix 64: Statsswtch
1902 #
1903 case "$file" in ./rpcsvc/rstat.h )
1904 if ( test -n "`egrep 'boottime$' $file`"
1905 ) > /dev/null 2>&1 ; then
1906 fixlist="${fixlist}
1907 statsswtch"
1908 if [ ! -r ${DESTDIR}/$file ]
1909 then infile=$file
1910 else infile=${DESTDIR}/$file ; fi
1911
1912 sed -e 's/boottime$/boottime;/' \
1913 < $infile > ${DESTDIR}/$file.
1914
1915 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1916 fi # end of selection 'if'
1917 ;; # case end for file name test
1918 esac
1919
1920
1921 #
1922 # Fix 65: Stdio_Va_List
1923 #
1924 case "$file" in ./stdio.h )
1925 fixlist="${fixlist}
1926 stdio_va_list"
1927 if [ ! -r ${DESTDIR}/$file ]
1928 then infile=$file
1929 else infile=${DESTDIR}/$file ; fi
1930 ( if ( egrep "__need___va_list" $file ) > /dev/null 2>&1 ; then
1931 :
1932 else
1933 echo "#define __need___va_list"
1934 echo "#include <stdarg.h>"
1935 fi
1936
1937 sed -e 's@ va_list @ __gnuc_va_list @' \
1938 -e 's@ va_list)@ __gnuc_va_list)@' \
1939 -e 's@ _BSD_VA_LIST_));@ __gnuc_va_list));@' \
1940 -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \
1941 -e 's@ va_list@ __va_list__@' \
1942 -e 's@\*va_list@*__va_list__@' \
1943 -e 's@ __va_list)@ __gnuc_va_list)@' \
1944 -e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \
1945 -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \
1946 -e 's@VA_LIST@DUMMY_VA_LIST@' \
1947 -e 's@_Va_LIST@_VA_LIST@' ) < $infile > ${DESTDIR}/$file.
1948
1949 # Shell scripts have the potential of removing the output
1950 # We interpret that to mean the file is not to be altered
1951 #
1952 if test ! -f ${DESTDIR}/$file.
1953 then continue ; fi
1954
1955 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1956 ;; # case end for file name test
1957 esac
1958
1959
1960 #
1961 # Fix 66: Sun_Bogus_Ifdef
1962 #
1963 case "$file" in ./hsfs/hsfs_spec.h | \
1964 ./hsfs/iso_spec.h )
1965 if ( test -n "`egrep '#ifdef __i386__ || __vax__' $file`"
1966 ) > /dev/null 2>&1 ; then
1967 fixlist="${fixlist}
1968 sun_bogus_ifdef"
1969 if [ ! -r ${DESTDIR}/$file ]
1970 then infile=$file
1971 else infile=${DESTDIR}/$file ; fi
1972
1973 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
1974 < $infile > ${DESTDIR}/$file.
1975
1976 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1977 fi # end of selection 'if'
1978 ;; # case end for file name test
1979 esac
1980
1981
1982 #
1983 # Fix 67: Sun_Bogus_Ifdef_Sun4c
1984 #
1985 case "$file" in ./hsfs/hsnode.h )
1986 if ( test -n "`egrep '#ifdef __i386__ || __sun4c__' $file`"
1987 ) > /dev/null 2>&1 ; then
1988 fixlist="${fixlist}
1989 sun_bogus_ifdef_sun4c"
1990 if [ ! -r ${DESTDIR}/$file ]
1991 then infile=$file
1992 else infile=${DESTDIR}/$file ; fi
1993
1994 sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \
1995 < $infile > ${DESTDIR}/$file.
1996
1997 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
1998 fi # end of selection 'if'
1999 ;; # case end for file name test
2000 esac
2001
2002
2003 #
2004 # Fix 68: Sun_Catmacro
2005 #
2006 case "$file" in ./pixrect/memvar.h )
2007 if ( test -n "`egrep '^#define[ ]+CAT(a,b)' $file`"
2008 ) > /dev/null 2>&1 ; then
2009 fixlist="${fixlist}
2010 sun_catmacro"
2011 if [ ! -r ${DESTDIR}/$file ]
2012 then infile=$file
2013 else infile=${DESTDIR}/$file ; fi
2014
2015 sed -e '/^#define[ ]CAT(a,b)/ i\
2016#ifdef __STDC__ \
2017#define CAT(a,b) a##b\
2018#else
2019' \
2020 -e '/^#define[ ]CAT(a,b)/ a\
2021#endif
2022' \
2023 < $infile > ${DESTDIR}/$file.
2024
2025 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2026 fi # end of selection 'if'
2027 ;; # case end for file name test
2028 esac
2029
2030
2031 #
2032 # Fix 69: Sun_Malloc
2033 #
2034 case "$file" in ./malloc.h )
2035 fixlist="${fixlist}
2036 sun_malloc"
2037 if [ ! -r ${DESTDIR}/$file ]
2038 then infile=$file
2039 else infile=${DESTDIR}/$file ; fi
2040
2041 sed -e 's/typedef[ ]char \* malloc_t/typedef void \* malloc_t/g' \
2042 -e 's/int[ ][ ]*free/void free/g' \
2043 -e 's/char\([ ]*\*[ ]*malloc\)/void\1/g' \
2044 -e 's/char\([ ]*\*[ ]*realloc\)/void\1/g' \
2045 < $infile > ${DESTDIR}/$file.
2046
2047 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2048 ;; # case end for file name test
2049 esac
2050
2051
2052 #
2053 # Fix 70: Sun_Memcpy
2054 #
2055 case "$file" in ./memory.h )
2056 if ( test -n "`egrep '/\\* @\\(#\\)(head/memory.h 50.1 |memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2 )\\*/' $file`"
2057 ) > /dev/null 2>&1 ; then
2058 fixlist="${fixlist}
2059 sun_memcpy"
2060 if [ ! -r ${DESTDIR}/$file ]
2061 then infile=$file
2062 else infile=${DESTDIR}/$file ; fi
2063
2064 sed -e '1i\
2065/* This file was generated by fixincludes */\
2066#ifndef __memory_h__\
2067#define __memory_h__\
2068\
2069#ifdef __STDC__\
2070extern void *memccpy();\
2071extern void *memchr();\
2072extern void *memcpy();\
2073extern void *memset();\
2074#else\
2075extern char *memccpy();\
2076extern char *memchr();\
2077extern char *memcpy();\
2078extern char *memset();\
2079#endif /* __STDC__ */\
2080\
2081extern int memcmp();\
2082\
2083#endif /* __memory_h__ */
2084' \
2085 -e '1,$d' \
2086 < $infile > ${DESTDIR}/$file.
2087
2088 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2089 fi # end of selection 'if'
2090 ;; # case end for file name test
2091 esac
2092
2093
2094 #
2095 # Fix 71: Sun_Rusers_Semi
2096 #
2097 case "$file" in ./rpcsvc/rusers.h )
2098 if ( test -n "`egrep '_cnt$' $file`"
2099 ) > /dev/null 2>&1 ; then
2100 fixlist="${fixlist}
2101 sun_rusers_semi"
2102 if [ ! -r ${DESTDIR}/$file ]
2103 then infile=$file
2104 else infile=${DESTDIR}/$file ; fi
2105
2106 sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' \
2107 < $infile > ${DESTDIR}/$file.
2108
2109 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2110 fi # end of selection 'if'
2111 ;; # case end for file name test
2112 esac
2113
2114
2115 #
2116 # Fix 72: Sun_Signal
2117 #
2118 case "$file" in ./sys/signal.h | \
2119 ./signal.h )
2120 if ( test -n "`egrep '^void \\(\\*signal\\(\\)\\)\\(\\);' $file`"
2121 ) > /dev/null 2>&1 ; then
2122 fixlist="${fixlist}
2123 sun_signal"
2124 if [ ! -r ${DESTDIR}/$file ]
2125 then infile=$file
2126 else infile=${DESTDIR}/$file ; fi
2127
2128 sed -e '/^void (\*signal())();$/i\
2129#ifdef __cplusplus\
2130void (*signal(...))(...);\
2131#else
2132' \
2133 -e '/^void (\*signal())();$/a\
2134#endif
2135' \
2136 < $infile > ${DESTDIR}/$file.
2137
2138 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2139 fi # end of selection 'if'
2140 ;; # case end for file name test
2141 esac
2142
2143
2144 #
2145 # Fix 73: Sun_Auth_Proto
2146 #
2147 case "$file" in ./rpc/auth.h | \
2148 ./rpc/clnt.h | \
2149 ./rpc/svc.h | \
2150 ./rpc/xdr.h )
2151 case "$target_canonical" in *-sun-* )
2152 if ( test -n "`egrep '\\(\\*[a-z][a-z_]*\\)\\(\\)' $file`" -a \
2153 -z "`egrep '\\(\\*[a-z][a-z_]*\\)\\([ ]*[a-zA-Z.].*\\)' $file`"
2154 ) > /dev/null 2>&1 ; then
2155 fixlist="${fixlist}
2156 sun_auth_proto"
2157 if [ ! -r ${DESTDIR}/$file ]
2158 then infile=$file
2159 else infile=${DESTDIR}/$file ; fi
2160
2161 sed -e 's/^\(.*(\*[a-z][a-z_]*)(\)\();.*\)/\
2162#ifdef __cplusplus\
2163\1...\2\
2164#else\
2165\1\2\
2166#endif/' \
2167 < $infile > ${DESTDIR}/$file.
2168
2169 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2170 fi # end of selection 'if'
2171 ;; # case end for machine type test
2172 esac
2173 ;; # case end for file name test
2174 esac
2175
2176
2177 #
2178 # Fix 74: Sunos_Large_Macro
2179 #
2180 case "$file" in ./sundev/ipi_error.h )
2181 fixlist="${fixlist}
2182 sunos_large_macro"
2183 if [ ! -r ${DESTDIR}/$file ]
2184 then infile=$file
2185 else infile=${DESTDIR}/$file ; fi
2186 ( echo "Removing incorrect fix to SunOS <sundev/ipi_error.h>" >&2
2187rm -f ${DESTDIR}/$file ${DESTDIR}/$file.
2188cat > /dev/null ) < $infile > ${DESTDIR}/$file.
2189
2190 # Shell scripts have the potential of removing the output
2191 # We interpret that to mean the file is not to be altered
2192 #
2193 if test ! -f ${DESTDIR}/$file.
2194 then continue ; fi
2195
2196 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2197 ;; # case end for file name test
2198 esac
2199
2200
2201 #
2202 # Fix 75: Sunos_Matherr_Decl
2203 #
2204 case "$file" in ./math.h )
2205 if ( test '(' "`fgrep 'struct exception' $file | line`" != 'struct exception {' ')'
2206 ) > /dev/null 2>&1 ; then
2207 fixlist="${fixlist}
2208 sunos_matherr_decl"
2209 if [ ! -r ${DESTDIR}/$file ]
2210 then infile=$file
2211 else infile=${DESTDIR}/$file ; fi
2212
2213 sed -e '/matherr/i\
2214struct exception;
2215' \
2216 < $infile > ${DESTDIR}/$file.
2217
2218 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2219 fi # end of selection 'if'
2220 ;; # case end for file name test
2221 esac
2222
2223
2224 #
2225 # Fix 76: Sunos_Strlen
2226 #
2227 case "$file" in ./strings.h )
2228 fixlist="${fixlist}
2229 sunos_strlen"
2230 if [ ! -r ${DESTDIR}/$file ]
2231 then infile=$file
2232 else infile=${DESTDIR}/$file ; fi
2233
2234 sed -e 's/int[ ]*strlen();/__SIZE_TYPE__ strlen();/' \
2235 < $infile > ${DESTDIR}/$file.
2236
2237 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2238 ;; # case end for file name test
2239 esac
2240
2241
2242 #
2243 # Fix 77: Systypes
2244 #
2245 case "$file" in ./sys/types.h | \
2246 ./stdlib.h | \
2247 ./sys/stdtypes.h | \
2248 ./stddef.h | \
2249 ./memory.h | \
2250 ./unistd.h )
2251 if ( test -n "`egrep 'typedef[ ]+[a-z_][ a-z_]*[ ](size|ptrdiff|wchar)_t' $file`"
2252 ) > /dev/null 2>&1 ; then
2253 fixlist="${fixlist}
2254 systypes"
2255 if [ ! -r ${DESTDIR}/$file ]
2256 then infile=$file
2257 else infile=${DESTDIR}/$file ; fi
2258
2259 sed -e '/^[ ]*\*[ ]*typedef unsigned int size_t;/N' \
2260 -e 's/^\([ ]*\*[ ]*typedef unsigned int size_t;\n[ ]*\*\/\)/\1\
2261#ifndef __SIZE_TYPE__\
2262#define __SIZE_TYPE__ long unsigned int\
2263#endif\
2264typedef __SIZE_TYPE__ size_t;\
2265/' \
2266 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/i\
2267#ifndef __SIZE_TYPE__\
2268#define __SIZE_TYPE__ long unsigned int\
2269#endif
2270' \
2271 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/typedef __SIZE_TYPE__ size_t/' \
2272 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/i\
2273#ifndef __PTRDIFF_TYPE__\
2274#define __PTRDIFF_TYPE__ long int\
2275#endif
2276' \
2277 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/typedef __PTRDIFF_TYPE__ ptrdiff_t/' \
2278 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/i\
2279#ifndef __WCHAR_TYPE__\
2280#define __WCHAR_TYPE__ int\
2281#endif\
2282#ifndef __cplusplus
2283' \
2284 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/a\
2285#endif
2286' \
2287 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/typedef __WCHAR_TYPE__ wchar_t/' \
2288 < $infile > ${DESTDIR}/$file.
2289
2290 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2291 fi # end of selection 'if'
2292 ;; # case end for file name test
2293 esac
2294
2295
2296 #
2297 # Fix 78: Systypes_For_Aix
2298 #
2299 case "$file" in ./sys/types.h )
2300 if ( test -n "`egrep 'typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t' $file`" -a \
2301 -z "`egrep '_GCC_SIZE_T' $file`"
2302 ) > /dev/null 2>&1 ; then
2303 fixlist="${fixlist}
2304 systypes_for_aix"
2305 if [ ! -r ${DESTDIR}/$file ]
2306 then infile=$file
2307 else infile=${DESTDIR}/$file ; fi
2308
2309 sed -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/i\
2310#ifndef _GCC_SIZE_T\
2311#define _GCC_SIZE_T
2312' \
2313 -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/a\
2314#endif
2315' \
2316 < $infile > ${DESTDIR}/$file.
2317
2318 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2319 fi # end of selection 'if'
2320 ;; # case end for file name test
2321 esac
2322
2323
2324 #
2325 # Fix 79: Sysv68_String
2326 #
2327 case "$file" in ./string.h )
2328 fixlist="${fixlist}
2329 sysv68_string"
2330 if [ ! -r ${DESTDIR}/$file ]
2331 then infile=$file
2332 else infile=${DESTDIR}/$file ; fi
2333
2334 sed -e 's/extern[ ]*int[ ]*strlen();/extern unsigned int strlen();/' \
2335 -e 's/extern[ ]*int[ ]*ffs[ ]*(long);/extern int ffs(int);/' \
2336 -e 's/strdup(char \*s1);/strdup(const char *s1);/' \
2337 -e '/^extern char$/N' \
2338 -e 's/^extern char\(\n \*memccpy(),\)$/extern void\1/' \
2339 -e '/^ strncmp(),$/N' \
2340 -e 's/^\( strncmp()\),\n\( strlen(),\)$/\1;\
2341extern unsigned int\
2342\2/' \
2343 -e '/^extern int$/N' \
2344 -e 's/^extern int\(\n strlen(),\)/extern size_t\1/' \
2345 < $infile > ${DESTDIR}/$file.
2346
2347 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2348 ;; # case end for file name test
2349 esac
2350
2351
2352 #
2353 # Fix 80: Sysz_Stdlib_For_Sun
2354 #
2355 case "$file" in ./stdlib.h )
2356 case "$target_canonical" in *-sun-* | \
2357 m88k-*-sysv3* )
2358 fixlist="${fixlist}
2359 sysz_stdlib_for_sun"
2360 if [ ! -r ${DESTDIR}/$file ]
2361 then infile=$file
2362 else infile=${DESTDIR}/$file ; fi
2363
2364 sed -e 's/int abort/void abort/g' \
2365 -e 's/int free/void free/g' \
2366 -e 's/char[ ]*\*[ ]*calloc/void \* calloc/g' \
2367 -e 's/char[ ]*\*[ ]*malloc/void \* malloc/g' \
2368 -e 's/char[ ]*\*[ ]*realloc/void \* realloc/g' \
2369 -e 's/int[ ][ ]*exit/void exit/g' \
2370 -e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/i\
2371#ifndef _GCC_SIZE_T\
2372#define _GCC_SIZE_T
2373' \
2374 -e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/a\
2375#endif
2376' \
2377 < $infile > ${DESTDIR}/$file.
2378
2379 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2380 ;; # case end for machine type test
2381 esac
2382 ;; # case end for file name test
2383 esac
2384
2385
2386 #
2387 # Fix 81: Sysz_Stdtypes_For_Sun
2388 #
2389 case "$file" in ./sys/stdtypes.h )
2390 fixlist="${fixlist}
2391 sysz_stdtypes_for_sun"
2392 if [ ! -r ${DESTDIR}/$file ]
2393 then infile=$file
2394 else infile=${DESTDIR}/$file ; fi
2395
2396 sed -e '/[ ]size_t.*;/i\
2397#ifndef _GCC_SIZE_T\
2398#define _GCC_SIZE_T
2399' \
2400 -e '/[ ]size_t.*;/a\
2401#endif
2402' \
2403 -e '/[ ]ptrdiff_t.*;/i\
2404#ifndef _GCC_PTRDIFF_T\
2405#define _GCC_PTRDIFF_T
2406' \
2407 -e '/[ ]ptrdiff_t.*;/a\
2408#endif
2409' \
2410 -e '/[ ]wchar_t.*;/i\
2411#ifndef _GCC_WCHAR_T\
2412#define _GCC_WCHAR_T
2413' \
2414 -e '/[ ]wchar_t.*;/a\
2415#endif
2416' \
2417 < $infile > ${DESTDIR}/$file.
2418
2419 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2420 ;; # case end for file name test
2421 esac
2422
2423
2424 #
2425 # Fix 82: Tinfo_Cplusplus
2426 #
2427 case "$file" in ./tinfo.h )
2428 fixlist="${fixlist}
2429 tinfo_cplusplus"
2430 if [ ! -r ${DESTDIR}/$file ]
2431 then infile=$file
2432 else infile=${DESTDIR}/$file ; fi
2433
2434 sed -e 's/[ ]_cplusplus/ __cplusplus/' \
2435 < $infile > ${DESTDIR}/$file.
2436
2437 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2438 ;; # case end for file name test
2439 esac
2440
2441
2442 #
2443 # Fix 83: Ultrix_Ansi_Compat
2444 #
2445 case "$file" in ./ansi_compat.h )
2446 if ( test -n "`egrep 'ULTRIX' $file`"
2447 ) > /dev/null 2>&1 ; then
2448 fixlist="${fixlist}
2449 ultrix_ansi_compat"
2450 if [ ! -r ${DESTDIR}/$file ]
2451 then infile=$file
2452 else infile=${DESTDIR}/$file ; fi
2453
2454 sed -e '1i\
2455/* This file intentionally left blank. */
2456' \
2457 -e '1,$d' \
2458 < $infile > ${DESTDIR}/$file.
2459
2460 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2461 fi # end of selection 'if'
2462 ;; # case end for file name test
2463 esac
2464
2465
2466 #
2467 # Fix 84: Ultrix_Atof_Param
2468 #
2469 case "$file" in ./math.h )
2470 fixlist="${fixlist}
2471 ultrix_atof_param"
2472 if [ ! -r ${DESTDIR}/$file ]
2473 then infile=$file
2474 else infile=${DESTDIR}/$file ; fi
2475
2476 sed -e 's@atof(\([ ]*char[ ]*\*[^)]*\))@atof(const \1)@' \
2477 -e 's@inline int abs(int [a-z][a-z]*) {.*}@extern "C" int abs(int);@' \
2478 -e 's@inline double abs(double [a-z][a-z]*) {.*}@@' \
2479 -e 's@inline int sqr(int [a-z][a-z]*) {.*}@@' \
2480 -e 's@inline double sqr(double [a-z][a-z]*) {.*}@@' \
2481 < $infile > ${DESTDIR}/$file.
2482
2483 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2484 ;; # case end for file name test
2485 esac
2486
2487
2488 #
2489 # Fix 85: Ultrix_Const
2490 #
2491 case "$file" in ./stdio.h )
2492 fixlist="${fixlist}
2493 ultrix_const"
2494 if [ ! -r ${DESTDIR}/$file ]
2495 then infile=$file
2496 else infile=${DESTDIR}/$file ; fi
2497
2498 sed -e 's@perror( char \*__s );@perror( const char *__s );@' \
2499 -e 's@fputs( char \*__s,@fputs( const char *__s,@' \
2500 -e 's@fopen( char \*__filename, char \*__type );@fopen( const char *__filename, const char *__type );@' \
2501 -e 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@' \
2502 -e 's@fscanf( FILE \*__stream, char \*__format,@fscanf( FILE *__stream, const char *__format,@' \
2503 -e 's@scanf( char \*__format,@scanf( const char *__format,@' \
2504 -e 's@sscanf( char \*__s, char \*__format,@sscanf( const char *__s, const char *__format,@' \
2505 -e 's@popen(char \*, char \*);@popen(const char *, const char *);@' \
2506 -e 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@' \
2507 < $infile > ${DESTDIR}/$file.
2508
2509 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2510 ;; # case end for file name test
2511 esac
2512
2513
2514 #
2515 # Fix 86: Ultrix_Ifdef
2516 #
2517 case "$file" in ./sys/file.h )
2518 if ( test -n "`egrep '#ifdef KERNEL' $file`"
2519 ) > /dev/null 2>&1 ; then
2520 fixlist="${fixlist}
2521 ultrix_ifdef"
2522 if [ ! -r ${DESTDIR}/$file ]
2523 then infile=$file
2524 else infile=${DESTDIR}/$file ; fi
2525
2526 sed -e 's/#ifdef KERNEL/#if defined(KERNEL)/' \
2527 < $infile > ${DESTDIR}/$file.
2528
2529 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2530 fi # end of selection 'if'
2531 ;; # case end for file name test
2532 esac
2533
2534
2535 #
2536 # Fix 87: Ultrix_Nested_Cmnt
2537 #
2538 case "$file" in ./rpc/svc.h )
2539 fixlist="${fixlist}
2540 ultrix_nested_cmnt"
2541 if [ ! -r ${DESTDIR}/$file ]
2542 then infile=$file
2543 else infile=${DESTDIR}/$file ; fi
2544
2545 sed -e 's@^\( \* int protocol; \)/\*@\1*/ /*@' \
2546 < $infile > ${DESTDIR}/$file.
2547
2548 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2549 ;; # case end for file name test
2550 esac
2551
2552
2553 #
2554 # Fix 88: Ultrix_Static
2555 #
2556 case "$file" in ./machine/cpu.h )
2557 if ( test -n "`egrep '#include \"r[34]_cpu' $file`"
2558 ) > /dev/null 2>&1 ; then
2559 fixlist="${fixlist}
2560 ultrix_static"
2561 if [ ! -r ${DESTDIR}/$file ]
2562 then infile=$file
2563 else infile=${DESTDIR}/$file ; fi
2564
2565 sed -e 's/^static struct tlb_pid_state/struct tlb_pid_state/' \
2566 -e 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/' \
2567 -e 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/' \
2568 < $infile > ${DESTDIR}/$file.
2569
2570 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2571 fi # end of selection 'if'
2572 ;; # case end for file name test
2573 esac
2574
2575
2576 #
2577 # Fix 89: Undefine_Null
2578 #
2579 if ( test -n "`egrep '^#[ ]*define[ ]*[ ]NULL[ ]' $file`" -a \
2580 -z "`egrep '#[ ]*(ifn|un)def[ ]*[ ]NULL($|[ ])' $file`"
2581 ) > /dev/null 2>&1 ; then
2582 fixlist="${fixlist}
2583 undefine_null"
2584 if [ ! -r ${DESTDIR}/$file ]
2585 then infile=$file
2586 else infile=${DESTDIR}/$file ; fi
2587
2588 sed -e '/^#[ ]*define[ ][ ]*NULL[ ]/i\
2589#undef NULL
2590' \
2591 < $infile > ${DESTDIR}/$file.
2592
2593 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2594 fi # end of selection 'if'
2595
2596
2597 #
2598 # Fix 90: Va_I960_Macro
2599 #
2600 case "$file" in ./arch/i960/archI960.h )
2601 if ( test -n "`egrep '__(vsiz|vali|vpad|alignof__)' $file`"
2602 ) > /dev/null 2>&1 ; then
2603 fixlist="${fixlist}
2604 va_i960_macro"
2605 if [ ! -r ${DESTDIR}/$file ]
2606 then infile=$file
2607 else infile=${DESTDIR}/$file ; fi
2608
2609 sed -e 's/__vsiz/__vxvsiz/' \
2610 -e 's/__vali/__vxvali/' \
2611 -e 's/__vpad/__vxvpad/' \
2612 -e 's/__alignof__/__vxalignof__/' \
2613 < $infile > ${DESTDIR}/$file.
2614
2615 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2616 fi # end of selection 'if'
2617 ;; # case end for file name test
2618 esac
2619
2620
2621 #
2622 # Fix 91: Void_Null
2623 #
2624 case "$file" in ./curses.h | \
2625 ./dbm.h | \
2626 ./locale.h | \
2627 ./stdio.h | \
2628 ./stdlib.h | \
2629 ./string.h | \
2630 ./time.h | \
2631 ./unistd.h | \
2632 ./sys/dir.h | \
2633 ./sys/param.h | \
2634 ./sys/types.h )
2635 if ( test -n "`egrep '#[ ]*define[ ][ ]*NULL[ ].*void' $file`"
2636 ) > /dev/null 2>&1 ; then
2637 fixlist="${fixlist}
2638 void_null"
2639 if [ ! -r ${DESTDIR}/$file ]
2640 then infile=$file
2641 else infile=${DESTDIR}/$file ; fi
2642
2643 sed -e 's/^#[ ]*define[ ]*NULL[ ]*((void[ ]*\*)0)/#define NULL 0/' \
2644 < $infile > ${DESTDIR}/$file.
2645
2646 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2647 fi # end of selection 'if'
2648 ;; # case end for file name test
2649 esac
2650
2651
2652 #
2653 # Fix 92: Vxworks_Gcc_Problem
2654 #
2655 case "$file" in ./types/vxTypesBase.h )
2656 if ( test -n "`egrep '__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__' $file`"
2657 ) > /dev/null 2>&1 ; then
2658 fixlist="${fixlist}
2659 vxworks_gcc_problem"
2660 if [ ! -r ${DESTDIR}/$file ]
2661 then infile=$file
2662 else infile=${DESTDIR}/$file ; fi
2663
2664 sed -e 's/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/#if 1/' \
2665 -e '/[ ]size_t/i\
2666#ifndef _GCC_SIZE_T\
2667#define _GCC_SIZE_T
2668' \
2669 -e '/[ ]size_t/a\
2670#endif
2671' \
2672 -e '/[ ]ptrdiff_t/i\
2673#ifndef _GCC_PTRDIFF_T\
2674#define _GCC_PTRDIFF_T
2675' \
2676 -e '/[ ]ptrdiff_t/a\
2677#endif
2678' \
2679 -e '/[ ]wchar_t/i\
2680#ifndef _GCC_WCHAR_T\
2681#define _GCC_WCHAR_T
2682' \
2683 -e '/[ ]wchar_t/a\
2684#endif
2685' \
2686 < $infile > ${DESTDIR}/$file.
2687
2688 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2689 fi # end of selection 'if'
2690 ;; # case end for file name test
2691 esac
2692
2693
2694 #
2695 # Fix 93: Vxworks_Needs_Vxtypes
2696 #
2697 case "$file" in ./time.h )
2698 if ( test -n "`egrep 'uint_t[ ][ ]*_clocks_per_sec' $file`"
2699 ) > /dev/null 2>&1 ; then
2700 fixlist="${fixlist}
2701 vxworks_needs_vxtypes"
2702 if [ ! -r ${DESTDIR}/$file ]
2703 then infile=$file
2704 else infile=${DESTDIR}/$file ; fi
2705
2706 sed -e 's/uint_t/unsigned int/' \
2707 < $infile > ${DESTDIR}/$file.
2708
2709 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2710 fi # end of selection 'if'
2711 ;; # case end for file name test
2712 esac
2713
2714
2715 #
2716 # Fix 94: Vxworks_Needs_Vxworks
2717 #
2718 case "$file" in ./sys/stat.h )
2719 if ( test -n "`egrep '#[ ]define[ ][ ]*__INCstath' $file`" -a \
2720 '(' -r types/vxTypesOld.h ')' -a \
2721 '(' -n "`fgrep '#include' $file`" ')' -a \
2722 '(' -n "`fgrep ULONG $file`" ')'
2723 ) > /dev/null 2>&1 ; then
2724 fixlist="${fixlist}
2725 vxworks_needs_vxworks"
2726 if [ ! -r ${DESTDIR}/$file ]
2727 then infile=$file
2728 else infile=${DESTDIR}/$file ; fi
2729
2730 sed -e '/#[ ]define[ ][ ]*__INCstath/a\
2731#include <types/vxTypesOld.h>
2732' \
2733 < $infile > ${DESTDIR}/$file.
2734
2735 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2736 fi # end of selection 'if'
2737 ;; # case end for file name test
2738 esac
2739
2740
2741 #
2742 # Fix 95: Vxworks_Time
2743 #
2744 case "$file" in ./time.h )
2745 if ( test -n "`egrep 'VOIDFUNCPTR' $file`" -a \
2746 '(' -r vxWorks.h ')'
2747 ) > /dev/null 2>&1 ; then
2748 fixlist="${fixlist}
2749 vxworks_time"
2750 if [ ! -r ${DESTDIR}/$file ]
2751 then infile=$file
2752 else infile=${DESTDIR}/$file ; fi
2753
2754 sed -e '/VOIDFUNCPTR/i\
2755#ifndef __gcc_VOIDFUNCPTR_defined\
2756#ifdef __cplusplus\
2757typedef void (*__gcc_VOIDFUNCPTR) (...);\
2758#else\
2759typedef void (*__gcc_VOIDFUNCPTR) ();\
2760#endif\
2761#define __gcc_VOIDFUNCPTR_defined\
2762#endif
2763' \
2764 -e 's/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g' \
2765 < $infile > ${DESTDIR}/$file.
2766
2767 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2768 fi # end of selection 'if'
2769 ;; # case end for file name test
2770 esac
2771
2772
2773 #
2774 # Fix 96: X11_Class
2775 #
2776 case "$file" in ./X11/ShellP.h )
2777 if ( test -z "`egrep '__cplusplus' $file`"
2778 ) > /dev/null 2>&1 ; then
2779 fixlist="${fixlist}
2780 x11_class"
2781 if [ ! -r ${DESTDIR}/$file ]
2782 then infile=$file
2783 else infile=${DESTDIR}/$file ; fi
2784
2785 sed -e '/char \*class;/i\
2786#ifdef __cplusplus\
2787 char *c_class;\
2788#else
2789' \
2790 -e '/char \*class;/a\
2791#endif
2792' \
2793 < $infile > ${DESTDIR}/$file.
2794
2795 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2796 fi # end of selection 'if'
2797 ;; # case end for file name test
2798 esac
2799
2800
2801 #
2802 # Fix 97: X11_Class_Usage
2803 #
2804 case "$file" in ./Xm/BaseClassI.h )
2805 if ( test -z "`egrep '__cplusplus' $file`"
2806 ) > /dev/null 2>&1 ; then
2807 fixlist="${fixlist}
2808 x11_class_usage"
2809 if [ ! -r ${DESTDIR}/$file ]
2810 then infile=$file
2811 else infile=${DESTDIR}/$file ; fi
2812
2813 sed -e 's/ class[)]/ c_class)/g' \
2814 < $infile > ${DESTDIR}/$file.
2815
2816 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2817 fi # end of selection 'if'
2818 ;; # case end for file name test
2819 esac
2820
2821
2822 #
2823 # Fix 98: X11_New
2824 #
2825 case "$file" in ./Xm/Traversal.h )
2826 if ( test -z "`egrep '__cplusplus' $file`"
2827 ) > /dev/null 2>&1 ; then
2828 fixlist="${fixlist}
2829 x11_new"
2830 if [ ! -r ${DESTDIR}/$file ]
2831 then infile=$file
2832 else infile=${DESTDIR}/$file ; fi
2833
2834 sed -e '/Widget old, new;/i\
2835#ifdef __cplusplus\
2836 Widget old, c_new;\
2837#else
2838' \
2839 -e '/Widget old, new;/a\
2840#endif
2841' \
2842 -e 's/Widget new,/Widget c_new,/g' \
2843 < $infile > ${DESTDIR}/$file.
2844
2845 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2846 fi # end of selection 'if'
2847 ;; # case end for file name test
2848 esac
2849
2850
2851 #
2852 # Fix 99: X11_Sprintf
2853 #
2854 case "$file" in ./X11*/Xmu.h )
2855 fixlist="${fixlist}
2856 x11_sprintf"
2857 if [ ! -r ${DESTDIR}/$file ]
2858 then infile=$file
2859 else infile=${DESTDIR}/$file ; fi
2860
2861 sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
2862extern char * sprintf();\
2863#endif /* !defined __STDC__ */,' \
2864 < $infile > ${DESTDIR}/$file.
2865
2866 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2867 ;; # case end for file name test
2868 esac
2869
2870
2871 #
2872 # Fix 100: Zzz_Ki_Iface
2873 #
2874 case "$file" in ./sys/ki_iface.h )
2875 if ( test -n "`egrep 'These definitions are for HP Internal developers' $file`"
2876 ) > /dev/null 2>&1 ; then
2877 fixlist="${fixlist}
2878 zzz_ki_iface"
2879 if [ ! -r ${DESTDIR}/$file ]
2880 then infile=$file
2881 else infile=${DESTDIR}/$file ; fi
2882 ( echo "Removing incorrect fix to HP-UX <$file>" >&2
2883rm -f ${DESTDIR}/$file ${DESTDIR}/$file.
2884cat > /dev/null ) < $infile > ${DESTDIR}/$file.
2885
2886 # Shell scripts have the potential of removing the output
2887 # We interpret that to mean the file is not to be altered
2888 #
2889 if test ! -f ${DESTDIR}/$file.
2890 then continue ; fi
2891
2892 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2893 fi # end of selection 'if'
2894 ;; # case end for file name test
2895 esac
2896
2897
2898 #
2899 # Fix 101: Zzz_Ki
2900 #
2901 case "$file" in ./sys/ki.h )
2902 if ( test -n "`egrep '11.00 HP-UX LP64' $file`"
2903 ) > /dev/null 2>&1 ; then
2904 fixlist="${fixlist}
2905 zzz_ki"
2906 if [ ! -r ${DESTDIR}/$file ]
2907 then infile=$file
2908 else infile=${DESTDIR}/$file ; fi
2909 ( echo "Removing incorrect fix to HP-UX <$file>" >&2
2910rm -f ${DESTDIR}/$file ${DESTDIR}/$file.
2911cat > /dev/null ) < $infile > ${DESTDIR}/$file.
2912
2913 # Shell scripts have the potential of removing the output
2914 # We interpret that to mean the file is not to be altered
2915 #
2916 if test ! -f ${DESTDIR}/$file.
2917 then continue ; fi
2918
2919 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2920 fi # end of selection 'if'
2921 ;; # case end for file name test
2922 esac
2923
2924
2925 #
2926 # Fix 102: Zzz_Ki_Calls
2927 #
2928 case "$file" in ./sys/ki_calls.h )
2929 if ( test -n "`egrep 'KI_MAX_PROCS is an arbitrary number' $file`"
2930 ) > /dev/null 2>&1 ; then
2931 fixlist="${fixlist}
2932 zzz_ki_calls"
2933 if [ ! -r ${DESTDIR}/$file ]
2934 then infile=$file
2935 else infile=${DESTDIR}/$file ; fi
2936 ( echo "Removing incorrect fix to HP-UX <$file>" >&2
2937rm -f ${DESTDIR}/$file ${DESTDIR}/$file.
2938cat > /dev/null ) < $infile > ${DESTDIR}/$file.
2939
2940 # Shell scripts have the potential of removing the output
2941 # We interpret that to mean the file is not to be altered
2942 #
2943 if test ! -f ${DESTDIR}/$file.
2944 then continue ; fi
2945
2946 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2947 fi # end of selection 'if'
2948 ;; # case end for file name test
2949 esac
2950
2951
2952 #
2953 # Fix 103: Zzz_Ki_Defs
2954 #
2955 case "$file" in ./sys/ki_defs.h )
2956 if ( test -n "`egrep 'Kernel Instrumentation Definitions' $file`"
2957 ) > /dev/null 2>&1 ; then
2958 fixlist="${fixlist}
2959 zzz_ki_defs"
2960 if [ ! -r ${DESTDIR}/$file ]
2961 then infile=$file
2962 else infile=${DESTDIR}/$file ; fi
2963 ( echo "Removing incorrect fix to HP-UX <$file>" >&2
2964rm -f ${DESTDIR}/$file ${DESTDIR}/$file.
2965cat > /dev/null ) < $infile > ${DESTDIR}/$file.
2966
2967 # Shell scripts have the potential of removing the output
2968 # We interpret that to mean the file is not to be altered
2969 #
2970 if test ! -f ${DESTDIR}/$file.
2971 then continue ; fi
2972
2973 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
2974 fi # end of selection 'if'
2975 ;; # case end for file name test
2976 esac
2977
2978
2979 #
2980 # Fix 104: Zzz_Time
2981 #
2982 case "$file" in ./sys/time.h )
2983 if ( test -n "`egrep 'For CASPEC, look in' $file`"
2984 ) > /dev/null 2>&1 ; then
2985 fixlist="${fixlist}
2986 zzz_time"
2987 if [ ! -r ${DESTDIR}/$file ]
2988 then infile=$file
2989 else infile=${DESTDIR}/$file ; fi
2990 ( echo "Removing incorrect fix to HP-UX <$file>" >&2
2991rm -f ${DESTDIR}/$file ${DESTDIR}/$file.
2992cat > /dev/null ) < $infile > ${DESTDIR}/$file.
2993
2994 # Shell scripts have the potential of removing the output
2995 # We interpret that to mean the file is not to be altered
2996 #
2997 if test ! -f ${DESTDIR}/$file.
2998 then continue ; fi
2999
3000 mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
3001 fi # end of selection 'if'
3002 ;; # case end for file name test
3003 esac
3004 # IF the output has been removed OR it is unchanged,
3005 # THEN ensure the output is gone
3006 # ELSE look for local directory include syntax
3007 #
3008 if ( test ! -f ${DESTDIR}/$file || \
3009 cmp $file ${DESTDIR}/$file ) > /dev/null 2>&1
3010 then
3011 rm -f ${DESTDIR}/$file
3012 else
3013 echo "Fixed $file:${fixlist}"
3014
3015 # Find any include directives that use "file".
3016 #
3017 for include in `
3018 egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${DESTDIR}/$file |
3019 sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`
3020 do
3021 dir=`echo $file | sed -e s'|/[^/]*$||'`
3022 required="$required ${SRCDIR} $dir/$include ${DESTDIR}/$dir/$include"
3023 done
3024 fi
3025 done # for file in $files
3026
3027done
3028
3029## Make sure that any include files referenced using double quotes
3030## exist in the fixed directory. This comes last since otherwise
3031## we might end up deleting some of these files "because they don't
3032## need any change."
3033set x `echo $required`
3034shift
3035while [ $# != 0 ]; do
3036 newreq=
3037 while [ $# != 0 ]; do
3038 # $1 is the directory to copy from,
3039 # $2 is the unfixed file,
3040 # $3 is the fixed file name.
3041 #
3042 cd ${INPUT}
3043 cd $1
3044 if [ -r $2 ] && [ ! -r $3 ]; then
3045 cp $2 $3 >/dev/null 2>&1 || echo "Can't copy $2" >&2
3046 chmod +w $3 2>/dev/null
3047 chmod a+r $3 2>/dev/null
3048 echo Copied $2
3049 for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 |
3050 sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`
3051 do
3052 dir=`echo $2 | sed -e s'|/[^/]*$||'`
3053 dir2=`echo $3 | sed -e s'|/[^/]*$||'`
3054 newreq="$newreq $1 $dir/$include $dir2/$include"
3055 done
3056 fi
3057 shift; shift; shift
3058 done
3059 set x $newreq
3060 shift
3061done
3062
3063echo 'Cleaning up DONE files.'
3064cd $LIB
3065find . -name DONE -exec rm -f '{}' ';'
3066
3067echo 'Removing unneeded directories:'
3068cd $LIB
3069files=`find . -type d -print | sort -r`
3070for file in $files; do
3071 rmdir $LIB/$file > /dev/null 2>&1 | :
3072done
3073
3074# # # # # # # # # # # # # # # # # # # # #
3075#
3076# End of for INPUT directories
3077#
3078done
3079#
3080# # # # # # # # # # # # # # # # # # # # #
3081
3082cd $ORIGDIR
3083rm -f include/assert.h
3084cp ${EGCS_SRCDIR}/assert.h include/assert.h
3085chmod a+r include/assert.h
3086
This page took 0.306076 seconds and 5 git commands to generate.