* haifa-sched.c (find_rgns): Replace uses of alloca with xmalloc.
[official-gcc.git] / gcc / fixinc / inclhack.sh
blob7ad7648ff5ea32e7b28849106897503a08af55ae
1 #!/bin/sh
3 # DO NOT EDIT THIS FILE - it has been generated
5 # Install modified versions of certain ANSI-incompatible system header
6 # files which are fixed to work correctly with ANSI C and placed in a
7 # directory that GNU C will search.
9 # This script contains 107 fixup scripts.
11 # See README-fixinc for more information.
13 # fixincludes copyright (c) 1999 The Free Software Foundation, Inc.
15 # fixincludes is free software.
17 # You may redistribute it and/or modify it under the terms of the
18 # GNU General Public License, as published by the Free Software
19 # Foundation; either version 2, or (at your option) any later version.
21 # fixincludes is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
24 # See the GNU General Public License for more details.
26 # You should have received a copy of the GNU General Public License
27 # along with fixincludes. See the file "COPYING". If not,
28 # write to: The Free Software Foundation, Inc.,
29 # 59 Temple Place - Suite 330,
30 # Boston, MA 02111-1307, USA.
32 # # # # # # # # # # # # # # # # # # # # #
34 # Directory in which to store the results.
35 # Fail if no arg to specify a directory for the output.
36 if [ "x$1" = "x" ]
37 then echo fixincludes: no output directory specified
38 exit 1
41 LIB=${1}
42 shift
44 # Make sure it exists.
45 if [ ! -d $LIB ]; then
46 mkdir $LIB || {
47 echo fixincludes: output dir '`'$LIB"' cannot be created"
48 exit 1
50 else
51 ( cd $LIB && touch DONE && rm DONE ) || {
52 echo fixincludes: output dir '`'$LIB"' is an invalid directory"
53 exit 1
57 FIXTESTS=$PWD/fixinc/fixtests
58 FIXFIXES=$PWD/fixinc/fixfixes
60 # Define what target system we're fixing.
62 if test -r ./Makefile; then
63 target_canonical="`sed -n -e 's,^target[ ]*=[ ]*\(.*\)$,\1,p' < Makefile`"
66 # If not from the Makefile, then try config.guess
68 if test -z "${target_canonical}" ; then
69 if test -x ./config.guess ; then
70 target_canonical="`config.guess`" ; fi
71 test -z "${target_canonical}" && target_canonical=unknown
73 export target_canonical
75 # # # # # # # # # # # # # # # # # # # # #
77 # Define PWDCMD as a command to use to get the working dir
78 # in the form that we want.
79 PWDCMD=pwd
81 case "`$PWDCMD`" in
82 //*)
83 # On an Apollo, discard everything before `/usr'.
84 PWDCMD="eval pwd | sed -e 's,.*/usr/,/usr/,'"
86 esac
88 # Original directory.
89 ORIGDIR=`${PWDCMD}`
91 # Make LIB absolute only if needed to avoid problems with the amd.
92 case $LIB in
93 /*)
96 cd $LIB; LIB=`${PWDCMD}`
98 esac
100 echo Fixing headers into ${LIB} for ${target_canonical} target
102 # Determine whether this system has symbolic links.
103 if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
104 rm -f $LIB/ShouldNotExist
105 LINKS=true
106 elif ln -s X /tmp/ShouldNotExist 2>/dev/null; then
107 rm -f /tmp/ShouldNotExist
108 LINKS=true
109 else
110 LINKS=false
113 # # # # # # # # # # # # # # # # # # # # #
115 # Search each input directory for broken header files.
116 # This loop ends near the end of the file.
118 if test $# -eq 0
119 then
120 INPUTLIST="/usr/include"
121 else
122 INPUTLIST="$@"
125 for INPUT in ${INPUTLIST} ; do
127 cd ${ORIGDIR}
129 cd ${INPUT} || continue
130 INPUT=`${PWDCMD}`
133 # # # # # # # # # # # # # # # # # # # # #
135 echo Finding directories and links to directories
137 # Find all directories and all symlinks that point to directories.
138 # Put the list in $all_dirs.
139 # Each time we find a symlink, add it to newdirs
140 # so that we do another find within the dir the link points to.
141 # Note that $all_dirs may have duplicates in it;
142 # later parts of this file are supposed to ignore them.
143 dirs="."
144 levels=2
145 all_dirs=""
146 search_dirs=""
148 while [ -n "$dirs" ] && [ $levels -gt 0 ]
150 levels=`expr $levels - 1`
151 newdirs=
152 for d in $dirs
154 echo " Searching $INPUT/$d"
156 # Find all directories under $d, relative to $d, excluding $d itself.
157 # (The /. is needed after $d in case $d is a symlink.)
158 all_dirs="$all_dirs `find $d/. -type d -print | \
159 sed -e '/\/\.$/d' -e 's@/./@/@g'`"
160 # Find all links to directories.
161 # Using `-exec test -d' in find fails on some systems,
162 # and trying to run test via sh fails on others,
163 # so this is the simplest alternative left.
164 # First find all the links, then test each one.
165 theselinks=
166 $LINKS && \
167 theselinks=`find $d/. -type l -print | sed -e 's@/./@/@g'`
168 for d1 in $theselinks --dummy--
170 # If the link points to a directory,
171 # add that dir to $newdirs
172 if [ -d $d1 ]
173 then
174 all_dirs="$all_dirs $d1"
175 if [ "`ls -ld $d1 | sed -n 's/.*-> //p'`" != "." ]
176 then
177 newdirs="$newdirs $d1"
178 search_dirs="$search_dirs $d1"
181 done
182 done
184 dirs="$newdirs"
185 done
187 # # # # # # # # # # # # # # # # # # # # #
189 dirs=
190 echo "All directories (including links to directories):"
191 echo $all_dirs
193 for file in $all_dirs; do
194 rm -rf $LIB/$file
195 if [ ! -d $LIB/$file ]
196 then mkdir $LIB/$file
198 done
199 mkdir $LIB/root
201 # # # # # # # # # # # # # # # # # # # # #
203 # treetops gets an alternating list
204 # of old directories to copy
205 # and the new directories to copy to.
206 treetops=". ${LIB}"
208 if $LINKS; then
209 echo 'Making symbolic directory links'
210 cwd=`${PWDCMD}`
212 for sym_link in $search_dirs; do
213 cd ${INPUT}
214 dest=`ls -ld ${sym_link} | sed -n 's/.*-> //p'`
216 # In case $dest is relative, get to ${sym_link}'s dir first.
218 cd ./`echo ${sym_link} | sed 's;/[^/]*$;;'`
220 # Check that the target directory exists.
221 # Redirections changed to avoid bug in sh on Ultrix.
223 (cd $dest) > /dev/null 2>&1
224 if [ $? = 0 ]; then
225 cd $dest
227 # full_dest_dir gets the dir that the link actually leads to.
229 full_dest_dir=`${PWDCMD}`
231 # Canonicalize ${INPUT} now to minimize the time an
232 # automounter has to change the result of ${PWDCMD}.
234 cinput=`cd ${INPUT}; ${PWDCMD}`
236 # If a link points to ., make a similar link to .
238 if [ ${full_dest_dir} = ${cinput} ]; then
239 echo ${sym_link} '->' . ': Making self link'
240 rm -fr ${LIB}/${sym_link} > /dev/null 2>&1
241 ln -s . ${LIB}/${sym_link} > /dev/null 2>&1
243 # If link leads back into ${INPUT},
244 # make a similar link here.
246 elif expr ${full_dest_dir} : "${cinput}/.*" > /dev/null; then
247 # Y gets the actual target dir name, relative to ${INPUT}.
248 y=`echo ${full_dest_dir} | sed -n "s&${cinput}/&&p"`
249 # DOTS is the relative path from ${LIB}/${sym_link} back to ${LIB}.
250 dots=`echo "${sym_link}" |
251 sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
252 echo ${sym_link} '->' $dots$y ': Making local link'
253 rm -fr ${LIB}/${sym_link} > /dev/null 2>&1
254 ln -s $dots$y ${LIB}/${sym_link} > /dev/null 2>&1
256 else
257 # If the link is to a dir $target outside ${INPUT},
258 # repoint the link at ${INPUT}/root$target
259 # and process $target into ${INPUT}/root$target
260 # treat this directory as if it actually contained the files.
262 echo ${sym_link} '->' root${full_dest_dir} ': Making rooted link'
263 if [ -d $LIB/root${full_dest_dir} ]
264 then true
265 else
266 dirname=root${full_dest_dir}/
267 dirmade=.
268 cd $LIB
269 while [ x$dirname != x ]; do
270 component=`echo $dirname | sed -e 's|/.*$||'`
271 mkdir $component >/dev/null 2>&1
272 cd $component
273 dirmade=$dirmade/$component
274 dirname=`echo $dirname | sed -e 's|[^/]*/||'`
275 done
278 # Duplicate directory structure created in ${LIB}/${sym_link} in new
279 # root area.
281 for file2 in $all_dirs; do
282 case $file2 in
283 ${sym_link}/*)
284 dupdir=${LIB}/root${full_dest_dir}/`echo $file2 |
285 sed -n "s|^${sym_link}/||p"`
286 echo "Duplicating ${sym_link}'s ${dupdir}"
287 if [ -d ${dupdir} ]
288 then true
289 else
290 mkdir ${dupdir}
295 esac
296 done
298 # Get the path from ${LIB} to ${sym_link}, accounting for symlinks.
300 parent=`echo "${sym_link}" | sed -e 's@/[^/]*$@@'`
301 libabs=`cd ${LIB}; ${PWDCMD}`
302 file2=`cd ${LIB}; cd $parent; ${PWDCMD} | sed -e "s@^${libabs}@@"`
304 # DOTS is the relative path from ${LIB}/${sym_link} back to ${LIB}.
306 dots=`echo "$file2" | sed -e 's@/[^/]*@../@g'`
307 rm -fr ${LIB}/${sym_link} > /dev/null 2>&1
308 ln -s ${dots}root${full_dest_dir} ${LIB}/${sym_link} > /dev/null 2>&1
309 treetops="$treetops ${sym_link} ${LIB}/root${full_dest_dir}"
312 done
315 # # # # # # # # # # # # # # # # # # # # #
317 required=
318 set x $treetops
319 shift
320 while [ $# != 0 ]; do
321 # $1 is an old directory to copy, and $2 is the new directory to copy to.
323 SRCDIR=`cd ${INPUT} ; cd $1 ; ${PWDCMD}`
324 export SRCDIR
326 FIND_BASE=$1
327 export FIND_BASE
328 shift
330 DESTDIR=`cd $1;${PWDCMD}`
331 export DESTDIR
332 shift
334 # The same dir can appear more than once in treetops.
335 # There's no need to scan it more than once.
337 if [ -f ${DESTDIR}/DONE ]
338 then continue ; fi
340 touch ${DESTDIR}/DONE
341 echo Fixing directory ${SRCDIR} into ${DESTDIR}
343 # Check files which are symlinks as well as those which are files.
345 cd ${INPUT}
346 files=`if $LINKS; then
347 find ${FIND_BASE}/. -name '*.h' \( -type f -o -type l \) -print
348 else
349 find ${FIND_BASE}/. -name '*.h' -type f -print
350 fi | \
351 sed -e 's;/\./;/;g' -e 's;//*;/;g' `
353 echo Checking header files
354 for file in $files; do
356 # Skip unreadable files, symlinks to directories and glibc files
357 if test ! -r "${file}" || test -d "${file}/." \
358 || fgrep 'This file is part of the GNU C Library' "${file}" \
359 > /dev/null 2>&1; then
360 continue
363 fixlist=""
364 DESTFILE=${DESTDIR}/`echo ${file} | sed "s;${FIND_BASE}/;;" `
367 # Fix 1: Aaa_Ki_Iface
369 case "${file}" in ./sys/ki_iface.h )
370 if ( test -n "`egrep 'These definitions are for HP Internal developers' ${file}`"
371 ) > /dev/null 2>&1 ; then
372 echo "aaa_ki_iface bypassing file ${file}"
373 continue
375 fi # end of select 'if'
376 ;; # case end for file name test
377 esac
381 # Fix 2: Aaa_Ki
383 case "${file}" in ./sys/ki.h )
384 if ( test -n "`egrep '11.00 HP-UX LP64' ${file}`"
385 ) > /dev/null 2>&1 ; then
386 echo "aaa_ki bypassing file ${file}"
387 continue
389 fi # end of select 'if'
390 ;; # case end for file name test
391 esac
395 # Fix 3: Aaa_Ki_Calls
397 case "${file}" in ./sys/ki_calls.h )
398 if ( test -n "`egrep 'kthread_create_caller_t' ${file}`"
399 ) > /dev/null 2>&1 ; then
400 echo "aaa_ki_calls bypassing file ${file}"
401 continue
403 fi # end of select 'if'
404 ;; # case end for file name test
405 esac
409 # Fix 4: Aaa_Ki_Defs
411 case "${file}" in ./sys/ki_defs.h )
412 if ( test -n "`egrep 'Kernel Instrumentation Definitions' ${file}`"
413 ) > /dev/null 2>&1 ; then
414 echo "aaa_ki_defs bypassing file ${file}"
415 continue
417 fi # end of select 'if'
418 ;; # case end for file name test
419 esac
423 # Fix 5: Aaa_Bad_Fixes
425 case "${file}" in ./sundev/ipi_error.h )
426 echo "aaa_bad_fixes bypassing file ${file}"
427 continue
429 ;; # case end for file name test
430 esac
434 # Fix 6: Aaa_Time
436 case "${file}" in ./sys/time.h )
437 if ( test -n "`egrep '11.0 and later representation of ki time' ${file}`"
438 ) > /dev/null 2>&1 ; then
439 echo "aaa_time bypassing file ${file}"
440 continue
442 fi # end of select 'if'
443 ;; # case end for file name test
444 esac
448 # Fix 7: Aab_Dgux_Int_Varargs
450 case "${file}" in ./_int_varargs.h )
451 echo "aab_dgux_int_varargs replacing file ${file}" >&2
452 cat > ${DESTFILE} << '_EOF_'
453 #ifndef __INT_VARARGS_H
454 #define __INT_VARARGS_H
456 /************************************************************************/
457 /* _INT_VARARGS.H - Define the common stuff for varargs/stdarg/stdio. */
458 /************************************************************************/
461 ** This file is a DG internal header. Never include this
462 ** file directly.
465 #ifndef ___int_features_h
466 #include &lt;sys/_int_features.h&gt;
467 #endif
469 #if !(defined(_VA_LIST) || defined(_VA_LIST_))
470 #define _VA_LIST
471 #define _VA_LIST_
473 #ifdef __LINT__
475 #ifdef __STDC__
476 typedef void * va_list;
477 #else
478 typedef char * va_list;
479 #endif
481 #else
482 #if _M88K_ANY
484 #if defined(__DCC__)
486 typedef struct {
487 int next_arg;
488 int *mem_ptr;
489 int *reg_ptr;
490 } va_list;
492 #else /* ! defined(__DCC__) */
494 typedef struct {
495 int __va_arg; /* argument number */
496 int *__va_stk; /* start of args passed on stack */
497 int *__va_reg; /* start of args passed in regs */
498 } va_list;
500 #endif /* ! defined(__DCC__) */
502 #elif _IX86_ANY
504 #if defined(__GNUC__) || defined(__STDC__)
505 typedef void * va_list;
506 #else
507 typedef char * va_list;
508 #endif
510 #endif /* _IX86_ANY */
512 #endif /* __LINT__ */
513 #endif /* !(defined(_VA_LIST) || defined(_VA_LIST_)) */
514 #endif /* #ifndef __INT_VARARGS_H */
516 _EOF_
517 continue
519 ;; # case end for file name test
520 esac
524 # Fix 8: Aix_Syswait
526 case "${file}" in ./sys/wait.h )
527 if ( test -n "`egrep 'bos325,' ${file}`"
528 ) > /dev/null 2>&1 ; then
529 fixlist="${fixlist}
530 aix_syswait"
531 if [ ! -r ${DESTFILE} ]
532 then infile=${file}
533 else infile=${DESTFILE} ; fi
535 sed -e '/^extern pid_t wait3();$/i\
536 struct rusage;
538 < $infile > ${DESTDIR}/fixinc.tmp
539 rm -f ${DESTFILE}
540 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
541 fi # end of select 'if'
542 ;; # case end for file name test
543 esac
547 # Fix 9: Aix_Volatile
549 case "${file}" in ./sys/signal.h )
550 if ( test -n "`egrep 'typedef volatile int sig_atomic_t' ${file}`"
551 ) > /dev/null 2>&1 ; then
552 fixlist="${fixlist}
553 aix_volatile"
554 if [ ! -r ${DESTFILE} ]
555 then infile=${file}
556 else infile=${DESTFILE} ; fi
558 sed -e 's/typedef volatile int sig_atomic_t/typedef int sig_atomic_t/' \
559 < $infile > ${DESTDIR}/fixinc.tmp
560 rm -f ${DESTFILE}
561 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
562 fi # end of select 'if'
563 ;; # case end for file name test
564 esac
568 # Fix 10: Alpha_Getopt
570 case "${file}" in ./stdio.h | \
571 ./stdlib.h )
572 if ( test -n "`egrep 'getopt\\(int, char \\*\\[' ${file}`"
573 ) > /dev/null 2>&1 ; then
574 fixlist="${fixlist}
575 alpha_getopt"
576 if [ ! -r ${DESTFILE} ]
577 then infile=${file}
578 else infile=${DESTFILE} ; fi
580 sed -e 's/getopt(int, char \*\[\],[ ]*char \*)/getopt(int, char *const[], const char *)/' \
581 < $infile > ${DESTDIR}/fixinc.tmp
582 rm -f ${DESTFILE}
583 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
584 fi # end of select 'if'
585 ;; # case end for file name test
586 esac
590 # Fix 11: Alpha_Parens
592 case "${file}" in ./sym.h )
593 if ( test -n "`egrep '#ifndef\\(__mips64\\)' ${file}`"
594 ) > /dev/null 2>&1 ; then
595 fixlist="${fixlist}
596 alpha_parens"
597 if [ ! -r ${DESTFILE} ]
598 then infile=${file}
599 else infile=${DESTFILE} ; fi
601 sed -e 's/#ifndef(__mips64)/#ifndef __mips64/' \
602 < $infile > ${DESTDIR}/fixinc.tmp
603 rm -f ${DESTFILE}
604 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
605 fi # end of select 'if'
606 ;; # case end for file name test
607 esac
611 # Fix 12: Alpha_Sbrk
613 case "${file}" in ./unistd.h )
614 if ( test -n "`egrep 'char[ ]*\\*[ ]*sbrk[ ]*\\(' ${file}`"
615 ) > /dev/null 2>&1 ; then
616 fixlist="${fixlist}
617 alpha_sbrk"
618 if [ ! -r ${DESTFILE} ]
619 then infile=${file}
620 else infile=${DESTFILE} ; fi
622 sed -e 's/char\([ ]*\*[ ]*sbrk[ ]*(\)/void\1/' \
623 < $infile > ${DESTDIR}/fixinc.tmp
624 rm -f ${DESTFILE}
625 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
626 fi # end of select 'if'
627 ;; # case end for file name test
628 esac
632 # Fix 13: Arm_Norcroft_Hint
634 case "${file}" in ./X11/Intrinsic.h )
635 if ( test -n "`egrep '___type p_type' ${file}`"
636 ) > /dev/null 2>&1 ; then
637 fixlist="${fixlist}
638 arm_norcroft_hint"
639 if [ ! -r ${DESTFILE} ]
640 then infile=${file}
641 else infile=${DESTFILE} ; fi
643 sed -e 's/___type p_type/p_type/' \
644 < $infile > ${DESTDIR}/fixinc.tmp
645 rm -f ${DESTFILE}
646 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
647 fi # end of select 'if'
648 ;; # case end for file name test
649 esac
653 # Fix 14: Arm_Wchar
655 case "${file}" in ./stdlib.h )
656 if ( test -n "`egrep '#[ ]*define[ ]*__wchar_t' ${file}`"
657 ) > /dev/null 2>&1 ; then
658 fixlist="${fixlist}
659 arm_wchar"
660 if [ ! -r ${DESTFILE} ]
661 then infile=${file}
662 else infile=${DESTFILE} ; fi
664 sed -e 's/\(#[ ]*ifndef[ ]*\)__wchar_t/\1_GCC_WCHAR_T/' \
665 -e 's/\(#[ ]*define[ ]*\)__wchar_t/\1_GCC_WCHAR_T/' \
666 < $infile > ${DESTDIR}/fixinc.tmp
667 rm -f ${DESTFILE}
668 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
669 fi # end of select 'if'
670 ;; # case end for file name test
671 esac
675 # Fix 15: Aux_Asm
677 case "${file}" in ./sys/param.h )
678 if ( test -n "`egrep '#ifndef NOINLINE' ${file}`"
679 ) > /dev/null 2>&1 ; then
680 fixlist="${fixlist}
681 aux_asm"
682 if [ ! -r ${DESTFILE} ]
683 then infile=${file}
684 else infile=${DESTFILE} ; fi
686 sed -e 's|#ifndef NOINLINE|#if !defined(NOINLINE) \&\& !defined(__GNUC__)|' \
687 < $infile > ${DESTDIR}/fixinc.tmp
688 rm -f ${DESTFILE}
689 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
690 fi # end of select 'if'
691 ;; # case end for file name test
692 esac
696 # Fix 16: Avoid_Bool
698 case "${file}" in ./curses.h | \
699 ./curses_colr/curses.h | \
700 ./term.h | \
701 ./tinfo.h )
702 fixlist="${fixlist}
703 avoid_bool"
704 if [ ! -r ${DESTFILE} ]
705 then infile=${file}
706 else infile=${DESTFILE} ; fi
708 sed -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/i\
709 #ifndef __cplusplus
711 -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/a\
712 #endif
714 -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/i\
715 #ifndef __cplusplus
717 -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/a\
718 #endif
720 -e '/^[ ]*typedef[ ][ ]*unsigned char[ ][ ]*bool[ ]*;/i\
721 #ifndef __cplusplus
723 -e '/^[ ]*typedef[ ][ ]*unsigned char[ ][ ]*bool[ ]*;/a\
724 #endif
726 -e '/^typedef[ ][ ]*int[ ][ ]*bool[ ]*;/i\
727 #ifndef __cplusplus
729 -e '/^typedef[ ][ ]*int[ ][ ]*bool[ ]*;/a\
730 #endif
732 -e '/^[ ]*typedef[ ][ ]*unsigned int[ ][ ]*bool[ ]*;/i\
733 #ifndef __cplusplus
735 -e '/^[ ]*typedef[ ][ ]*unsigned int[ ][ ]*bool[ ]*;/a\
736 #endif
738 < $infile > ${DESTDIR}/fixinc.tmp
739 rm -f ${DESTFILE}
740 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
741 ;; # case end for file name test
742 esac
746 # Fix 17: Bad_Struct_Term
748 case "${file}" in ./curses.h )
749 if ( test -n "`egrep '^[ ]*typedef[ ]+struct[ ]+term[ ]*;' ${file}`"
750 ) > /dev/null 2>&1 ; then
751 fixlist="${fixlist}
752 bad_struct_term"
753 if [ ! -r ${DESTFILE} ]
754 then infile=${file}
755 else infile=${DESTFILE} ; fi
757 sed -e 's/^[ ]*typedef[ ][ ]*\(struct[ ][ ]*term[ ]*;[ ]*\)$/\1/' \
758 < $infile > ${DESTDIR}/fixinc.tmp
759 rm -f ${DESTFILE}
760 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
761 fi # end of select 'if'
762 ;; # case end for file name test
763 esac
767 # Fix 18: Badquote
769 case "${file}" in ./sundev/vuid_event.h )
770 fixlist="${fixlist}
771 badquote"
772 if [ ! -r ${DESTFILE} ]
773 then infile=${file}
774 else infile=${DESTFILE} ; fi
776 sed -e 's/doesn'\''t/does not/' \
777 < $infile > ${DESTDIR}/fixinc.tmp
778 rm -f ${DESTFILE}
779 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
780 ;; # case end for file name test
781 esac
785 # Fix 19: Bad_Lval
787 case "${file}" in ./libgen.h | \
788 ./dirent.h | \
789 ./ftw.h | \
790 ./grp.h | \
791 ./ndbm.h | \
792 ./pthread.h | \
793 ./pwd.h | \
794 ./signal.h | \
795 ./standards.h | \
796 ./stdlib.h | \
797 ./string.h | \
798 ./stropts.h | \
799 ./time.h | \
800 ./unistd.h )
801 fixlist="${fixlist}
802 bad_lval"
803 if [ ! -r ${DESTFILE} ]
804 then infile=${file}
805 else infile=${DESTFILE} ; fi
807 sed -e 's/^[ ]*#[ ]*define[ ]*\([^(]*\)\(([^)]*)\)[ ]*\(_.\)\1\2[ ]*$/#define \1 \3\1/' \
808 < $infile > ${DESTDIR}/fixinc.tmp
809 rm -f ${DESTFILE}
810 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
811 ;; # case end for file name test
812 esac
816 # Fix 20: Broken_Assert_Stdio
818 case "${file}" in ./assert.h )
819 if ( test -n "`egrep 'stderr' ${file}`"
820 ) > /dev/null 2>&1 ; then
821 if ( test -a \
822 -z "`egrep 'include.*stdio.h' ${file}`"
823 ) > /dev/null 2>&1 ; then
824 fixlist="${fixlist}
825 broken_assert_stdio"
826 if [ ! -r ${DESTFILE} ]
827 then infile=${file}
828 else infile=${DESTFILE} ; fi
830 sed -e '1i\
831 #include <stdio.h>
833 < $infile > ${DESTDIR}/fixinc.tmp
834 rm -f ${DESTFILE}
835 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
836 fi # end of bypass 'if'
837 fi # end of select 'if'
838 ;; # case end for file name test
839 esac
843 # Fix 21: Broken_Assert_Stdlib
845 case "${file}" in ./assert.h )
846 if ( test -n "`egrep 'exit *\\(|abort *\\(' ${file}`"
847 ) > /dev/null 2>&1 ; then
848 if ( test -a \
849 -z "`egrep 'include.*stdlib.h' ${file}`"
850 ) > /dev/null 2>&1 ; then
851 fixlist="${fixlist}
852 broken_assert_stdlib"
853 if [ ! -r ${DESTFILE} ]
854 then infile=${file}
855 else infile=${DESTFILE} ; fi
857 sed -e '1i\
858 #ifdef __cplusplus\
859 #include <stdlib.h>\
860 #endif
862 < $infile > ${DESTDIR}/fixinc.tmp
863 rm -f ${DESTFILE}
864 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
865 fi # end of bypass 'if'
866 fi # end of select 'if'
867 ;; # case end for file name test
868 esac
872 # Fix 22: Bsd43_Io_Macros
874 if ( test -n "`egrep 'BSD43__IO' ${file}`"
875 ) > /dev/null 2>&1 ; then
876 fixlist="${fixlist}
877 bsd43_io_macros"
878 if [ ! -r ${DESTFILE} ]
879 then infile=${file}
880 else infile=${DESTFILE} ; fi
882 sed -e '/[ ]BSD43__IO[A-Z]*[ ]*(/s/(\(.\),/('\''\1'\'',/' \
883 -e '/#[ ]*define[ ]*[ ]BSD43__IO/s/'\''\([cgx]\)'\''/\1/g' \
884 < $infile > ${DESTDIR}/fixinc.tmp
885 rm -f ${DESTFILE}
886 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
887 fi # end of select 'if'
891 # Fix 23: Dec_Intern_Asm
893 case "${file}" in ./c_asm.h )
894 fixlist="${fixlist}
895 dec_intern_asm"
896 if [ ! -r ${DESTFILE} ]
897 then infile=${file}
898 else infile=${DESTFILE} ; fi
900 sed -e '/^[ ]*float[ ]*fasm/i\
901 #ifdef __DECC
903 -e '/^[ ]*#[ ]*pragma[ ]*intrinsic([ ]*dasm/a\
904 #endif
906 < $infile > ${DESTDIR}/fixinc.tmp
907 rm -f ${DESTFILE}
908 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
909 ;; # case end for file name test
910 esac
914 # Fix 24: No_Double_Slash
916 if ${FIXTESTS} ${file} double_slash
917 then
918 fixlist="${fixlist}
919 no_double_slash"
920 if [ ! -r ${DESTFILE} ]
921 then infile=${file}
922 else infile=${DESTFILE} ; fi
923 ${FIXFIXES} ${file} no_double_slash < $infile > ${DESTDIR}/fixinc.tmp
924 rm -f ${DESTFILE}
925 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
926 fi # end of c_test 'if'
930 # Fix 25: Ecd_Cursor
932 case "${file}" in ./sunwindow/win_lock.h | \
933 ./sunwindow/win_cursor.h )
934 fixlist="${fixlist}
935 ecd_cursor"
936 if [ ! -r ${DESTFILE} ]
937 then infile=${file}
938 else infile=${DESTFILE} ; fi
940 sed -e 's/ecd.cursor/ecd_cursor/' \
941 < $infile > ${DESTDIR}/fixinc.tmp
942 rm -f ${DESTFILE}
943 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
944 ;; # case end for file name test
945 esac
949 # Fix 26: Sco5_Stat_Wrappers
951 case "${file}" in ./sys/stat.h )
952 case "$target_canonical" in i*86-*-sco3.2v5* )
953 fixlist="${fixlist}
954 sco5_stat_wrappers"
955 if [ ! -r ${DESTFILE} ]
956 then infile=${file}
957 else infile=${DESTFILE} ; fi
959 sed -e '/^static int[ ]*[a-z]*stat(/i\
960 #ifdef __cplusplus\
961 extern "C"\
963 #endif\
965 -e '/^}$/a\
966 #ifdef __cplusplus\
968 #endif /* __cplusplus */\
970 < $infile > ${DESTDIR}/fixinc.tmp
971 rm -f ${DESTFILE}
972 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
973 ;; # case end for machine type test
974 esac
975 ;; # case end for file name test
976 esac
980 # Fix 27: End_Else_Label
982 if ${FIXTESTS} ${file} else_endif_label
983 then
984 fixlist="${fixlist}
985 end_else_label"
986 if [ ! -r ${DESTFILE} ]
987 then infile=${file}
988 else infile=${DESTFILE} ; fi
989 ${FIXFIXES} ${file} else_endif_label < $infile > ${DESTDIR}/fixinc.tmp
990 rm -f ${DESTFILE}
991 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
992 fi # end of c_test 'if'
996 # Fix 28: Hp_Inline
998 case "${file}" in ./sys/spinlock.h )
999 if ( test -n "`egrep 'include.*\"\\.\\./machine/' ${file}`"
1000 ) > /dev/null 2>&1 ; then
1001 fixlist="${fixlist}
1002 hp_inline"
1003 if [ ! -r ${DESTFILE} ]
1004 then infile=${file}
1005 else infile=${DESTFILE} ; fi
1007 sed -e 's,"../machine/inline.h",<machine/inline.h>,' \
1008 -e 's,"../machine/psl.h",<machine/psl.h>,' \
1009 < $infile > ${DESTDIR}/fixinc.tmp
1010 rm -f ${DESTFILE}
1011 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1012 fi # end of select 'if'
1013 ;; # case end for file name test
1014 esac
1018 # Fix 29: Hp_Sysfile
1020 case "${file}" in ./sys/file.h )
1021 if ( test -n "`egrep 'HPUX_SOURCE' ${file}`"
1022 ) > /dev/null 2>&1 ; then
1023 fixlist="${fixlist}
1024 hp_sysfile"
1025 if [ ! -r ${DESTFILE} ]
1026 then infile=${file}
1027 else infile=${DESTFILE} ; fi
1029 sed -e 's/(\.\.\.)/(struct file * ...)/' \
1030 < $infile > ${DESTDIR}/fixinc.tmp
1031 rm -f ${DESTFILE}
1032 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1033 fi # end of select 'if'
1034 ;; # case end for file name test
1035 esac
1039 # Fix 30: Cxx_Unready
1041 case "${file}" in ./sys/mman.h | \
1042 ./rpc/types.h )
1043 if ( test -a \
1044 -z "`egrep '\"C\"|__BEGIN_DECLS' ${file}`"
1045 ) > /dev/null 2>&1 ; then
1046 fixlist="${fixlist}
1047 cxx_unready"
1048 if [ ! -r ${DESTFILE} ]
1049 then infile=${file}
1050 else infile=${DESTFILE} ; fi
1052 sed -e '1i\
1053 #ifdef __cplusplus\
1054 extern "C" {\
1055 #endif\
1058 -e '$a\
1059 #ifdef __cplusplus\
1061 #endif
1063 < $infile > ${DESTDIR}/fixinc.tmp
1064 rm -f ${DESTFILE}
1065 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1066 fi # end of bypass 'if'
1067 ;; # case end for file name test
1068 esac
1072 # Fix 31: Hpux_Maxint
1074 case "${file}" in ./sys/param.h )
1075 fixlist="${fixlist}
1076 hpux_maxint"
1077 if [ ! -r ${DESTFILE} ]
1078 then infile=${file}
1079 else infile=${DESTFILE} ; fi
1081 sed -e '/^#[ ]*define[ ]*MAXINT[ ]/i\
1082 #ifndef MAXINT
1084 -e '/^#[ ]*define[ ]*MAXINT[ ]/a\
1085 #endif
1087 < $infile > ${DESTDIR}/fixinc.tmp
1088 rm -f ${DESTFILE}
1089 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1090 ;; # case end for file name test
1091 esac
1095 # Fix 32: Hpux_Systime
1097 case "${file}" in ./sys/time.h )
1098 if ( test -n "`egrep '^extern struct sigevent;' ${file}`"
1099 ) > /dev/null 2>&1 ; then
1100 fixlist="${fixlist}
1101 hpux_systime"
1102 if [ ! -r ${DESTFILE} ]
1103 then infile=${file}
1104 else infile=${DESTFILE} ; fi
1106 sed -e 's/^extern struct sigevent;/struct sigevent;/' \
1107 < $infile > ${DESTDIR}/fixinc.tmp
1108 rm -f ${DESTFILE}
1109 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1110 fi # end of select 'if'
1111 ;; # case end for file name test
1112 esac
1116 # Fix 33: Hpux11_Uint32_C
1118 case "${file}" in ./inttypes.h )
1119 if ( test -n "`egrep '^#define UINT32_C\\(__c\\)[ ]*__CONCAT__\\(__CONCAT_U__\\(__c\\),l\\)' ${file}`"
1120 ) > /dev/null 2>&1 ; then
1121 fixlist="${fixlist}
1122 hpux11_uint32_c"
1123 if [ ! -r ${DESTFILE} ]
1124 then infile=${file}
1125 else infile=${DESTFILE} ; fi
1127 sed -e 's/^#define UINT32_C(__c)\([ ]*\)__CONCAT__(__CONCAT_U__(__c),l)/#define UINT32_C(__c)\1__CONCAT__(__c,ul)/' \
1128 < $infile > ${DESTDIR}/fixinc.tmp
1129 rm -f ${DESTFILE}
1130 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1131 fi # end of select 'if'
1132 ;; # case end for file name test
1133 esac
1137 # Fix 34: Interactv_Add1
1139 case "${file}" in ./stdio.h | \
1140 ./math.h | \
1141 ./ctype.h | \
1142 ./sys/limits.h | \
1143 ./sys/fcntl.h | \
1144 ./sys/dirent.h )
1145 if ( test '(' -d /etc/conf/kconfig.d ')' -a \
1146 '(' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`" ')'
1147 ) > /dev/null 2>&1 ; then
1148 fixlist="${fixlist}
1149 interactv_add1"
1150 if [ ! -r ${DESTFILE} ]
1151 then infile=${file}
1152 else infile=${DESTFILE} ; fi
1154 sed -e 's/!defined(__STDC__) && !defined(_POSIX_SOURCE)/!defined(_POSIX_SOURCE)/' \
1155 < $infile > ${DESTDIR}/fixinc.tmp
1156 rm -f ${DESTFILE}
1157 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1158 fi # end of test expression 'if'
1159 ;; # case end for file name test
1160 esac
1164 # Fix 35: Interactv_Add2
1166 case "${file}" in ./math.h )
1167 if ( test '(' -d /etc/conf/kconfig.d ')' -a \
1168 '(' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`" ')'
1169 ) > /dev/null 2>&1 ; then
1170 fixlist="${fixlist}
1171 interactv_add2"
1172 if [ ! -r ${DESTFILE} ]
1173 then infile=${file}
1174 else infile=${DESTFILE} ; fi
1176 sed -e 's/fmod(double)/fmod(double, double)/' \
1177 < $infile > ${DESTDIR}/fixinc.tmp
1178 rm -f ${DESTFILE}
1179 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1180 fi # end of test expression 'if'
1181 ;; # case end for file name test
1182 esac
1186 # Fix 36: Interactv_Add3
1188 case "${file}" in ./sys/limits.h )
1189 if ( test '(' -d /etc/conf/kconfig.d ')' -a \
1190 '(' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`" ')'
1191 ) > /dev/null 2>&1 ; then
1192 fixlist="${fixlist}
1193 interactv_add3"
1194 if [ ! -r ${DESTFILE} ]
1195 then infile=${file}
1196 else infile=${DESTFILE} ; fi
1198 sed -e '/CHILD_MAX/s,/\* Max, Max,' \
1199 -e '/OPEN_MAX/s,/\* Max, Max,' \
1200 < $infile > ${DESTDIR}/fixinc.tmp
1201 rm -f ${DESTFILE}
1202 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1203 fi # end of test expression 'if'
1204 ;; # case end for file name test
1205 esac
1209 # Fix 37: Io_Def_Quotes
1211 if ( test -n "`egrep '[ ]*[ ](_|DES)IO[A-Z]*[ ]*\\( *[^,'\\'']' ${file}`"
1212 ) > /dev/null 2>&1 ; then
1213 fixlist="${fixlist}
1214 io_def_quotes"
1215 if [ ! -r ${DESTFILE} ]
1216 then infile=${file}
1217 else infile=${DESTFILE} ; fi
1219 sed -e 's/\([ ]*[ ]_IO[A-Z]*[ ]*(\)\([^,'\'']\),/\1'\''\2'\'',/' \
1220 -e 's/\([ ]*[ ]DESIO[A-Z]*[ ]*(\)\([^,'\'']\),/\1'\''\2'\'',/' \
1221 -e '/#[ ]*define[ ]*[ ]_IO/s/'\''\([cgxtf]\)'\''/\1/g' \
1222 -e '/#[ ]*define[ ]*[ ]DESIOC/s/'\''\([cdgx]\)'\''/\1/g' \
1223 < $infile > ${DESTDIR}/fixinc.tmp
1224 rm -f ${DESTFILE}
1225 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1226 fi # end of select 'if'
1230 # Fix 38: Ioctl_Fix_Ctrl
1232 if ( test -n "`egrep 'CTRL[ ]*\\(' ${file}`"
1233 ) > /dev/null 2>&1 ; then
1234 fixlist="${fixlist}
1235 ioctl_fix_ctrl"
1236 if [ ! -r ${DESTFILE} ]
1237 then infile=${file}
1238 else infile=${DESTFILE} ; fi
1240 sed -e '/[^A-Z0-9_]CTRL[ ]*(/s/\([^'\'']\))/'\''\1'\'')/' \
1241 -e '/[^A-Z0-9]_CTRL[ ]*(/s/\([^'\'']\))/'\''\1'\'')/' \
1242 -e '/#[ ]*define[ ]*[ ]CTRL/s/'\''\([cgx]\)'\''/\1/g' \
1243 -e '/#[ ]*define[ ]*[ ]_CTRL/s/'\''\([cgx]\)'\''/\1/g' \
1244 -e '/#[ ]*define[ ]*[ ]BSD43_CTRL/s/'\''\([cgx]\)'\''/\1/g' \
1245 -e '/#[ ]*define[ ]*[ ][_]*ISCTRL/s/'\''\([cgx]\)'\''/\1/g' \
1246 < $infile > ${DESTDIR}/fixinc.tmp
1247 rm -f ${DESTFILE}
1248 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1249 fi # end of select 'if'
1253 # Fix 39: Ip_Missing_Semi
1255 case "${file}" in ./netinet/ip.h )
1256 fixlist="${fixlist}
1257 ip_missing_semi"
1258 if [ ! -r ${DESTFILE} ]
1259 then infile=${file}
1260 else infile=${DESTFILE} ; fi
1262 sed -e '/^struct/,/^};/s/}$/};/' \
1263 < $infile > ${DESTDIR}/fixinc.tmp
1264 rm -f ${DESTFILE}
1265 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1266 ;; # case end for file name test
1267 esac
1271 # Fix 40: Irix_Multiline_Cmnt
1273 case "${file}" in ./sys/types.h )
1274 fixlist="${fixlist}
1275 irix_multiline_cmnt"
1276 if [ ! -r ${DESTFILE} ]
1277 then infile=${file}
1278 else infile=${DESTFILE} ; fi
1280 sed -e 's@type of the result@type of the result */@' \
1281 -e 's@of the sizeof@/* of the sizeof@' \
1282 < $infile > ${DESTDIR}/fixinc.tmp
1283 rm -f ${DESTFILE}
1284 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1285 ;; # case end for file name test
1286 esac
1290 # Fix 41: Irix_Sockaddr
1292 case "${file}" in ./rpc/auth.h )
1293 if ( test -n "`egrep 'authdes_create.*struct sockaddr' ${file}`"
1294 ) > /dev/null 2>&1 ; then
1295 fixlist="${fixlist}
1296 irix_sockaddr"
1297 if [ ! -r ${DESTFILE} ]
1298 then infile=${file}
1299 else infile=${DESTFILE} ; fi
1301 sed -e '/authdes_create.*struct sockaddr/i\
1302 struct sockaddr;
1304 < $infile > ${DESTDIR}/fixinc.tmp
1305 rm -f ${DESTFILE}
1306 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1307 fi # end of select 'if'
1308 ;; # case end for file name test
1309 esac
1313 # Fix 42: Irix_Struct__File
1315 case "${file}" in ./rpc/xdr.h )
1316 fixlist="${fixlist}
1317 irix_struct__file"
1318 if [ ! -r ${DESTFILE} ]
1319 then infile=${file}
1320 else infile=${DESTFILE} ; fi
1322 sed -e '/xdrstdio_create.*struct __file_s/i\
1323 struct __file_s;
1325 < $infile > ${DESTDIR}/fixinc.tmp
1326 rm -f ${DESTFILE}
1327 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1328 ;; # case end for file name test
1329 esac
1333 # Fix 43: Irix_Asm_Apostrophe
1335 case "${file}" in ./sys/asm.h )
1336 if ( test -n "`egrep '^[ ]*#.*[Ww]e'\\''re' ${file}`"
1337 ) > /dev/null 2>&1 ; then
1338 fixlist="${fixlist}
1339 irix_asm_apostrophe"
1340 if [ ! -r ${DESTFILE} ]
1341 then infile=${file}
1342 else infile=${DESTFILE} ; fi
1344 sed -e '/^[ ]*#/s/\([Ww]e\)'\''re/\1 are/' \
1345 < $infile > ${DESTDIR}/fixinc.tmp
1346 rm -f ${DESTFILE}
1347 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1348 fi # end of select 'if'
1349 ;; # case end for file name test
1350 esac
1354 # Fix 44: Isc_Fmod
1356 case "${file}" in ./math.h )
1357 if ( test -n "`egrep 'fmod\\(double\\)' ${file}`"
1358 ) > /dev/null 2>&1 ; then
1359 fixlist="${fixlist}
1360 isc_fmod"
1361 if [ ! -r ${DESTFILE} ]
1362 then infile=${file}
1363 else infile=${DESTFILE} ; fi
1365 sed -e 's/fmod(double)/fmod(double, double)/' \
1366 < $infile > ${DESTDIR}/fixinc.tmp
1367 rm -f ${DESTFILE}
1368 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1369 fi # end of select 'if'
1370 ;; # case end for file name test
1371 esac
1375 # Fix 45: Motorola_Nested
1377 case "${file}" in ./limits.h | \
1378 ./sys/limits.h )
1379 case "$target_canonical" in m68k-motorola-sysv* )
1380 fixlist="${fixlist}
1381 motorola_nested"
1382 if [ ! -r ${DESTFILE} ]
1383 then infile=${file}
1384 else infile=${DESTFILE} ; fi
1386 sed -e 's@^\(#undef[ ][ ]*PIPE_BUF[ ]*/\* max # bytes atomic in write to a\)$@\1 */@' \
1387 -e 's@\(/\*#define HUGE_VAL 3.40282346638528860e+38 \)\(/\*error value returned by Math lib\*/\)$@\1*/ \2@' \
1388 < $infile > ${DESTDIR}/fixinc.tmp
1389 rm -f ${DESTFILE}
1390 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1391 ;; # case end for machine type test
1392 esac
1393 ;; # case end for file name test
1394 esac
1398 # Fix 46: Isc_Sys_Limits
1400 case "${file}" in ./sys/limits.h )
1401 if ( test -n "`egrep 'CHILD_MAX' ${file}`"
1402 ) > /dev/null 2>&1 ; then
1403 fixlist="${fixlist}
1404 isc_sys_limits"
1405 if [ ! -r ${DESTFILE} ]
1406 then infile=${file}
1407 else infile=${DESTFILE} ; fi
1409 sed -e '/CHILD_MAX/s,/\* Max, Max,' \
1410 -e '/OPEN_MAX/s,/\* Max, Max,' \
1411 < $infile > ${DESTDIR}/fixinc.tmp
1412 rm -f ${DESTFILE}
1413 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1414 fi # end of select 'if'
1415 ;; # case end for file name test
1416 esac
1420 # Fix 47: Kandr_Concat
1422 case "${file}" in ./sparc/asm_linkage.h | \
1423 ./sun3/asm_linkage.h | \
1424 ./sun3x/asm_linkage.h | \
1425 ./sun4/asm_linkage.h | \
1426 ./sun4c/asm_linkage.h | \
1427 ./sun4m/asm_linkage.h | \
1428 ./sun4c/debug/asm_linkage.h | \
1429 ./sun4m/debug/asm_linkage.h | \
1430 ./arm/as_support.h | \
1431 ./arm/mc_type.h | \
1432 ./arm/xcb.h | \
1433 ./dev/chardefmac.h | \
1434 ./dev/ps_irq.h | \
1435 ./dev/screen.h | \
1436 ./dev/scsi.h | \
1437 ./sys/tty.h | \
1438 ./Xm.acorn/XmP.h | \
1439 ./bsd43/bsd43_.h )
1440 if ( test -n "`egrep '/\\*\\*/' ${file}`"
1441 ) > /dev/null 2>&1 ; then
1442 fixlist="${fixlist}
1443 kandr_concat"
1444 if [ ! -r ${DESTFILE} ]
1445 then infile=${file}
1446 else infile=${DESTFILE} ; fi
1448 sed -e 's|/\*\*/|##|g' \
1449 < $infile > ${DESTDIR}/fixinc.tmp
1450 rm -f ${DESTFILE}
1451 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1452 fi # end of select 'if'
1453 ;; # case end for file name test
1454 esac
1458 # Fix 48: Limits_Ifndefs
1460 case "${file}" in ./limits.h | \
1461 ./sys/limits.h )
1462 if ( test -a \
1463 -z "`egrep 'ifndef[ ]+FLT_MIN' ${file}`"
1464 ) > /dev/null 2>&1 ; then
1465 fixlist="${fixlist}
1466 limits_ifndefs"
1467 if [ ! -r ${DESTFILE} ]
1468 then infile=${file}
1469 else infile=${DESTFILE} ; fi
1471 sed -e '/[ ]FLT_MIN[ ]/i\
1472 #ifndef FLT_MIN
1474 -e '/[ ]FLT_MIN[ ]/a\
1475 #endif
1477 -e '/[ ]FLT_MAX[ ]/i\
1478 #ifndef FLT_MAX
1480 -e '/[ ]FLT_MAX[ ]/a\
1481 #endif
1483 -e '/[ ]FLT_DIG[ ]/i\
1484 #ifndef FLT_DIG
1486 -e '/[ ]FLT_DIG[ ]/a\
1487 #endif
1489 -e '/[ ]DBL_MIN[ ]/i\
1490 #ifndef DBL_MIN
1492 -e '/[ ]DBL_MIN[ ]/a\
1493 #endif
1495 -e '/[ ]DBL_MAX[ ]/i\
1496 #ifndef DBL_MAX
1498 -e '/[ ]DBL_MAX[ ]/a\
1499 #endif
1501 -e '/[ ]DBL_DIG[ ]/i\
1502 #ifndef DBL_DIG
1504 -e '/[ ]DBL_DIG[ ]/a\
1505 #endif
1507 -e '/^\(\/\*#define HUGE_VAL 3\.[0-9e+]* *\)\/\*/s//\1/' \
1508 < $infile > ${DESTDIR}/fixinc.tmp
1509 rm -f ${DESTFILE}
1510 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1511 fi # end of bypass 'if'
1512 ;; # case end for file name test
1513 esac
1517 # Fix 49: Lynx_Void_Int
1519 case "${file}" in ./curses.h )
1520 if ( test -n "`egrep '#[ ]*define[ ]+void[ ]+int' ${file}`"
1521 ) > /dev/null 2>&1 ; then
1522 fixlist="${fixlist}
1523 lynx_void_int"
1524 if [ ! -r ${DESTFILE} ]
1525 then infile=${file}
1526 else infile=${DESTFILE} ; fi
1528 sed -e '/#[ ]*define[ ][ ]*void[ ]int/d' \
1529 < $infile > ${DESTDIR}/fixinc.tmp
1530 rm -f ${DESTFILE}
1531 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1532 fi # end of select 'if'
1533 ;; # case end for file name test
1534 esac
1538 # Fix 50: Lynxos_Fcntl_Proto
1540 case "${file}" in ./fcntl.h )
1541 if ( test -n "`egrep 'fcntl.*\\(int, int, int\\)' ${file}`"
1542 ) > /dev/null 2>&1 ; then
1543 fixlist="${fixlist}
1544 lynxos_fcntl_proto"
1545 if [ ! -r ${DESTFILE} ]
1546 then infile=${file}
1547 else infile=${DESTFILE} ; fi
1549 sed -e 's/\(fcntl.*(int, int, \)int)/\1...)/' \
1550 < $infile > ${DESTDIR}/fixinc.tmp
1551 rm -f ${DESTFILE}
1552 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1553 fi # end of select 'if'
1554 ;; # case end for file name test
1555 esac
1559 # Fix 51: M88k_Bad_Hypot_Opt
1561 case "${file}" in ./math.h )
1562 case "$target_canonical" in m88k-motorola-sysv3* )
1563 fixlist="${fixlist}
1564 m88k_bad_hypot_opt"
1565 if [ ! -r ${DESTFILE} ]
1566 then infile=${file}
1567 else infile=${DESTFILE} ; fi
1569 sed -e 's/extern double floor(), ceil(), fmod(), fabs();/extern double floor(), ceil(), fmod(), fabs _PARAMS((double));/' \
1570 -e '/^extern double hypot();$/a\
1571 \/* Workaround a stupid Motorola optimization if one\
1572 of x or y is 0.0 and the other is negative! *\/\
1573 #ifdef __STDC__\
1574 static __inline__ double fake_hypot (double x, double y)\
1575 #else\
1576 static __inline__ double fake_hypot (x, y)\
1577 double x, y;\
1578 #endif\
1580 return fabs (hypot (x, y));\
1582 #define hypot fake_hypot
1584 < $infile > ${DESTDIR}/fixinc.tmp
1585 rm -f ${DESTFILE}
1586 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1587 ;; # case end for machine type test
1588 esac
1589 ;; # case end for file name test
1590 esac
1594 # Fix 52: M88k_Bad_S_If
1596 case "${file}" in ./sys/stat.h )
1597 case "$target_canonical" in m88k-*-sysv3* )
1598 if ( test -n "`egrep '#define[ ]+S_IS[A-Z]*(m)[ ]' ${file}`"
1599 ) > /dev/null 2>&1 ; then
1600 fixlist="${fixlist}
1601 m88k_bad_s_if"
1602 if [ ! -r ${DESTFILE} ]
1603 then infile=${file}
1604 else infile=${DESTFILE} ; fi
1606 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)/' \
1607 -e 's/^\(#define[ ]*S_IS[A-Z]*(m)\)[ ]*(m[ ]*&[ ]*\(0[0-9]*\)[ ]*)/\1 (((m)\&S_IFMT)==\2)/' \
1608 < $infile > ${DESTDIR}/fixinc.tmp
1609 rm -f ${DESTFILE}
1610 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1611 fi # end of select 'if'
1612 ;; # case end for machine type test
1613 esac
1614 ;; # case end for file name test
1615 esac
1619 # Fix 53: M88k_Multi_Incl
1621 case "${file}" in ./time.h )
1622 case "$target_canonical" in m88k-tektronix-sysv3* )
1623 if ( test -a \
1624 -z "`egrep '#ifndef' ${file}`"
1625 ) > /dev/null 2>&1 ; then
1626 fixlist="${fixlist}
1627 m88k_multi_incl"
1628 if [ ! -r ${DESTFILE} ]
1629 then infile=${file}
1630 else infile=${DESTFILE} ; fi
1631 ( echo Fixing $file, to protect against multiple inclusion. >&2
1632 cpp_wrapper=`echo $file | sed -e 's,\.,_,g' -e 's,/,_,g'`
1633 echo "#ifndef __GCC_GOT_${cpp_wrapper}_"
1634 echo "#define __GCC_GOT_${cpp_wrapper}_"
1636 echo "#endif /* ! __GCC_GOT_${cpp_wrapper}_ */" ) < $infile > ${DESTDIR}/fixinc.tmp
1638 # Shell scripts have the potential of removing the output
1639 # We interpret that to mean the file is not to be altered
1641 if test ! -f ${DESTDIR}/fixinc.tmp
1642 then continue ; fi
1643 rm -f ${DESTFILE}
1644 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1645 fi # end of bypass 'if'
1646 ;; # case end for machine type test
1647 esac
1648 ;; # case end for file name test
1649 esac
1653 # Fix 54: Machine_Name
1655 if ( test -n "`egrep '^#[ ]*(if|elif).*[^a-zA-Z0-9_](_*[MSRrhim]|[Mbimnpstuv])[a-zA-Z0-9_]' ${file}`"
1656 ) > /dev/null 2>&1 ; then
1657 fixlist="${fixlist}
1658 machine_name"
1659 if [ ! -r ${DESTFILE} ]
1660 then infile=${file}
1661 else infile=${DESTFILE} ; fi
1663 sed -e ':loop
1664 /\\$/N
1665 s/\\$/\\+++fixinc_eol+++/
1666 /\\$/b loop
1667 s/\\+++fixinc_eol+++/\\/g
1668 /#[ ]*[el]*if/ {
1669 s/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g
1670 s/ M32 / __M32__ /g
1671 s/ _*MIPSE\([LB]\) / __MIPSE\1__ /g
1672 s/ _*SYSTYPE_\([A-Z0-9]*\) / __SYSTYPE_\1__ /g
1673 s/ _*\([Rr][34]\)000 / __\1000__ /g
1674 s/ _*host_mips / __host_mips__ /g
1675 s/ _*i386 / __i386__ /g
1676 s/ _*mips / __mips__ /g
1677 s/ bsd4\([0-9]\) / __bsd4\1__ /g
1678 s/ is68k / __is68k__ /g
1679 s/ m68k / __m68k__ /g
1680 s/ m88k / __m88k__ /g
1681 s/ mc680\([0-9]\)0 / __mc680\10__ /g
1682 s/ news\([0-9]*\) / __news\1__ /g
1683 s/ ns32000 / __ns32000__ /g
1684 s/ pdp11 / __pdp11__ /g
1685 s/ pyr / __pyr__ /g
1686 s/ sel / __sel__ /g
1687 s/ sony_news / __sony_news__ /g
1688 s/ sparc / __sparc__ /g
1689 s/ sun\([a-z0-9]*\) / __sun\1__ /g
1690 s/ tahoe / __tahoe__ /g
1691 s/ tower\([_0-9]*\) / __tower\1__ /g
1692 s/ u370 / __u370__ /g
1693 s/ u3b\([0-9]*\) / __u3b\1__ /g
1694 s/ unix / __unix__ /g
1695 s/ vax / __vax__ /g
1696 s/ \([a-zA-Z0-9_][a-zA-Z0-9_]*\) /\1/g
1697 }' \
1698 < $infile > ${DESTDIR}/fixinc.tmp
1699 rm -f ${DESTFILE}
1700 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1701 fi # end of select 'if'
1705 # Fix 55: Math_Exception
1707 case "${file}" in ./math.h )
1708 if ( test -n "`egrep 'struct exception' ${file}`"
1709 ) > /dev/null 2>&1 ; then
1710 fixlist="${fixlist}
1711 math_exception"
1712 if [ ! -r ${DESTFILE} ]
1713 then infile=${file}
1714 else infile=${DESTFILE} ; fi
1716 sed -e '/struct exception/i\
1717 #ifdef __cplusplus\
1718 #define exception __math_exception\
1719 #endif
1721 -e '/struct exception/a\
1722 #ifdef __cplusplus\
1723 #undef exception\
1724 #endif
1726 -e '/matherr/i\
1727 #ifdef __cplusplus\
1728 #define exception __math_exception\
1729 #endif
1731 -e '/matherr/a\
1732 #ifdef __cplusplus\
1733 #undef exception\
1734 #endif
1736 < $infile > ${DESTDIR}/fixinc.tmp
1737 rm -f ${DESTFILE}
1738 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1739 fi # end of select 'if'
1740 ;; # case end for file name test
1741 esac
1745 # Fix 56: Math_Gcc_Ifndefs
1747 case "${file}" in ./math.h )
1748 fixlist="${fixlist}
1749 math_gcc_ifndefs"
1750 if [ ! -r ${DESTFILE} ]
1751 then infile=${file}
1752 else infile=${DESTFILE} ; fi
1753 ( dbl_max_def=`egrep 'define[ ]+DBL_MAX[ ]+.*' float.h 2>/dev/null`
1755 if ( test -n "${dbl_max_def}" \
1756 -a -n "`egrep '#define[ ]*HUGE_VAL[ ]+DBL_MAX' $file`" \
1757 -a -z "`egrep '#define[ ]+DBL_MAX[ ]+' $file`"
1758 ) > /dev/null 2>&1
1759 then sed -e '/define[ ]HUGE_VAL[ ]DBL_MAX/s/DBL_MAX/$dbl_max_def/'
1760 else cat ; fi |
1761 sed -e '/define[ ]HUGE_VAL[ ]/i\
1762 #ifndef HUGE_VAL
1763 ' -e '/define[ ]HUGE_VAL[ ]/a\
1764 #endif
1765 ' ) < $infile > ${DESTDIR}/fixinc.tmp
1767 # Shell scripts have the potential of removing the output
1768 # We interpret that to mean the file is not to be altered
1770 if test ! -f ${DESTDIR}/fixinc.tmp
1771 then continue ; fi
1772 rm -f ${DESTFILE}
1773 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1774 ;; # case end for file name test
1775 esac
1779 # Fix 57: Nested_Comment
1781 case "${file}" in ./rpc/rpc.h )
1782 fixlist="${fixlist}
1783 nested_comment"
1784 if [ ! -r ${DESTFILE} ]
1785 then infile=${file}
1786 else infile=${DESTFILE} ; fi
1788 sed -e 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@' \
1789 < $infile > ${DESTDIR}/fixinc.tmp
1790 rm -f ${DESTFILE}
1791 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1792 ;; # case end for file name test
1793 esac
1797 # Fix 58: News_Os_Recursion
1799 case "${file}" in ./stdlib.h )
1800 if ( test -n "`egrep '#include <stdlib.h>' ${file}`"
1801 ) > /dev/null 2>&1 ; then
1802 fixlist="${fixlist}
1803 news_os_recursion"
1804 if [ ! -r ${DESTFILE} ]
1805 then infile=${file}
1806 else infile=${DESTFILE} ; fi
1808 sed -e '/^#include <stdlib.h>/i\
1809 #ifdef BOGUS_RECURSION
1811 -e '/^#include <stdlib.h>/a\
1812 #endif
1814 < $infile > ${DESTDIR}/fixinc.tmp
1815 rm -f ${DESTFILE}
1816 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1817 fi # end of select 'if'
1818 ;; # case end for file name test
1819 esac
1823 # Fix 59: Next_Math_Prefix
1825 case "${file}" in ./ansi/math.h )
1826 if ( test -n "`egrep '^extern.*double.*__const__.*' ${file}`"
1827 ) > /dev/null 2>&1 ; then
1828 fixlist="${fixlist}
1829 next_math_prefix"
1830 if [ ! -r ${DESTFILE} ]
1831 then infile=${file}
1832 else infile=${DESTFILE} ; fi
1834 sed -e '/^extern.*double.*__const__.*sqrt(/s/__const__//' \
1835 -e '/^extern.*double.*__const__.*fabs(/s/__const__//' \
1836 -e '/^extern.*double.*__const__.*cos(/s/__const__//' \
1837 -e '/^extern.*double.*__const__.*hypot(/s/__const__//' \
1838 -e '/^extern.*double.*__const__.*sin(/s/__const__//' \
1839 < $infile > ${DESTDIR}/fixinc.tmp
1840 rm -f ${DESTFILE}
1841 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1842 fi # end of select 'if'
1843 ;; # case end for file name test
1844 esac
1848 # Fix 60: Next_Template
1850 case "${file}" in ./bsd/libc.h )
1851 if ( test -n "`egrep 'template' ${file}`"
1852 ) > /dev/null 2>&1 ; then
1853 fixlist="${fixlist}
1854 next_template"
1855 if [ ! -r ${DESTFILE} ]
1856 then infile=${file}
1857 else infile=${DESTFILE} ; fi
1859 sed -e '/\(.*template\)/s/template//' \
1860 -e '/extern.*volatile.*void.*abort/s/volatile//' \
1861 < $infile > ${DESTDIR}/fixinc.tmp
1862 rm -f ${DESTFILE}
1863 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1864 fi # end of select 'if'
1865 ;; # case end for file name test
1866 esac
1870 # Fix 61: Next_Volitile
1872 case "${file}" in ./ansi/stdlib.h )
1873 if ( test -n "`egrep 'volatile' ${file}`"
1874 ) > /dev/null 2>&1 ; then
1875 fixlist="${fixlist}
1876 next_volitile"
1877 if [ ! -r ${DESTFILE} ]
1878 then infile=${file}
1879 else infile=${DESTFILE} ; fi
1881 sed -e '/extern.*volatile.*void.*exit/s/volatile//' \
1882 -e '/extern.*volatile.*void.*abort/s/volatile//' \
1883 < $infile > ${DESTDIR}/fixinc.tmp
1884 rm -f ${DESTFILE}
1885 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1886 fi # end of select 'if'
1887 ;; # case end for file name test
1888 esac
1892 # Fix 62: Next_Wait_Union
1894 case "${file}" in ./sys/wait.h )
1895 if ( test -n "`egrep 'wait\\(union wait' ${file}`"
1896 ) > /dev/null 2>&1 ; then
1897 fixlist="${fixlist}
1898 next_wait_union"
1899 if [ ! -r ${DESTFILE} ]
1900 then infile=${file}
1901 else infile=${DESTFILE} ; fi
1903 sed -e 's@wait(union wait@wait(void@' \
1904 < $infile > ${DESTDIR}/fixinc.tmp
1905 rm -f ${DESTFILE}
1906 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1907 fi # end of select 'if'
1908 ;; # case end for file name test
1909 esac
1913 # Fix 63: Nodeent_Syntax
1915 case "${file}" in ./netdnet/dnetdb.h )
1916 fixlist="${fixlist}
1917 nodeent_syntax"
1918 if [ ! -r ${DESTFILE} ]
1919 then infile=${file}
1920 else infile=${DESTFILE} ; fi
1922 sed -e 's/char.*na_addr *$/char *na_addr;/' \
1923 < $infile > ${DESTDIR}/fixinc.tmp
1924 rm -f ${DESTFILE}
1925 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1926 ;; # case end for file name test
1927 esac
1931 # Fix 64: Osf_Namespace_A
1933 case "${file}" in ./reg_types.h | \
1934 ./sys/lc_core.h )
1935 if ( test '(' -r reg_types.h ')' -a \
1936 '(' -r sys/lc_core.h ')' -a \
1937 '(' -n "`grep '} regex_t;' reg_types.h`" ')' -a \
1938 '(' -z "`grep __regex_t regex.h`" ')'
1939 ) > /dev/null 2>&1 ; then
1940 fixlist="${fixlist}
1941 osf_namespace_a"
1942 if [ ! -r ${DESTFILE} ]
1943 then infile=${file}
1944 else infile=${DESTFILE} ; fi
1946 sed -e 's/regex_t/__regex_t/g' \
1947 -e 's/regoff_t/__regoff_t/g' \
1948 -e 's/regmatch_t/__regmatch_t/g' \
1949 < $infile > ${DESTDIR}/fixinc.tmp
1950 rm -f ${DESTFILE}
1951 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1952 fi # end of test expression 'if'
1953 ;; # case end for file name test
1954 esac
1958 # Fix 65: Osf_Namespace_B
1960 case "${file}" in ./regex.h )
1961 if ( test '(' -r reg_types.h ')' -a \
1962 '(' -r sys/lc_core.h ')' -a \
1963 '(' -n "`grep '} regex_t;' reg_types.h`" ')' -a \
1964 '(' -z "`grep __regex_t regex.h`" ')'
1965 ) > /dev/null 2>&1 ; then
1966 fixlist="${fixlist}
1967 osf_namespace_b"
1968 if [ ! -r ${DESTFILE} ]
1969 then infile=${file}
1970 else infile=${DESTFILE} ; fi
1972 sed -e '/#include <reg_types.h>/a\
1973 typedef __regex_t regex_t;\
1974 typedef __regoff_t regoff_t;\
1975 typedef __regmatch_t regmatch_t;
1977 < $infile > ${DESTDIR}/fixinc.tmp
1978 rm -f ${DESTFILE}
1979 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1980 fi # end of test expression 'if'
1981 ;; # case end for file name test
1982 esac
1986 # Fix 66: Pthread_Page_Size
1988 case "${file}" in ./pthread.h )
1989 if ( test -n "`egrep '^int __page_size' ${file}`"
1990 ) > /dev/null 2>&1 ; then
1991 fixlist="${fixlist}
1992 pthread_page_size"
1993 if [ ! -r ${DESTFILE} ]
1994 then infile=${file}
1995 else infile=${DESTFILE} ; fi
1997 sed -e 's/^int __page_size/extern int __page_size/' \
1998 < $infile > ${DESTDIR}/fixinc.tmp
1999 rm -f ${DESTFILE}
2000 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2001 fi # end of select 'if'
2002 ;; # case end for file name test
2003 esac
2007 # Fix 67: Read_Ret_Type
2009 case "${file}" in ./stdio.h )
2010 if ( test -n "`egrep 'extern int .*, fread\\(\\), fwrite\\(\\)' ${file}`"
2011 ) > /dev/null 2>&1 ; then
2012 fixlist="${fixlist}
2013 read_ret_type"
2014 if [ ! -r ${DESTFILE} ]
2015 then infile=${file}
2016 else infile=${DESTFILE} ; fi
2018 sed -e 's/^\(extern int fclose(), fflush()\), \(fread(), fwrite()\)\(.*\)$/extern unsigned int \2;\
2019 \1\3/' \
2020 < $infile > ${DESTDIR}/fixinc.tmp
2021 rm -f ${DESTFILE}
2022 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2023 fi # end of select 'if'
2024 ;; # case end for file name test
2025 esac
2029 # Fix 68: Rs6000_Double
2031 case "${file}" in ./math.h )
2032 if ( test -n "`egrep '[^a-zA-Z_]class\\(' ${file}`"
2033 ) > /dev/null 2>&1 ; then
2034 fixlist="${fixlist}
2035 rs6000_double"
2036 if [ ! -r ${DESTFILE} ]
2037 then infile=${file}
2038 else infile=${DESTFILE} ; fi
2040 sed -e '/class[(]/i\
2041 #ifndef __cplusplus
2043 -e '/class[(]/a\
2044 #endif
2046 < $infile > ${DESTDIR}/fixinc.tmp
2047 rm -f ${DESTFILE}
2048 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2049 fi # end of select 'if'
2050 ;; # case end for file name test
2051 esac
2055 # Fix 69: Rs6000_Fchmod
2057 case "${file}" in ./sys/stat.h )
2058 if ( test -n "`egrep 'fchmod\\(char' ${file}`"
2059 ) > /dev/null 2>&1 ; then
2060 fixlist="${fixlist}
2061 rs6000_fchmod"
2062 if [ ! -r ${DESTFILE} ]
2063 then infile=${file}
2064 else infile=${DESTFILE} ; fi
2066 sed -e 's/fchmod(char \*/fchmod(int/' \
2067 < $infile > ${DESTDIR}/fixinc.tmp
2068 rm -f ${DESTFILE}
2069 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2070 fi # end of select 'if'
2071 ;; # case end for file name test
2072 esac
2076 # Fix 70: Rs6000_Param
2078 case "${file}" in ./stdio.h | \
2079 ./unistd.h )
2080 fixlist="${fixlist}
2081 rs6000_param"
2082 if [ ! -r ${DESTFILE} ]
2083 then infile=${file}
2084 else infile=${DESTFILE} ; fi
2086 sed -e 's@rename(const char \*old, const char \*new)@rename(const char *_old, const char *_new)@' \
2087 < $infile > ${DESTDIR}/fixinc.tmp
2088 rm -f ${DESTFILE}
2089 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2090 ;; # case end for file name test
2091 esac
2095 # Fix 71: Sony_Include
2097 case "${file}" in ./machine/machparam.h )
2098 if ( test -n "`egrep '\"\\.\\./machine/endian.h\"' ${file}`"
2099 ) > /dev/null 2>&1 ; then
2100 fixlist="${fixlist}
2101 sony_include"
2102 if [ ! -r ${DESTFILE} ]
2103 then infile=${file}
2104 else infile=${DESTFILE} ; fi
2106 sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \
2107 < $infile > ${DESTDIR}/fixinc.tmp
2108 rm -f ${DESTFILE}
2109 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2110 fi # end of select 'if'
2111 ;; # case end for file name test
2112 esac
2116 # Fix 72: Statsswtch
2118 case "${file}" in ./rpcsvc/rstat.h )
2119 if ( test -n "`egrep 'boottime$' ${file}`"
2120 ) > /dev/null 2>&1 ; then
2121 fixlist="${fixlist}
2122 statsswtch"
2123 if [ ! -r ${DESTFILE} ]
2124 then infile=${file}
2125 else infile=${DESTFILE} ; fi
2127 sed -e 's/boottime$/boottime;/' \
2128 < $infile > ${DESTDIR}/fixinc.tmp
2129 rm -f ${DESTFILE}
2130 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2131 fi # end of select 'if'
2132 ;; # case end for file name test
2133 esac
2137 # Fix 73: Stdio_Va_List
2139 case "${file}" in ./stdio.h )
2140 fixlist="${fixlist}
2141 stdio_va_list"
2142 if [ ! -r ${DESTFILE} ]
2143 then infile=${file}
2144 else infile=${DESTFILE} ; fi
2145 ( if ( egrep "__need___va_list" $file ) > /dev/null 2>&1 ; then
2147 else
2148 echo "#define __need___va_list"
2149 echo "#include <stdarg.h>"
2152 sed -e 's@ va_list @ __gnuc_va_list @' \
2153 -e 's@ va_list)@ __gnuc_va_list)@' \
2154 -e 's@ _BSD_VA_LIST_))@ __gnuc_va_list))@' \
2155 -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \
2156 -e 's@ va_list@ __va_list__@' \
2157 -e 's@\*va_list@*__va_list__@' \
2158 -e 's@ __va_list)@ __gnuc_va_list)@' \
2159 -e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \
2160 -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \
2161 -e 's@VA_LIST@DUMMY_VA_LIST@' \
2162 -e 's@_Va_LIST@_VA_LIST@' ) < $infile > ${DESTDIR}/fixinc.tmp
2164 # Shell scripts have the potential of removing the output
2165 # We interpret that to mean the file is not to be altered
2167 if test ! -f ${DESTDIR}/fixinc.tmp
2168 then continue ; fi
2169 rm -f ${DESTFILE}
2170 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2171 ;; # case end for file name test
2172 esac
2176 # Fix 74: Sun_Bogus_Ifdef
2178 case "${file}" in ./hsfs/hsfs_spec.h | \
2179 ./hsfs/iso_spec.h )
2180 if ( test -n "`egrep '#ifdef __i386__ || __vax__' ${file}`"
2181 ) > /dev/null 2>&1 ; then
2182 fixlist="${fixlist}
2183 sun_bogus_ifdef"
2184 if [ ! -r ${DESTFILE} ]
2185 then infile=${file}
2186 else infile=${DESTFILE} ; fi
2188 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
2189 < $infile > ${DESTDIR}/fixinc.tmp
2190 rm -f ${DESTFILE}
2191 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2192 fi # end of select 'if'
2193 ;; # case end for file name test
2194 esac
2198 # Fix 75: Sun_Bogus_Ifdef_Sun4c
2200 case "${file}" in ./hsfs/hsnode.h )
2201 if ( test -n "`egrep '#ifdef __i386__ || __sun4c__' ${file}`"
2202 ) > /dev/null 2>&1 ; then
2203 fixlist="${fixlist}
2204 sun_bogus_ifdef_sun4c"
2205 if [ ! -r ${DESTFILE} ]
2206 then infile=${file}
2207 else infile=${DESTFILE} ; fi
2209 sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \
2210 < $infile > ${DESTDIR}/fixinc.tmp
2211 rm -f ${DESTFILE}
2212 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2213 fi # end of select 'if'
2214 ;; # case end for file name test
2215 esac
2219 # Fix 76: Sun_Catmacro
2221 case "${file}" in ./pixrect/memvar.h )
2222 if ( test -n "`egrep '^#define[ ]+CAT\\(a,b\\)' ${file}`"
2223 ) > /dev/null 2>&1 ; then
2224 fixlist="${fixlist}
2225 sun_catmacro"
2226 if [ ! -r ${DESTFILE} ]
2227 then infile=${file}
2228 else infile=${DESTFILE} ; fi
2230 sed -e '/^#define[ ]CAT(a,b)/ i\
2231 #ifdef __STDC__ \
2232 #define CAT(a,b) a##b\
2233 #else
2235 -e '/^#define[ ]CAT(a,b)/ a\
2236 #endif
2238 < $infile > ${DESTDIR}/fixinc.tmp
2239 rm -f ${DESTFILE}
2240 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2241 fi # end of select 'if'
2242 ;; # case end for file name test
2243 esac
2247 # Fix 77: Sun_Malloc
2249 case "${file}" in ./malloc.h )
2250 fixlist="${fixlist}
2251 sun_malloc"
2252 if [ ! -r ${DESTFILE} ]
2253 then infile=${file}
2254 else infile=${DESTFILE} ; fi
2256 sed -e 's/typedef[ ]char \* malloc_t/typedef void \* malloc_t/g' \
2257 -e 's/int[ ][ ]*free/void free/g' \
2258 -e 's/char\([ ]*\*[ ]*malloc\)/void\1/g' \
2259 -e 's/char\([ ]*\*[ ]*realloc\)/void\1/g' \
2260 < $infile > ${DESTDIR}/fixinc.tmp
2261 rm -f ${DESTFILE}
2262 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2263 ;; # case end for file name test
2264 esac
2268 # Fix 78: Sun_Memcpy
2270 case "${file}" in ./memory.h )
2271 if ( test -n "`egrep '/\\* @\\(#\\)(head/memory.h 50.1 |memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2 )\\*/' ${file}`"
2272 ) > /dev/null 2>&1 ; then
2273 fixlist="${fixlist}
2274 sun_memcpy"
2275 if [ ! -r ${DESTFILE} ]
2276 then infile=${file}
2277 else infile=${DESTFILE} ; fi
2279 sed -e '1i\
2280 /* This file was generated by fixincludes */\
2281 #ifndef __memory_h__\
2282 #define __memory_h__\
2284 #ifdef __STDC__\
2285 extern void *memccpy();\
2286 extern void *memchr();\
2287 extern void *memcpy();\
2288 extern void *memset();\
2289 #else\
2290 extern char *memccpy();\
2291 extern char *memchr();\
2292 extern char *memcpy();\
2293 extern char *memset();\
2294 #endif /* __STDC__ */\
2296 extern int memcmp();\
2298 #endif /* __memory_h__ */
2300 -e '1,$d' \
2301 < $infile > ${DESTDIR}/fixinc.tmp
2302 rm -f ${DESTFILE}
2303 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2304 fi # end of select 'if'
2305 ;; # case end for file name test
2306 esac
2310 # Fix 79: Sun_Rusers_Semi
2312 case "${file}" in ./rpcsvc/rusers.h )
2313 if ( test -n "`egrep '_cnt$' ${file}`"
2314 ) > /dev/null 2>&1 ; then
2315 fixlist="${fixlist}
2316 sun_rusers_semi"
2317 if [ ! -r ${DESTFILE} ]
2318 then infile=${file}
2319 else infile=${DESTFILE} ; fi
2321 sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' \
2322 < $infile > ${DESTDIR}/fixinc.tmp
2323 rm -f ${DESTFILE}
2324 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2325 fi # end of select 'if'
2326 ;; # case end for file name test
2327 esac
2331 # Fix 80: Sun_Signal
2333 case "${file}" in ./sys/signal.h | \
2334 ./signal.h )
2335 if ( test -n "`egrep '^void \\(\\*signal\\(\\)\\)\\(\\);' ${file}`"
2336 ) > /dev/null 2>&1 ; then
2337 fixlist="${fixlist}
2338 sun_signal"
2339 if [ ! -r ${DESTFILE} ]
2340 then infile=${file}
2341 else infile=${DESTFILE} ; fi
2343 sed -e '/^void (\*signal())();$/i\
2344 #ifdef __cplusplus\
2345 void (*signal(...))(...);\
2346 #else
2348 -e '/^void (\*signal())();$/a\
2349 #endif
2351 < $infile > ${DESTDIR}/fixinc.tmp
2352 rm -f ${DESTFILE}
2353 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2354 fi # end of select 'if'
2355 ;; # case end for file name test
2356 esac
2360 # Fix 81: Sun_Auth_Proto
2362 case "${file}" in ./rpc/auth.h | \
2363 ./rpc/clnt.h | \
2364 ./rpc/svc.h | \
2365 ./rpc/xdr.h )
2366 if ( test -n "`egrep '\\(\\*[a-z][a-z_]*\\)\\(\\)' ${file}`"
2367 ) > /dev/null 2>&1 ; then
2368 fixlist="${fixlist}
2369 sun_auth_proto"
2370 if [ ! -r ${DESTFILE} ]
2371 then infile=${file}
2372 else infile=${DESTFILE} ; fi
2374 sed -e 's/^\(.*(\*[a-z][a-z_]*)(\)\();.*\)/\
2375 #ifdef __cplusplus\
2376 \1...\2\
2377 #else\
2378 \1\2\
2379 #endif/' \
2380 < $infile > ${DESTDIR}/fixinc.tmp
2381 rm -f ${DESTFILE}
2382 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2383 fi # end of select 'if'
2384 ;; # case end for file name test
2385 esac
2389 # Fix 82: Sunos_Matherr_Decl
2391 case "${file}" in ./math.h )
2392 fixlist="${fixlist}
2393 sunos_matherr_decl"
2394 if [ ! -r ${DESTFILE} ]
2395 then infile=${file}
2396 else infile=${DESTFILE} ; fi
2398 sed -e '/^struct exception/,$b' \
2399 -e '/matherr/i\
2400 struct exception;
2402 < $infile > ${DESTDIR}/fixinc.tmp
2403 rm -f ${DESTFILE}
2404 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2405 ;; # case end for file name test
2406 esac
2410 # Fix 83: Sunos_Strlen
2412 case "${file}" in ./strings.h )
2413 fixlist="${fixlist}
2414 sunos_strlen"
2415 if [ ! -r ${DESTFILE} ]
2416 then infile=${file}
2417 else infile=${DESTFILE} ; fi
2419 sed -e 's/int[ ]*strlen();/__SIZE_TYPE__ strlen();/' \
2420 < $infile > ${DESTDIR}/fixinc.tmp
2421 rm -f ${DESTFILE}
2422 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2423 ;; # case end for file name test
2424 esac
2428 # Fix 84: Systypes
2430 case "${file}" in ./sys/types.h | \
2431 ./stdlib.h | \
2432 ./sys/stdtypes.h | \
2433 ./stddef.h | \
2434 ./memory.h | \
2435 ./unistd.h )
2436 if ( test -n "`egrep 'typedef[ ]+[a-z_][ a-z_]*[ ](size|ptrdiff|wchar)_t' ${file}`"
2437 ) > /dev/null 2>&1 ; then
2438 fixlist="${fixlist}
2439 systypes"
2440 if [ ! -r ${DESTFILE} ]
2441 then infile=${file}
2442 else infile=${DESTFILE} ; fi
2444 sed -e '/^[ ]*\*[ ]*typedef unsigned int size_t;/N' \
2445 -e 's/^\([ ]*\*[ ]*typedef unsigned int size_t;\n[ ]*\*\/\)/\1\
2446 #ifndef __SIZE_TYPE__\
2447 #define __SIZE_TYPE__ long unsigned int\
2448 #endif\
2449 typedef __SIZE_TYPE__ size_t;\
2450 /' \
2451 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/i\
2452 #ifndef __SIZE_TYPE__\
2453 #define __SIZE_TYPE__ long unsigned int\
2454 #endif
2456 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/typedef __SIZE_TYPE__ size_t/' \
2457 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/i\
2458 #ifndef __PTRDIFF_TYPE__\
2459 #define __PTRDIFF_TYPE__ long int\
2460 #endif
2462 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/typedef __PTRDIFF_TYPE__ ptrdiff_t/' \
2463 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/i\
2464 #ifndef __WCHAR_TYPE__\
2465 #define __WCHAR_TYPE__ int\
2466 #endif\
2467 #ifndef __cplusplus
2469 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/a\
2470 #endif
2472 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/typedef __WCHAR_TYPE__ wchar_t/' \
2473 < $infile > ${DESTDIR}/fixinc.tmp
2474 rm -f ${DESTFILE}
2475 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2476 fi # end of select 'if'
2477 ;; # case end for file name test
2478 esac
2482 # Fix 85: Systypes_For_Aix
2484 case "${file}" in ./sys/types.h )
2485 if ( test -n "`egrep 'typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t' ${file}`"
2486 ) > /dev/null 2>&1 ; then
2487 if ( test -a \
2488 -z "`egrep '_GCC_SIZE_T' ${file}`"
2489 ) > /dev/null 2>&1 ; then
2490 fixlist="${fixlist}
2491 systypes_for_aix"
2492 if [ ! -r ${DESTFILE} ]
2493 then infile=${file}
2494 else infile=${DESTFILE} ; fi
2496 sed -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/i\
2497 #ifndef _GCC_SIZE_T\
2498 #define _GCC_SIZE_T
2500 -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/a\
2501 #endif
2503 < $infile > ${DESTDIR}/fixinc.tmp
2504 rm -f ${DESTFILE}
2505 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2506 fi # end of bypass 'if'
2507 fi # end of select 'if'
2508 ;; # case end for file name test
2509 esac
2513 # Fix 86: Sysv68_String
2515 case "${file}" in ./string.h )
2516 fixlist="${fixlist}
2517 sysv68_string"
2518 if [ ! -r ${DESTFILE} ]
2519 then infile=${file}
2520 else infile=${DESTFILE} ; fi
2522 sed -e 's/extern[ ]*int[ ]*strlen();/extern unsigned int strlen();/' \
2523 -e 's/extern[ ]*int[ ]*ffs[ ]*(long);/extern int ffs(int);/' \
2524 -e 's/strdup(char \*s1);/strdup(const char *s1);/' \
2525 -e '/^extern char$/N' \
2526 -e 's/^extern char\(\n \*memccpy(),\)$/extern void\1/' \
2527 -e '/^ strncmp(),$/N' \
2528 -e 's/^\( strncmp()\),\n\( strlen(),\)$/\1;\
2529 extern unsigned int\
2530 \2/' \
2531 -e '/^extern int$/N' \
2532 -e 's/^extern int\(\n strlen(),\)/extern size_t\1/' \
2533 < $infile > ${DESTDIR}/fixinc.tmp
2534 rm -f ${DESTFILE}
2535 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2536 ;; # case end for file name test
2537 esac
2541 # Fix 87: Sysz_Stdlib_For_Sun
2543 case "${file}" in ./stdlib.h )
2544 fixlist="${fixlist}
2545 sysz_stdlib_for_sun"
2546 if [ ! -r ${DESTFILE} ]
2547 then infile=${file}
2548 else infile=${DESTFILE} ; fi
2550 sed -e 's/int abort/void abort/g' \
2551 -e 's/int free/void free/g' \
2552 -e 's/char[ ]*\*[ ]*calloc/void \* calloc/g' \
2553 -e 's/char[ ]*\*[ ]*malloc/void \* malloc/g' \
2554 -e 's/char[ ]*\*[ ]*realloc/void \* realloc/g' \
2555 -e 's/char[ ]*\*[ ]*bsearch/void \* bsearch/g' \
2556 -e 's/int[ ][ ]*exit/void exit/g' \
2557 -e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/i\
2558 #ifndef _GCC_SIZE_T\
2559 #define _GCC_SIZE_T
2561 -e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/a\
2562 #endif
2564 < $infile > ${DESTDIR}/fixinc.tmp
2565 rm -f ${DESTFILE}
2566 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2567 ;; # case end for file name test
2568 esac
2572 # Fix 88: Sysz_Stdtypes_For_Sun
2574 case "${file}" in ./sys/stdtypes.h )
2575 fixlist="${fixlist}
2576 sysz_stdtypes_for_sun"
2577 if [ ! -r ${DESTFILE} ]
2578 then infile=${file}
2579 else infile=${DESTFILE} ; fi
2581 sed -e '/[ ]size_t.*;/i\
2582 #ifndef _GCC_SIZE_T\
2583 #define _GCC_SIZE_T
2585 -e '/[ ]size_t.*;/a\
2586 #endif
2588 -e '/[ ]ptrdiff_t.*;/i\
2589 #ifndef _GCC_PTRDIFF_T\
2590 #define _GCC_PTRDIFF_T
2592 -e '/[ ]ptrdiff_t.*;/a\
2593 #endif
2595 -e '/[ ]wchar_t.*;/i\
2596 #ifndef _GCC_WCHAR_T\
2597 #define _GCC_WCHAR_T
2599 -e '/[ ]wchar_t.*;/a\
2600 #endif
2602 < $infile > ${DESTDIR}/fixinc.tmp
2603 rm -f ${DESTFILE}
2604 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2605 ;; # case end for file name test
2606 esac
2610 # Fix 89: Tinfo_Cplusplus
2612 case "${file}" in ./tinfo.h )
2613 fixlist="${fixlist}
2614 tinfo_cplusplus"
2615 if [ ! -r ${DESTFILE} ]
2616 then infile=${file}
2617 else infile=${DESTFILE} ; fi
2619 sed -e 's/[ ]_cplusplus/ __cplusplus/' \
2620 < $infile > ${DESTDIR}/fixinc.tmp
2621 rm -f ${DESTFILE}
2622 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2623 ;; # case end for file name test
2624 esac
2628 # Fix 90: Ultrix_Ansi_Compat
2630 case "${file}" in ./ansi_compat.h )
2631 if ( test -n "`egrep 'ULTRIX' ${file}`"
2632 ) > /dev/null 2>&1 ; then
2633 fixlist="${fixlist}
2634 ultrix_ansi_compat"
2635 if [ ! -r ${DESTFILE} ]
2636 then infile=${file}
2637 else infile=${DESTFILE} ; fi
2639 sed -e '1i\
2640 /* This file intentionally left blank. */
2642 -e '1,$d' \
2643 < $infile > ${DESTDIR}/fixinc.tmp
2644 rm -f ${DESTFILE}
2645 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2646 fi # end of select 'if'
2647 ;; # case end for file name test
2648 esac
2652 # Fix 91: Ultrix_Fix_Fixproto
2654 case "${file}" in ./sys/utsname.h )
2655 if ( test -n "`egrep 'ULTRIX' ${file}`"
2656 ) > /dev/null 2>&1 ; then
2657 fixlist="${fixlist}
2658 ultrix_fix_fixproto"
2659 if [ ! -r ${DESTFILE} ]
2660 then infile=${file}
2661 else infile=${DESTFILE} ; fi
2663 sed -e '/^[ ]*extern[ ]*int[ ]*uname();$/i\
2664 struct utsname;
2666 < $infile > ${DESTDIR}/fixinc.tmp
2667 rm -f ${DESTFILE}
2668 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2669 fi # end of select 'if'
2670 ;; # case end for file name test
2671 esac
2675 # Fix 92: Ultrix_Atof_Param
2677 case "${file}" in ./math.h )
2678 fixlist="${fixlist}
2679 ultrix_atof_param"
2680 if [ ! -r ${DESTFILE} ]
2681 then infile=${file}
2682 else infile=${DESTFILE} ; fi
2684 sed -e 's@atof(\([ ]*char[ ]*\*[^)]*\))@atof(const \1)@' \
2685 -e 's@inline int abs(int [a-z][a-z]*) {.*}@extern "C" int abs(int);@' \
2686 -e 's@inline double abs(double [a-z][a-z]*) {.*}@@' \
2687 -e 's@inline int sqr(int [a-z][a-z]*) {.*}@@' \
2688 -e 's@inline double sqr(double [a-z][a-z]*) {.*}@@' \
2689 < $infile > ${DESTDIR}/fixinc.tmp
2690 rm -f ${DESTFILE}
2691 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2692 ;; # case end for file name test
2693 esac
2697 # Fix 93: Ultrix_Const
2699 case "${file}" in ./stdio.h )
2700 fixlist="${fixlist}
2701 ultrix_const"
2702 if [ ! -r ${DESTFILE} ]
2703 then infile=${file}
2704 else infile=${DESTFILE} ; fi
2706 sed -e 's@perror( char \*__s );@perror( const char *__s );@' \
2707 -e 's@fputs( char \*__s,@fputs( const char *__s,@' \
2708 -e 's@fopen( char \*__filename, char \*__type );@fopen( const char *__filename, const char *__type );@' \
2709 -e 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@' \
2710 -e 's@fscanf( FILE \*__stream, char \*__format,@fscanf( FILE *__stream, const char *__format,@' \
2711 -e 's@scanf( char \*__format,@scanf( const char *__format,@' \
2712 -e 's@sscanf( char \*__s, char \*__format,@sscanf( const char *__s, const char *__format,@' \
2713 -e 's@popen(char \*, char \*);@popen(const char *, const char *);@' \
2714 -e 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@' \
2715 < $infile > ${DESTDIR}/fixinc.tmp
2716 rm -f ${DESTFILE}
2717 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2718 ;; # case end for file name test
2719 esac
2723 # Fix 94: Ultrix_Ifdef
2725 case "${file}" in ./sys/file.h )
2726 if ( test -n "`egrep '#ifdef KERNEL' ${file}`"
2727 ) > /dev/null 2>&1 ; then
2728 fixlist="${fixlist}
2729 ultrix_ifdef"
2730 if [ ! -r ${DESTFILE} ]
2731 then infile=${file}
2732 else infile=${DESTFILE} ; fi
2734 sed -e 's/#ifdef KERNEL/#if defined(KERNEL)/' \
2735 < $infile > ${DESTDIR}/fixinc.tmp
2736 rm -f ${DESTFILE}
2737 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2738 fi # end of select 'if'
2739 ;; # case end for file name test
2740 esac
2744 # Fix 95: Ultrix_Nested_Cmnt
2746 case "${file}" in ./rpc/svc.h )
2747 fixlist="${fixlist}
2748 ultrix_nested_cmnt"
2749 if [ ! -r ${DESTFILE} ]
2750 then infile=${file}
2751 else infile=${DESTFILE} ; fi
2753 sed -e 's@^\( \* int protocol; \)/\*@\1*/ /*@' \
2754 < $infile > ${DESTDIR}/fixinc.tmp
2755 rm -f ${DESTFILE}
2756 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2757 ;; # case end for file name test
2758 esac
2762 # Fix 96: Ultrix_Static
2764 case "${file}" in ./machine/cpu.h )
2765 if ( test -n "`egrep '#include \"r[34]_cpu' ${file}`"
2766 ) > /dev/null 2>&1 ; then
2767 fixlist="${fixlist}
2768 ultrix_static"
2769 if [ ! -r ${DESTFILE} ]
2770 then infile=${file}
2771 else infile=${DESTFILE} ; fi
2773 sed -e 's/^static struct tlb_pid_state/struct tlb_pid_state/' \
2774 -e 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/' \
2775 -e 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/' \
2776 < $infile > ${DESTDIR}/fixinc.tmp
2777 rm -f ${DESTFILE}
2778 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2779 fi # end of select 'if'
2780 ;; # case end for file name test
2781 esac
2785 # Fix 97: Undefine_Null
2787 if ( test -n "`egrep '^#[ ]*define[ ]*[ ]NULL[ ]' ${file}`"
2788 ) > /dev/null 2>&1 ; then
2789 if ( test -a \
2790 -z "`egrep '#[ ]*(ifn|un)def[ ]*[ ]NULL($|[ ])' ${file}`"
2791 ) > /dev/null 2>&1 ; then
2792 fixlist="${fixlist}
2793 undefine_null"
2794 if [ ! -r ${DESTFILE} ]
2795 then infile=${file}
2796 else infile=${DESTFILE} ; fi
2798 sed -e '/^#[ ]*define[ ][ ]*NULL[ ]/i\
2799 #undef NULL
2801 < $infile > ${DESTDIR}/fixinc.tmp
2802 rm -f ${DESTFILE}
2803 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2804 fi # end of bypass 'if'
2805 fi # end of select 'if'
2809 # Fix 98: Va_I960_Macro
2811 case "${file}" in ./arch/i960/archI960.h )
2812 if ( test -n "`egrep '__(vsiz|vali|vpad|alignof__)' ${file}`"
2813 ) > /dev/null 2>&1 ; then
2814 fixlist="${fixlist}
2815 va_i960_macro"
2816 if [ ! -r ${DESTFILE} ]
2817 then infile=${file}
2818 else infile=${DESTFILE} ; fi
2820 sed -e 's/__vsiz/__vxvsiz/' \
2821 -e 's/__vali/__vxvali/' \
2822 -e 's/__vpad/__vxvpad/' \
2823 -e 's/__alignof__/__vxalignof__/' \
2824 < $infile > ${DESTDIR}/fixinc.tmp
2825 rm -f ${DESTFILE}
2826 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2827 fi # end of select 'if'
2828 ;; # case end for file name test
2829 esac
2833 # Fix 99: Void_Null
2835 case "${file}" in ./curses.h | \
2836 ./dbm.h | \
2837 ./locale.h | \
2838 ./stdio.h | \
2839 ./stdlib.h | \
2840 ./string.h | \
2841 ./time.h | \
2842 ./unistd.h | \
2843 ./sys/dir.h | \
2844 ./sys/param.h | \
2845 ./sys/types.h )
2846 if ( test -n "`egrep '#[ ]*define[ ][ ]*NULL[ ].*void' ${file}`"
2847 ) > /dev/null 2>&1 ; then
2848 fixlist="${fixlist}
2849 void_null"
2850 if [ ! -r ${DESTFILE} ]
2851 then infile=${file}
2852 else infile=${DESTFILE} ; fi
2854 sed -e 's/^#[ ]*define[ ]*NULL[ ]*((void[ ]*\*)0)/#define NULL 0/' \
2855 < $infile > ${DESTDIR}/fixinc.tmp
2856 rm -f ${DESTFILE}
2857 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2858 fi # end of select 'if'
2859 ;; # case end for file name test
2860 esac
2864 # Fix 100: Vxworks_Gcc_Problem
2866 case "${file}" in ./types/vxTypesBase.h )
2867 if ( test -n "`egrep '__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__' ${file}`"
2868 ) > /dev/null 2>&1 ; then
2869 fixlist="${fixlist}
2870 vxworks_gcc_problem"
2871 if [ ! -r ${DESTFILE} ]
2872 then infile=${file}
2873 else infile=${DESTFILE} ; fi
2875 sed -e 's/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/#if 1/' \
2876 -e '/[ ]size_t/i\
2877 #ifndef _GCC_SIZE_T\
2878 #define _GCC_SIZE_T
2880 -e '/[ ]size_t/a\
2881 #endif
2883 -e '/[ ]ptrdiff_t/i\
2884 #ifndef _GCC_PTRDIFF_T\
2885 #define _GCC_PTRDIFF_T
2887 -e '/[ ]ptrdiff_t/a\
2888 #endif
2890 -e '/[ ]wchar_t/i\
2891 #ifndef _GCC_WCHAR_T\
2892 #define _GCC_WCHAR_T
2894 -e '/[ ]wchar_t/a\
2895 #endif
2897 < $infile > ${DESTDIR}/fixinc.tmp
2898 rm -f ${DESTFILE}
2899 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2900 fi # end of select 'if'
2901 ;; # case end for file name test
2902 esac
2906 # Fix 101: Vxworks_Needs_Vxtypes
2908 case "${file}" in ./time.h )
2909 if ( test -n "`egrep 'uint_t[ ][ ]*_clocks_per_sec' ${file}`"
2910 ) > /dev/null 2>&1 ; then
2911 fixlist="${fixlist}
2912 vxworks_needs_vxtypes"
2913 if [ ! -r ${DESTFILE} ]
2914 then infile=${file}
2915 else infile=${DESTFILE} ; fi
2917 sed -e 's/uint_t/unsigned int/' \
2918 < $infile > ${DESTDIR}/fixinc.tmp
2919 rm -f ${DESTFILE}
2920 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2921 fi # end of select 'if'
2922 ;; # case end for file name test
2923 esac
2927 # Fix 102: Vxworks_Needs_Vxworks
2929 case "${file}" in ./sys/stat.h )
2930 if ( test -n "`egrep '#[ ]define[ ][ ]*__INCstath' ${file}`"
2931 ) > /dev/null 2>&1 ; then
2932 if ( test '(' -r types/vxTypesOld.h ')' -a \
2933 '(' -n "`egrep '#include' $file`" ')' -a \
2934 '(' -n "`egrep ULONG $file`" ')'
2935 ) > /dev/null 2>&1 ; then
2936 fixlist="${fixlist}
2937 vxworks_needs_vxworks"
2938 if [ ! -r ${DESTFILE} ]
2939 then infile=${file}
2940 else infile=${DESTFILE} ; fi
2942 sed -e '/#[ ]define[ ][ ]*__INCstath/a\
2943 #include <types/vxTypesOld.h>
2945 < $infile > ${DESTDIR}/fixinc.tmp
2946 rm -f ${DESTFILE}
2947 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2948 fi # end of test expression 'if'
2949 fi # end of select 'if'
2950 ;; # case end for file name test
2951 esac
2955 # Fix 103: Vxworks_Time
2957 case "${file}" in ./time.h )
2958 if ( test -n "`egrep 'VOIDFUNCPTR' ${file}`"
2959 ) > /dev/null 2>&1 ; then
2960 if ( test '(' -r vxWorks.h ')'
2961 ) > /dev/null 2>&1 ; then
2962 fixlist="${fixlist}
2963 vxworks_time"
2964 if [ ! -r ${DESTFILE} ]
2965 then infile=${file}
2966 else infile=${DESTFILE} ; fi
2968 sed -e '/VOIDFUNCPTR/i\
2969 #ifndef __gcc_VOIDFUNCPTR_defined\
2970 #ifdef __cplusplus\
2971 typedef void (*__gcc_VOIDFUNCPTR) (...);\
2972 #else\
2973 typedef void (*__gcc_VOIDFUNCPTR) ();\
2974 #endif\
2975 #define __gcc_VOIDFUNCPTR_defined\
2976 #endif
2978 -e 's/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g' \
2979 < $infile > ${DESTDIR}/fixinc.tmp
2980 rm -f ${DESTFILE}
2981 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
2982 fi # end of test expression 'if'
2983 fi # end of select 'if'
2984 ;; # case end for file name test
2985 esac
2989 # Fix 104: X11_Class
2991 case "${file}" in ./X11/ShellP.h )
2992 if ( test -a \
2993 -z "`egrep '__cplusplus' ${file}`"
2994 ) > /dev/null 2>&1 ; then
2995 fixlist="${fixlist}
2996 x11_class"
2997 if [ ! -r ${DESTFILE} ]
2998 then infile=${file}
2999 else infile=${DESTFILE} ; fi
3001 sed -e '/char \*class;/i\
3002 #ifdef __cplusplus\
3003 char *c_class;\
3004 #else
3006 -e '/char \*class;/a\
3007 #endif
3009 < $infile > ${DESTDIR}/fixinc.tmp
3010 rm -f ${DESTFILE}
3011 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
3012 fi # end of bypass 'if'
3013 ;; # case end for file name test
3014 esac
3018 # Fix 105: X11_Class_Usage
3020 case "${file}" in ./Xm/BaseClassI.h )
3021 if ( test -a \
3022 -z "`egrep '__cplusplus' ${file}`"
3023 ) > /dev/null 2>&1 ; then
3024 fixlist="${fixlist}
3025 x11_class_usage"
3026 if [ ! -r ${DESTFILE} ]
3027 then infile=${file}
3028 else infile=${DESTFILE} ; fi
3030 sed -e 's/ class[)]/ c_class)/g' \
3031 < $infile > ${DESTDIR}/fixinc.tmp
3032 rm -f ${DESTFILE}
3033 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
3034 fi # end of bypass 'if'
3035 ;; # case end for file name test
3036 esac
3040 # Fix 106: X11_New
3042 case "${file}" in ./Xm/Traversal.h )
3043 if ( test -a \
3044 -z "`egrep '__cplusplus' ${file}`"
3045 ) > /dev/null 2>&1 ; then
3046 fixlist="${fixlist}
3047 x11_new"
3048 if [ ! -r ${DESTFILE} ]
3049 then infile=${file}
3050 else infile=${DESTFILE} ; fi
3052 sed -e '/Widget old, new;/i\
3053 #ifdef __cplusplus\
3054 Widget old, c_new;\
3055 #else
3057 -e '/Widget old, new;/a\
3058 #endif
3060 -e 's/Widget new,/Widget c_new,/g' \
3061 < $infile > ${DESTDIR}/fixinc.tmp
3062 rm -f ${DESTFILE}
3063 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
3064 fi # end of bypass 'if'
3065 ;; # case end for file name test
3066 esac
3070 # Fix 107: X11_Sprintf
3072 case "${file}" in ./X11*/Xmu.h )
3073 fixlist="${fixlist}
3074 x11_sprintf"
3075 if [ ! -r ${DESTFILE} ]
3076 then infile=${file}
3077 else infile=${DESTFILE} ; fi
3079 sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
3080 extern char * sprintf();\
3081 #endif /* !defined __STDC__ */,' \
3082 < $infile > ${DESTDIR}/fixinc.tmp
3083 rm -f ${DESTFILE}
3084 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
3085 ;; # case end for file name test
3086 esac
3087 # IF the output has been removed OR it is unchanged,
3088 # THEN ensure the output is gone
3089 # ELSE look for local directory include syntax
3091 if ( test ! -f ${DESTFILE} || \
3092 cmp ${file} ${DESTFILE} ) > /dev/null 2>&1
3093 then
3094 rm -f ${DESTFILE}
3095 else
3096 echo "Fixed ${file}:${fixlist}"
3098 # Find any include directives that use "file".
3100 dir=`echo ${file} | sed -e s';/[^/]*$;;'`
3101 ddir=${DESTDIR}/$dir
3103 for include in `
3104 egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${DESTFILE} |
3105 sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`
3107 required="$required ${SRCDIR} $dir/$include ${ddir}/$include"
3108 done
3110 done # for file in $files
3112 done
3114 ## Make sure that any include files referenced using double quotes
3115 ## exist in the fixed directory. This comes last since otherwise
3116 ## we might end up deleting some of these files "because they don't
3117 ## need any change."
3118 set x `echo $required`
3119 shift
3120 while [ $# != 0 ]; do
3121 newreq=
3122 while [ $# != 0 ]; do
3123 # $1 is the directory to copy from,
3124 # $2 is the unfixed file,
3125 # $3 is the fixed file name.
3127 cd ${INPUT}
3128 cd $1
3129 if [ -f $2 ] ; then
3130 if [ -r $2 ] && [ ! -r $3 ]; then
3131 cp $2 $3 >/dev/null 2>&1 || echo "Can't copy $2" >&2
3132 chmod +w $3 2>/dev/null
3133 chmod a+r $3 2>/dev/null
3134 echo Copied $2
3135 for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 |
3136 sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`
3138 dir=`echo $2 | sed -e s'|/[^/]*$||'`
3139 dir2=`echo $3 | sed -e s'|/[^/]*$||'`
3140 newreq="$newreq $1 $dir/$include $dir2/$include"
3141 done
3144 shift; shift; shift
3145 done
3146 set x $newreq
3147 shift
3148 done
3150 echo 'Cleaning up DONE files.'
3151 cd $LIB
3152 find . -name DONE -exec rm -f '{}' ';'
3154 echo 'Removing unneeded directories:'
3155 cd $LIB
3156 all_dirs=`find . -type d \! -name '.' -print | sort -r`
3157 for file in $all_dirs; do
3158 rmdir $LIB/$file > /dev/null 2>&1
3159 done
3161 # # # # # # # # # # # # # # # # # # # # #
3163 # End of for INPUT directories
3165 done
3167 # # # # # # # # # # # # # # # # # # # # #
3169 if [ x${INSTALL_ASSERT_H} != x ] && [ -f ${srcdir}/assert.h ]
3170 then
3171 cd $ORIGDIR
3172 rm -f include/assert.h
3173 cp ${srcdir}/assert.h include/assert.h || exit 1
3174 chmod a+r include/assert.h