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.
37 then echo fixincludes
: no output directory specified
44 # Make sure it exists.
45 if [ ! -d $LIB ]; then
47 echo fixincludes
: output dir
'`'$LIB"' cannot be created"
51 ( cd $LIB && touch DONE
&& rm DONE
) ||
{
52 echo fixincludes
: output dir
'`'$LIB"' is an invalid directory"
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.
83 # On an Apollo, discard everything before `/usr'.
84 PWDCMD
="eval pwd | sed -e 's,.*/usr/,/usr/,'"
91 # Make LIB absolute only if needed to avoid problems with the amd.
96 cd $LIB; LIB
=`${PWDCMD}`
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
106 elif ln -s X
/tmp
/ShouldNotExist
2>/dev
/null
; then
107 rm -f /tmp
/ShouldNotExist
113 # # # # # # # # # # # # # # # # # # # # #
115 # Search each input directory for broken header files.
116 # This loop ends near the end of the file.
120 INPUTLIST
="/usr/include"
125 for INPUT
in ${INPUTLIST} ; do
129 cd ${INPUT} ||
continue
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.
148 while [ -n "$dirs" ] && [ $levels -gt 0 ]
150 levels
=`expr $levels - 1`
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.
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
174 all_dirs
="$all_dirs $d1"
175 if [ "`ls -ld $d1 | sed -n 's/.*-> //p'`" != "." ]
177 newdirs
="$newdirs $d1"
178 search_dirs
="$search_dirs $d1"
187 # # # # # # # # # # # # # # # # # # # # #
190 echo "All directories (including links to directories):"
193 for file in $all_dirs; do
195 if [ ! -d $LIB/$file ]
196 then mkdir
$LIB/$file
201 # # # # # # # # # # # # # # # # # # # # #
203 # treetops gets an alternating list
204 # of old directories to copy
205 # and the new directories to copy to.
209 echo 'Making symbolic directory links'
212 for sym_link
in $search_dirs; do
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
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
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} ]
266 dirname=root
${full_dest_dir}/
269 while [ x
$dirname != x
]; do
270 component
=`echo $dirname | sed -e 's|/.*$||'`
271 mkdir
$component >/dev
/null
2>&1
273 dirmade
=$dirmade/$component
274 dirname=`echo $dirname | sed -e 's|[^/]*/||'`
278 # Duplicate directory structure created in ${LIB}/${sym_link} in new
281 for file2
in $all_dirs; do
284 dupdir
=${LIB}/root
${full_dest_dir}/`echo $file2 |
285 sed -n "s|^${sym_link}/||p"`
286 echo "Duplicating ${sym_link}'s ${dupdir}"
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}"
315 # # # # # # # # # # # # # # # # # # # # #
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}`
330 DESTDIR
=`cd $1;${PWDCMD}`
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
]
340 touch ${DESTDIR}/DONE
341 echo Fixing directory
${SRCDIR} into
${DESTDIR}
343 # Check files which are symlinks as well as those which are files.
346 files
=`if $LINKS; then
347 find ${FIND_BASE}/. -name '*.h' \( -type f -o -type l \) -print
349 find ${FIND_BASE}/. -name '*.h' -type f -print
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
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}"
375 fi # end of select 'if'
376 ;; # case end for file name test
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}"
389 fi # end of select 'if'
390 ;; # case end for file name test
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}"
403 fi # end of select 'if'
404 ;; # case end for file name test
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}"
417 fi # end of select 'if'
418 ;; # case end for file name test
423 # Fix 5: Aaa_Bad_Fixes
425 case "${file}" in ./sundev/ipi_error.h )
426 echo "aaa_bad_fixes bypassing
file ${file}"
429 ;; # case end for file name test
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}"
442 fi # end of select 'if'
443 ;; # case end for file name test
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
465 #ifndef ___int_features_h
466 #include <sys/_int_features.h>
469 #if !(defined(_VA_LIST) || defined(_VA_LIST_))
476 typedef void * va_list;
478 typedef char * va_list;
492 #else /* ! defined(__DCC__) */
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 */
500 #endif /* ! defined(__DCC__) */
504 #if defined(__GNUC__) || defined(__STDC__)
505 typedef void * va_list;
507 typedef char * va_list;
510 #endif /* _IX86_ANY */
512 #endif /* __LINT__ */
513 #endif /* !(defined(_VA_LIST) || defined(_VA_LIST_)) */
514 #endif /* #ifndef __INT_VARARGS_H */
519 ;; # case end for file name test
526 case "${file}" in ./sys/wait.h )
527 if ( test -n "`egrep 'bos325,' ${file}`"
528 ) > /dev/null 2>&1 ; then
531 if [ ! -r ${DESTFILE} ]
533 else infile=${DESTFILE} ; fi
535 sed -e '/^extern pid_t wait3();$/i\
538 < $infile > ${DESTDIR}/fixinc.tmp
540 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
541 fi # end of select 'if'
542 ;; # case end for file name test
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
554 if [ ! -r ${DESTFILE} ]
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
561 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
562 fi # end of select 'if'
563 ;; # case end for file name test
568 # Fix 10: Alpha_Getopt
570 case "${file}" in ./stdio.h | \
572 if ( test -n "`egrep 'getopt\\(int, char \\*\\[' ${file}`"
573 ) > /dev/null 2>&1 ; then
576 if [ ! -r ${DESTFILE} ]
578 else infile=${DESTFILE} ; fi
580 sed -e 's/getopt(int, char \*\[\],[ ]*char \*)/getopt(int, char *const[], const char *)/' \
581 < $infile > ${DESTDIR}/fixinc.tmp
583 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
584 fi # end of select 'if'
585 ;; # case end for file name test
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
597 if [ ! -r ${DESTFILE} ]
599 else infile=${DESTFILE} ; fi
601 sed -e 's/#ifndef(__mips64)/#ifndef __mips64/' \
602 < $infile > ${DESTDIR}/fixinc.tmp
604 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
605 fi # end of select 'if'
606 ;; # case end for file name test
613 case "${file}" in ./unistd.h )
614 if ( test -n "`egrep 'char[ ]*\\*[ ]*sbrk[ ]*\\(' ${file}`"
615 ) > /dev/null 2>&1 ; then
618 if [ ! -r ${DESTFILE} ]
620 else infile=${DESTFILE} ; fi
622 sed -e 's/char\([ ]*\*[ ]*sbrk[ ]*(\)/void\1/' \
623 < $infile > ${DESTDIR}/fixinc.tmp
625 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
626 fi # end of select 'if'
627 ;; # case end for file name test
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
639 if [ ! -r ${DESTFILE} ]
641 else infile=${DESTFILE} ; fi
643 sed -e 's/___type p_type/p_type/' \
644 < $infile > ${DESTDIR}/fixinc.tmp
646 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
647 fi # end of select 'if'
648 ;; # case end for file name test
655 case "${file}" in ./stdlib.h )
656 if ( test -n "`egrep '#[ ]*define[ ]*__wchar_t' ${file}`"
657 ) > /dev/null 2>&1 ; then
660 if [ ! -r ${DESTFILE} ]
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
668 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
669 fi # end of select 'if'
670 ;; # case end for file name test
677 case "${file}" in ./sys/param.h )
678 if ( test -n "`egrep '#ifndef NOINLINE' ${file}`"
679 ) > /dev/null 2>&1 ; then
682 if [ ! -r ${DESTFILE} ]
684 else infile=${DESTFILE} ; fi
686 sed -e 's|#ifndef NOINLINE|#if !defined(NOINLINE) \&\& !defined(__GNUC__)|' \
687 < $infile > ${DESTDIR}/fixinc.tmp
689 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
690 fi # end of select 'if'
691 ;; # case end for file name test
698 case "${file}" in ./curses.h | \
699 ./curses_colr/curses.h | \
704 if [ ! -r ${DESTFILE} ]
706 else infile=${DESTFILE} ; fi
708 sed -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/i\
711 -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/a\
714 -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/i\
717 -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/a\
720 -e '/^[ ]*typedef[ ][ ]*unsigned char[ ][ ]*bool[ ]*;/i\
723 -e '/^[ ]*typedef[ ][ ]*unsigned char[ ][ ]*bool[ ]*;/a\
726 -e '/^typedef[ ][ ]*int[ ][ ]*bool[ ]*;/i\
729 -e '/^typedef[ ][ ]*int[ ][ ]*bool[ ]*;/a\
732 -e '/^[ ]*typedef[ ][ ]*unsigned int[ ][ ]*bool[ ]*;/i\
735 -e '/^[ ]*typedef[ ][ ]*unsigned int[ ][ ]*bool[ ]*;/a\
738 < $infile > ${DESTDIR}/fixinc.tmp
740 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
741 ;; # case end for file name test
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
753 if [ ! -r ${DESTFILE} ]
755 else infile=${DESTFILE} ; fi
757 sed -e 's/^[ ]*typedef[ ][ ]*\(struct[ ][ ]*term[ ]*;[ ]*\)$/\1/' \
758 < $infile > ${DESTDIR}/fixinc.tmp
760 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
761 fi # end of select 'if'
762 ;; # case end for file name test
769 case "${file}" in ./sundev/vuid_event.h )
772 if [ ! -r ${DESTFILE} ]
774 else infile=${DESTFILE} ; fi
776 sed -e 's/doesn'\''t/does not/' \
777 < $infile > ${DESTDIR}/fixinc.tmp
779 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
780 ;; # case end for file name test
787 case "${file}" in ./libgen.h | \
803 if [ ! -r ${DESTFILE} ]
805 else infile=${DESTFILE} ; fi
807 sed -e 's/^[ ]*#[ ]*define[ ]*\([^(]*\)\(([^)]*)\)[ ]*\(_.\)\1\2[ ]*$/#define \1 \3\1/' \
808 < $infile > ${DESTDIR}/fixinc.tmp
810 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
811 ;; # case end for file name test
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
822 -z "`egrep 'include.*stdio.h' ${file}`"
823 ) > /dev/null 2>&1 ; then
826 if [ ! -r ${DESTFILE} ]
828 else infile=${DESTFILE} ; fi
833 < $infile > ${DESTDIR}/fixinc.tmp
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
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
849 -z "`egrep 'include.*stdlib.h' ${file}`"
850 ) > /dev/null 2>&1 ; then
852 broken_assert_stdlib
"
853 if [ ! -r ${DESTFILE} ]
855 else infile=${DESTFILE} ; fi
862 < $infile > ${DESTDIR}/fixinc.tmp
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
872 # Fix 22: Bsd43_Io_Macros
874 if ( test -n "`egrep 'BSD43__IO' ${file}`"
875 ) > /dev/null 2>&1 ; then
878 if [ ! -r ${DESTFILE} ]
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
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 )
896 if [ ! -r ${DESTFILE} ]
898 else infile=${DESTFILE} ; fi
900 sed -e '/^[ ]*float[ ]*fasm/i\
903 -e '/^[ ]*#[ ]*pragma[ ]*intrinsic([ ]*dasm/a\
906 < $infile > ${DESTDIR}/fixinc.tmp
908 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
909 ;; # case end for file name test
914 # Fix 24: No_Double_Slash
916 if ${FIXTESTS} ${file} double_slash
920 if [ ! -r ${DESTFILE} ]
922 else infile=${DESTFILE} ; fi
923 ${FIXFIXES} ${file} no_double_slash < $infile > ${DESTDIR}/fixinc.tmp
925 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
926 fi # end of c_test 'if'
932 case "${file}" in ./sunwindow/win_lock.h | \
933 ./sunwindow/win_cursor.h )
936 if [ ! -r ${DESTFILE} ]
938 else infile=${DESTFILE} ; fi
940 sed -e 's/ecd.cursor/ecd_cursor/' \
941 < $infile > ${DESTDIR}/fixinc.tmp
943 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
944 ;; # case end for file name test
949 # Fix 26: Sco5_Stat_Wrappers
951 case "${file}" in ./sys/stat.h )
952 case "$target_canonical" in i*86-*-sco3.2v5* )
955 if [ ! -r ${DESTFILE} ]
957 else infile=${DESTFILE} ; fi
959 sed -e '/^static int[ ]*[a-z]*stat(/i\
968 #endif /* __cplusplus */\
970 < $infile > ${DESTDIR}/fixinc.tmp
972 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
973 ;; # case end for machine type test
975 ;; # case end for file name test
980 # Fix 27: End_Else_Label
982 if ${FIXTESTS} ${file} else_endif_label
986 if [ ! -r ${DESTFILE} ]
988 else infile=${DESTFILE} ; fi
989 ${FIXFIXES} ${file} else_endif_label < $infile > ${DESTDIR}/fixinc.tmp
991 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
992 fi # end of c_test 'if'
998 case "${file}" in ./sys/spinlock.h )
999 if ( test -n "`egrep 'include.*\"\\.\\./machine/' ${file}`"
1000 ) > /dev/null 2>&1 ; then
1003 if [ ! -r ${DESTFILE} ]
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
1011 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1012 fi # end of select 'if'
1013 ;; # case end for file name test
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
1025 if [ ! -r ${DESTFILE} ]
1027 else infile=${DESTFILE} ; fi
1029 sed -e 's/(\.\.\.)/(struct file * ...)/' \
1030 < $infile > ${DESTDIR}/fixinc.tmp
1032 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1033 fi # end of select 'if'
1034 ;; # case end for file name test
1039 # Fix 30: Cxx_Unready
1041 case "${file}" in ./sys/mman.h | \
1044 -z "`egrep '\"C\"|__BEGIN_DECLS' ${file}`"
1045 ) > /dev/null 2>&1 ; then
1048 if [ ! -r ${DESTFILE} ]
1050 else infile=${DESTFILE} ; fi
1063 < $infile > ${DESTDIR}/fixinc.tmp
1065 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1066 fi # end of bypass 'if'
1067 ;; # case end for file name test
1072 # Fix 31: Hpux_Maxint
1074 case "${file}" in ./sys/param.h )
1077 if [ ! -r ${DESTFILE} ]
1079 else infile=${DESTFILE} ; fi
1081 sed -e '/^#[ ]*define[ ]*MAXINT[ ]/i\
1084 -e '/^#[ ]*define[ ]*MAXINT[ ]/a\
1087 < $infile > ${DESTDIR}/fixinc.tmp
1089 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1090 ;; # case end for file name test
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
1102 if [ ! -r ${DESTFILE} ]
1104 else infile=${DESTFILE} ; fi
1106 sed -e 's/^extern struct sigevent;/struct sigevent;/' \
1107 < $infile > ${DESTDIR}/fixinc.tmp
1109 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1110 fi # end of select 'if'
1111 ;; # case end for file name test
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
1123 if [ ! -r ${DESTFILE} ]
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
1130 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1131 fi # end of select 'if'
1132 ;; # case end for file name test
1137 # Fix 34: Interactv_Add1
1139 case "${file}" in ./stdio.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
1150 if [ ! -r ${DESTFILE} ]
1152 else infile=${DESTFILE} ; fi
1154 sed -e 's/!defined(__STDC__) && !defined(_POSIX_SOURCE)/!defined(_POSIX_SOURCE)/' \
1155 < $infile > ${DESTDIR}/fixinc.tmp
1157 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1158 fi # end of test expression 'if'
1159 ;; # case end for file name test
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
1172 if [ ! -r ${DESTFILE} ]
1174 else infile=${DESTFILE} ; fi
1176 sed -e 's/fmod(double)/fmod(double, double)/' \
1177 < $infile > ${DESTDIR}/fixinc.tmp
1179 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1180 fi # end of test expression 'if'
1181 ;; # case end for file name test
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
1194 if [ ! -r ${DESTFILE} ]
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
1202 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1203 fi # end of test expression 'if'
1204 ;; # case end for file name test
1209 # Fix 37: Io_Def_Quotes
1211 if ( test -n "`egrep '[ ]*[ ](_|DES)IO[A-Z]*[ ]*\\( *[^,'\\'']' ${file}`"
1212 ) > /dev/null 2>&1 ; then
1215 if [ ! -r ${DESTFILE} ]
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
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
1236 if [ ! -r ${DESTFILE} ]
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
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 )
1258 if [ ! -r ${DESTFILE} ]
1260 else infile=${DESTFILE} ; fi
1262 sed -e '/^struct/,/^};/s/}$/};/' \
1263 < $infile > ${DESTDIR}/fixinc.tmp
1265 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1266 ;; # case end for file name test
1271 # Fix 40: Irix_Multiline_Cmnt
1273 case "${file}" in ./sys/types.h )
1275 irix_multiline_cmnt
"
1276 if [ ! -r ${DESTFILE} ]
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
1284 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1285 ;; # case end for file name test
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
1297 if [ ! -r ${DESTFILE} ]
1299 else infile=${DESTFILE} ; fi
1301 sed -e '/authdes_create.*struct sockaddr/i\
1304 < $infile > ${DESTDIR}/fixinc.tmp
1306 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1307 fi # end of select 'if'
1308 ;; # case end for file name test
1313 # Fix 42: Irix_Struct__File
1315 case "${file}" in ./rpc/xdr.h )
1318 if [ ! -r ${DESTFILE} ]
1320 else infile=${DESTFILE} ; fi
1322 sed -e '/xdrstdio_create.*struct __file_s/i\
1325 < $infile > ${DESTDIR}/fixinc.tmp
1327 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1328 ;; # case end for file name test
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
1339 irix_asm_apostrophe
"
1340 if [ ! -r ${DESTFILE} ]
1342 else infile=${DESTFILE} ; fi
1344 sed -e '/^[ ]*#/s/\([Ww]e\)'\''re/\1 are/' \
1345 < $infile > ${DESTDIR}/fixinc.tmp
1347 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1348 fi # end of select 'if'
1349 ;; # case end for file name test
1356 case "${file}" in ./math.h )
1357 if ( test -n "`egrep 'fmod\\(double\\)' ${file}`"
1358 ) > /dev/null 2>&1 ; then
1361 if [ ! -r ${DESTFILE} ]
1363 else infile=${DESTFILE} ; fi
1365 sed -e 's/fmod(double)/fmod(double, double)/' \
1366 < $infile > ${DESTDIR}/fixinc.tmp
1368 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1369 fi # end of select 'if'
1370 ;; # case end for file name test
1375 # Fix 45: Motorola_Nested
1377 case "${file}" in ./limits.h | \
1379 case "$target_canonical" in m68k-motorola-sysv* )
1382 if [ ! -r ${DESTFILE} ]
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
1390 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1391 ;; # case end for machine type test
1393 ;; # case end for file name test
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
1405 if [ ! -r ${DESTFILE} ]
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
1413 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1414 fi # end of select 'if'
1415 ;; # case end for file name test
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 | \
1433 ./dev/chardefmac.h | \
1438 ./Xm.acorn/XmP.h | \
1440 if ( test -n "`egrep '/\\*\\*/' ${file}`"
1441 ) > /dev/null 2>&1 ; then
1444 if [ ! -r ${DESTFILE} ]
1446 else infile=${DESTFILE} ; fi
1448 sed -e 's|/\*\*/|##|g' \
1449 < $infile > ${DESTDIR}/fixinc.tmp
1451 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1452 fi # end of select 'if'
1453 ;; # case end for file name test
1458 # Fix 48: Limits_Ifndefs
1460 case "${file}" in ./limits.h | \
1463 -z "`egrep 'ifndef[ ]+FLT_MIN' ${file}`"
1464 ) > /dev/null 2>&1 ; then
1467 if [ ! -r ${DESTFILE} ]
1469 else infile=${DESTFILE} ; fi
1471 sed -e '/[ ]FLT_MIN[ ]/i\
1474 -e '/[ ]FLT_MIN[ ]/a\
1477 -e '/[ ]FLT_MAX[ ]/i\
1480 -e '/[ ]FLT_MAX[ ]/a\
1483 -e '/[ ]FLT_DIG[ ]/i\
1486 -e '/[ ]FLT_DIG[ ]/a\
1489 -e '/[ ]DBL_MIN[ ]/i\
1492 -e '/[ ]DBL_MIN[ ]/a\
1495 -e '/[ ]DBL_MAX[ ]/i\
1498 -e '/[ ]DBL_MAX[ ]/a\
1501 -e '/[ ]DBL_DIG[ ]/i\
1504 -e '/[ ]DBL_DIG[ ]/a\
1507 -e '/^\(\/\*#define HUGE_VAL 3\.[0-9e+]* *\)\/\*/s//\1/' \
1508 < $infile > ${DESTDIR}/fixinc.tmp
1510 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1511 fi # end of bypass 'if'
1512 ;; # case end for file name test
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
1524 if [ ! -r ${DESTFILE} ]
1526 else infile=${DESTFILE} ; fi
1528 sed -e '/#[ ]*define[ ][ ]*void[ ]int/d' \
1529 < $infile > ${DESTDIR}/fixinc.tmp
1531 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1532 fi # end of select 'if'
1533 ;; # case end for file name test
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
1545 if [ ! -r ${DESTFILE} ]
1547 else infile=${DESTFILE} ; fi
1549 sed -e 's/\(fcntl.*(int, int, \)int)/\1...)/' \
1550 < $infile > ${DESTDIR}/fixinc.tmp
1552 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1553 fi # end of select 'if'
1554 ;; # case end for file name test
1559 # Fix 51: M88k_Bad_Hypot_Opt
1561 case "${file}" in ./math.h )
1562 case "$target_canonical" in m88k-motorola-sysv3* )
1565 if [ ! -r ${DESTFILE} ]
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! *\/\
1574 static __inline__ double fake_hypot (double x, double y)\
1576 static __inline__ double fake_hypot (x, y)\
1580 return fabs (hypot (x, y));\
1582 #define hypot fake_hypot
1584 < $infile > ${DESTDIR}/fixinc.tmp
1586 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1587 ;; # case end for machine type test
1589 ;; # case end for file name test
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
1602 if [ ! -r ${DESTFILE} ]
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
1610 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
1611 fi # end of select 'if'
1612 ;; # case end for machine type test
1614 ;; # case end for file name test
1619 # Fix 53: M88k_Multi_Incl
1621 case "${file}" in ./time.h )
1622 case "$target_canonical" in m88k-tektronix-sysv3* )
1624 -z "`egrep '#ifndef' ${file}`"
1625 ) > /dev/null 2>&1 ; then
1628 if [ ! -r ${DESTFILE} ]
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
1644 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1645 fi # end of bypass 'if'
1646 ;; # case end for machine type test
1648 ;; # case end for file name test
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
1659 if [ ! -r ${DESTFILE} ]
1661 else infile
=${DESTFILE} ; fi
1665 s/\\$/\\+++fixinc_eol+++/
1667 s/\\+++fixinc_eol+++/\\/g
1669 s/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /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
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
1696 s/ \([a-zA-Z0-9_][a-zA-Z0-9_]*\) /\1/g
1698 < $infile > ${DESTDIR}/fixinc.tmp
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
1712 if [ ! -r ${DESTFILE} ]
1714 else infile
=${DESTFILE} ; fi
1716 sed -e '/struct exception/i\
1718 #define exception __math_exception\
1721 -e '/struct exception/a\
1728 #define exception __math_exception\
1736 < $infile > ${DESTDIR}/fixinc.tmp
1738 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1739 fi # end of select 'if'
1740 ;; # case end for file name test
1745 # Fix 56: Math_Gcc_Ifndefs
1747 case "${file}" in .
/math.h
)
1750 if [ ! -r ${DESTFILE} ]
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`"
1759 then sed -e '/define[ ]HUGE_VAL[ ]DBL_MAX/s/DBL_MAX/$dbl_max_def/'
1761 sed -e '/define[ ]HUGE_VAL[ ]/i\
1763 ' -e '/define[ ]HUGE_VAL[ ]/a\
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
1773 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1774 ;; # case end for file name test
1779 # Fix 57: Nested_Comment
1781 case "${file}" in .
/rpc
/rpc.h
)
1784 if [ ! -r ${DESTFILE} ]
1786 else infile
=${DESTFILE} ; fi
1788 sed -e 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@' \
1789 < $infile > ${DESTDIR}/fixinc.tmp
1791 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1792 ;; # case end for file name test
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
1804 if [ ! -r ${DESTFILE} ]
1806 else infile
=${DESTFILE} ; fi
1808 sed -e '/^#include <stdlib.h>/i\
1809 #ifdef BOGUS_RECURSION
1811 -e '/^#include <stdlib.h>/a\
1814 < $infile > ${DESTDIR}/fixinc.tmp
1816 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1817 fi # end of select 'if'
1818 ;; # case end for file name test
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
1830 if [ ! -r ${DESTFILE} ]
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
1841 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1842 fi # end of select 'if'
1843 ;; # case end for file name test
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
1855 if [ ! -r ${DESTFILE} ]
1857 else infile
=${DESTFILE} ; fi
1859 sed -e '/\(.*template\)/s/template//' \
1860 -e '/extern.*volatile.*void.*abort/s/volatile//' \
1861 < $infile > ${DESTDIR}/fixinc.tmp
1863 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1864 fi # end of select 'if'
1865 ;; # case end for file name test
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
1877 if [ ! -r ${DESTFILE} ]
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
1885 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1886 fi # end of select 'if'
1887 ;; # case end for file name test
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
1899 if [ ! -r ${DESTFILE} ]
1901 else infile
=${DESTFILE} ; fi
1903 sed -e 's@wait(union wait@wait(void@' \
1904 < $infile > ${DESTDIR}/fixinc.tmp
1906 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1907 fi # end of select 'if'
1908 ;; # case end for file name test
1913 # Fix 63: Nodeent_Syntax
1915 case "${file}" in .
/netdnet
/dnetdb.h
)
1918 if [ ! -r ${DESTFILE} ]
1920 else infile
=${DESTFILE} ; fi
1922 sed -e 's/char.*na_addr *$/char *na_addr;/' \
1923 < $infile > ${DESTDIR}/fixinc.tmp
1925 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1926 ;; # case end for file name test
1931 # Fix 64: Osf_Namespace_A
1933 case "${file}" in .
/reg_types.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
1942 if [ ! -r ${DESTFILE} ]
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
1951 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1952 fi # end of test expression 'if'
1953 ;; # case end for file name test
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
1968 if [ ! -r ${DESTFILE} ]
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
1979 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1980 fi # end of test expression 'if'
1981 ;; # case end for file name test
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
1993 if [ ! -r ${DESTFILE} ]
1995 else infile
=${DESTFILE} ; fi
1997 sed -e 's/^int __page_size/extern int __page_size/' \
1998 < $infile > ${DESTDIR}/fixinc.tmp
2000 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2001 fi # end of select 'if'
2002 ;; # case end for file name test
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
2014 if [ ! -r ${DESTFILE} ]
2016 else infile
=${DESTFILE} ; fi
2018 sed -e 's/^\(extern int fclose(), fflush()\), \(fread(), fwrite()\)\(.*\)$/extern unsigned int \2;\
2020 < $infile > ${DESTDIR}/fixinc.tmp
2022 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2023 fi # end of select 'if'
2024 ;; # case end for file name test
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
2036 if [ ! -r ${DESTFILE} ]
2038 else infile
=${DESTFILE} ; fi
2040 sed -e '/class[(]/i\
2046 < $infile > ${DESTDIR}/fixinc.tmp
2048 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2049 fi # end of select 'if'
2050 ;; # case end for file name test
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
2062 if [ ! -r ${DESTFILE} ]
2064 else infile
=${DESTFILE} ; fi
2066 sed -e 's/fchmod(char \*/fchmod(int/' \
2067 < $infile > ${DESTDIR}/fixinc.tmp
2069 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2070 fi # end of select 'if'
2071 ;; # case end for file name test
2076 # Fix 70: Rs6000_Param
2078 case "${file}" in .
/stdio.h | \
2082 if [ ! -r ${DESTFILE} ]
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
2089 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2090 ;; # case end for file name test
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
2102 if [ ! -r ${DESTFILE} ]
2104 else infile
=${DESTFILE} ; fi
2106 sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \
2107 < $infile > ${DESTDIR}/fixinc.tmp
2109 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2110 fi # end of select 'if'
2111 ;; # case end for file name test
2116 # Fix 72: Statsswtch
2118 case "${file}" in .
/rpcsvc
/rstat.h
)
2119 if ( test -n "`egrep 'boottime$' ${file}`"
2120 ) > /dev
/null
2>&1 ; then
2123 if [ ! -r ${DESTFILE} ]
2125 else infile
=${DESTFILE} ; fi
2127 sed -e 's/boottime$/boottime;/' \
2128 < $infile > ${DESTDIR}/fixinc.tmp
2130 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2131 fi # end of select 'if'
2132 ;; # case end for file name test
2137 # Fix 73: Stdio_Va_List
2139 case "${file}" in .
/stdio.h
)
2142 if [ ! -r ${DESTFILE} ]
2144 else infile
=${DESTFILE} ; fi
2145 ( if ( egrep "__need___va_list" $file ) > /dev
/null
2>&1 ; then
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
2170 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2171 ;; # case end for file name test
2176 # Fix 74: Sun_Bogus_Ifdef
2178 case "${file}" in .
/hsfs
/hsfs_spec.h | \
2180 if ( test -n "`egrep '#ifdef __i386__ || __vax__' ${file}`"
2181 ) > /dev
/null
2>&1 ; then
2184 if [ ! -r ${DESTFILE} ]
2186 else infile
=${DESTFILE} ; fi
2188 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
2189 < $infile > ${DESTDIR}/fixinc.tmp
2191 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2192 fi # end of select 'if'
2193 ;; # case end for file name test
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
2204 sun_bogus_ifdef_sun4c"
2205 if [ ! -r ${DESTFILE} ]
2207 else infile
=${DESTFILE} ; fi
2209 sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \
2210 < $infile > ${DESTDIR}/fixinc.tmp
2212 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2213 fi # end of select 'if'
2214 ;; # case end for file name test
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
2226 if [ ! -r ${DESTFILE} ]
2228 else infile
=${DESTFILE} ; fi
2230 sed -e '/^#define[ ]CAT(a,b)/ i\
2232 #define CAT(a,b) a##b\
2235 -e '/^#define[ ]CAT(a,b)/ a\
2238 < $infile > ${DESTDIR}/fixinc.tmp
2240 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2241 fi # end of select 'if'
2242 ;; # case end for file name test
2247 # Fix 77: Sun_Malloc
2249 case "${file}" in .
/malloc.h
)
2252 if [ ! -r ${DESTFILE} ]
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
2262 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2263 ;; # case end for file name test
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
2275 if [ ! -r ${DESTFILE} ]
2277 else infile
=${DESTFILE} ; fi
2280 /* This file was generated by fixincludes */\
2281 #ifndef __memory_h__\
2282 #define __memory_h__\
2285 extern void *memccpy();\
2286 extern void *memchr();\
2287 extern void *memcpy();\
2288 extern void *memset();\
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__ */
2301 < $infile > ${DESTDIR}/fixinc.tmp
2303 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2304 fi # end of select 'if'
2305 ;; # case end for file name test
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
2317 if [ ! -r ${DESTFILE} ]
2319 else infile
=${DESTFILE} ; fi
2321 sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' \
2322 < $infile > ${DESTDIR}/fixinc.tmp
2324 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2325 fi # end of select 'if'
2326 ;; # case end for file name test
2331 # Fix 80: Sun_Signal
2333 case "${file}" in .
/sys
/signal.h | \
2335 if ( test -n "`egrep '^void \\(\\*signal\\(\\)\\)\\(\\);' ${file}`"
2336 ) > /dev
/null
2>&1 ; then
2339 if [ ! -r ${DESTFILE} ]
2341 else infile
=${DESTFILE} ; fi
2343 sed -e '/^void (\*signal())();$/i\
2345 void (*signal(...))(...);\
2348 -e '/^void (\*signal())();$/a\
2351 < $infile > ${DESTDIR}/fixinc.tmp
2353 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2354 fi # end of select 'if'
2355 ;; # case end for file name test
2360 # Fix 81: Sun_Auth_Proto
2362 case "${file}" in .
/rpc
/auth.h | \
2366 if ( test -n "`egrep '\\(\\*[a-z][a-z_]*\\)\\(\\)' ${file}`"
2367 ) > /dev
/null
2>&1 ; then
2370 if [ ! -r ${DESTFILE} ]
2372 else infile
=${DESTFILE} ; fi
2374 sed -e 's/^\(.*(\*[a-z][a-z_]*)(\)\();.*\)/\
2380 < $infile > ${DESTDIR}/fixinc.tmp
2382 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2383 fi # end of select 'if'
2384 ;; # case end for file name test
2389 # Fix 82: Sunos_Matherr_Decl
2391 case "${file}" in .
/math.h
)
2394 if [ ! -r ${DESTFILE} ]
2396 else infile
=${DESTFILE} ; fi
2398 sed -e '/^struct exception/,$b' \
2402 < $infile > ${DESTDIR}/fixinc.tmp
2404 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2405 ;; # case end for file name test
2410 # Fix 83: Sunos_Strlen
2412 case "${file}" in .
/strings.h
)
2415 if [ ! -r ${DESTFILE} ]
2417 else infile
=${DESTFILE} ; fi
2419 sed -e 's/int[ ]*strlen();/__SIZE_TYPE__ strlen();/' \
2420 < $infile > ${DESTDIR}/fixinc.tmp
2422 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2423 ;; # case end for file name test
2430 case "${file}" in .
/sys
/types.h | \
2432 .
/sys
/stdtypes.h | \
2436 if ( test -n "`egrep 'typedef[ ]+[a-z_][ a-z_]*[ ](size|ptrdiff|wchar)_t' ${file}`"
2437 ) > /dev
/null
2>&1 ; then
2440 if [ ! -r ${DESTFILE} ]
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\
2449 typedef __SIZE_TYPE__ size_t;\
2451 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/i\
2452 #ifndef __SIZE_TYPE__\
2453 #define __SIZE_TYPE__ long unsigned int\
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\
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\
2469 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/a\
2472 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/typedef __WCHAR_TYPE__ wchar_t/' \
2473 < $infile > ${DESTDIR}/fixinc.tmp
2475 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2476 fi # end of select 'if'
2477 ;; # case end for file name test
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
2488 -z "`egrep '_GCC_SIZE_T' ${file}`"
2489 ) > /dev
/null
2>&1 ; then
2492 if [ ! -r ${DESTFILE} ]
2494 else infile
=${DESTFILE} ; fi
2496 sed -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/i\
2497 #ifndef _GCC_SIZE_T\
2500 -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/a\
2503 < $infile > ${DESTDIR}/fixinc.tmp
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
2513 # Fix 86: Sysv68_String
2515 case "${file}" in .
/string.h
)
2518 if [ ! -r ${DESTFILE} ]
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\
2531 -e '/^extern int$/N' \
2532 -e 's/^extern int\(\n strlen(),\)/extern size_t\1/' \
2533 < $infile > ${DESTDIR}/fixinc.tmp
2535 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2536 ;; # case end for file name test
2541 # Fix 87: Sysz_Stdlib_For_Sun
2543 case "${file}" in .
/stdlib.h
)
2545 sysz_stdlib_for_sun"
2546 if [ ! -r ${DESTFILE} ]
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\
2561 -e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/a\
2564 < $infile > ${DESTDIR}/fixinc.tmp
2566 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2567 ;; # case end for file name test
2572 # Fix 88: Sysz_Stdtypes_For_Sun
2574 case "${file}" in .
/sys
/stdtypes.h
)
2576 sysz_stdtypes_for_sun"
2577 if [ ! -r ${DESTFILE} ]
2579 else infile
=${DESTFILE} ; fi
2581 sed -e '/[ ]size_t.*;/i\
2582 #ifndef _GCC_SIZE_T\
2585 -e '/[ ]size_t.*;/a\
2588 -e '/[ ]ptrdiff_t.*;/i\
2589 #ifndef _GCC_PTRDIFF_T\
2590 #define _GCC_PTRDIFF_T
2592 -e '/[ ]ptrdiff_t.*;/a\
2595 -e '/[ ]wchar_t.*;/i\
2596 #ifndef _GCC_WCHAR_T\
2597 #define _GCC_WCHAR_T
2599 -e '/[ ]wchar_t.*;/a\
2602 < $infile > ${DESTDIR}/fixinc.tmp
2604 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2605 ;; # case end for file name test
2610 # Fix 89: Tinfo_Cplusplus
2612 case "${file}" in .
/tinfo.h
)
2615 if [ ! -r ${DESTFILE} ]
2617 else infile
=${DESTFILE} ; fi
2619 sed -e 's/[ ]_cplusplus/ __cplusplus/' \
2620 < $infile > ${DESTDIR}/fixinc.tmp
2622 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2623 ;; # case end for file name test
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
2635 if [ ! -r ${DESTFILE} ]
2637 else infile
=${DESTFILE} ; fi
2640 /* This file intentionally left blank. */
2643 < $infile > ${DESTDIR}/fixinc.tmp
2645 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2646 fi # end of select 'if'
2647 ;; # case end for file name test
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
2658 ultrix_fix_fixproto"
2659 if [ ! -r ${DESTFILE} ]
2661 else infile
=${DESTFILE} ; fi
2663 sed -e '/^[ ]*extern[ ]*int[ ]*uname();$/i\
2666 < $infile > ${DESTDIR}/fixinc.tmp
2668 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2669 fi # end of select 'if'
2670 ;; # case end for file name test
2675 # Fix 92: Ultrix_Atof_Param
2677 case "${file}" in .
/math.h
)
2680 if [ ! -r ${DESTFILE} ]
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
2691 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2692 ;; # case end for file name test
2697 # Fix 93: Ultrix_Const
2699 case "${file}" in .
/stdio.h
)
2702 if [ ! -r ${DESTFILE} ]
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
2717 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2718 ;; # case end for file name test
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
2730 if [ ! -r ${DESTFILE} ]
2732 else infile
=${DESTFILE} ; fi
2734 sed -e 's/#ifdef KERNEL/#if defined(KERNEL)/' \
2735 < $infile > ${DESTDIR}/fixinc.tmp
2737 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2738 fi # end of select 'if'
2739 ;; # case end for file name test
2744 # Fix 95: Ultrix_Nested_Cmnt
2746 case "${file}" in .
/rpc
/svc.h
)
2749 if [ ! -r ${DESTFILE} ]
2751 else infile
=${DESTFILE} ; fi
2753 sed -e 's@^\( \* int protocol; \)/\*@\1*/ /*@' \
2754 < $infile > ${DESTDIR}/fixinc.tmp
2756 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2757 ;; # case end for file name test
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
2769 if [ ! -r ${DESTFILE} ]
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
2778 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2779 fi # end of select 'if'
2780 ;; # case end for file name test
2785 # Fix 97: Undefine_Null
2787 if ( test -n "`egrep '^#[ ]*define[ ]*[ ]NULL[ ]' ${file}`"
2788 ) > /dev
/null
2>&1 ; then
2790 -z "`egrep '#[ ]*(ifn|un)def[ ]*[ ]NULL($|[ ])' ${file}`"
2791 ) > /dev
/null
2>&1 ; then
2794 if [ ! -r ${DESTFILE} ]
2796 else infile
=${DESTFILE} ; fi
2798 sed -e '/^#[ ]*define[ ][ ]*NULL[ ]/i\
2801 < $infile > ${DESTDIR}/fixinc.tmp
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
2816 if [ ! -r ${DESTFILE} ]
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
2826 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2827 fi # end of select 'if'
2828 ;; # case end for file name test
2835 case "${file}" in .
/curses.h | \
2846 if ( test -n "`egrep '#[ ]*define[ ][ ]*NULL[ ].*void' ${file}`"
2847 ) > /dev
/null
2>&1 ; then
2850 if [ ! -r ${DESTFILE} ]
2852 else infile
=${DESTFILE} ; fi
2854 sed -e 's/^#[ ]*define[ ]*NULL[ ]*((void[ ]*\*)0)/#define NULL 0/' \
2855 < $infile > ${DESTDIR}/fixinc.tmp
2857 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2858 fi # end of select 'if'
2859 ;; # case end for file name test
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
2870 vxworks_gcc_problem"
2871 if [ ! -r ${DESTFILE} ]
2873 else infile
=${DESTFILE} ; fi
2875 sed -e 's/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/#if 1/' \
2877 #ifndef _GCC_SIZE_T\
2883 -e '/[ ]ptrdiff_t/i\
2884 #ifndef _GCC_PTRDIFF_T\
2885 #define _GCC_PTRDIFF_T
2887 -e '/[ ]ptrdiff_t/a\
2891 #ifndef _GCC_WCHAR_T\
2892 #define _GCC_WCHAR_T
2897 < $infile > ${DESTDIR}/fixinc.tmp
2899 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2900 fi # end of select 'if'
2901 ;; # case end for file name test
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
2912 vxworks_needs_vxtypes"
2913 if [ ! -r ${DESTFILE} ]
2915 else infile
=${DESTFILE} ; fi
2917 sed -e 's/uint_t/unsigned int/' \
2918 < $infile > ${DESTDIR}/fixinc.tmp
2920 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2921 fi # end of select 'if'
2922 ;; # case end for file name test
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
2937 vxworks_needs_vxworks"
2938 if [ ! -r ${DESTFILE} ]
2940 else infile
=${DESTFILE} ; fi
2942 sed -e '/#[ ]define[ ][ ]*__INCstath/a\
2943 #include <types/vxTypesOld.h>
2945 < $infile > ${DESTDIR}/fixinc.tmp
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
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
2964 if [ ! -r ${DESTFILE} ]
2966 else infile
=${DESTFILE} ; fi
2968 sed -e '/VOIDFUNCPTR/i\
2969 #ifndef __gcc_VOIDFUNCPTR_defined\
2971 typedef void (*__gcc_VOIDFUNCPTR) (...);\
2973 typedef void (*__gcc_VOIDFUNCPTR) ();\
2975 #define __gcc_VOIDFUNCPTR_defined\
2978 -e 's/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g' \
2979 < $infile > ${DESTDIR}/fixinc.tmp
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
2989 # Fix 104: X11_Class
2991 case "${file}" in .
/X11
/ShellP.h
)
2993 -z "`egrep '__cplusplus' ${file}`"
2994 ) > /dev
/null
2>&1 ; then
2997 if [ ! -r ${DESTFILE} ]
2999 else infile
=${DESTFILE} ; fi
3001 sed -e '/char \*class;/i\
3006 -e '/char \*class;/a\
3009 < $infile > ${DESTDIR}/fixinc.tmp
3011 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
3012 fi # end of bypass 'if'
3013 ;; # case end for file name test
3018 # Fix 105: X11_Class_Usage
3020 case "${file}" in .
/Xm
/BaseClassI.h
)
3022 -z "`egrep '__cplusplus' ${file}`"
3023 ) > /dev
/null
2>&1 ; then
3026 if [ ! -r ${DESTFILE} ]
3028 else infile
=${DESTFILE} ; fi
3030 sed -e 's/ class[)]/ c_class)/g' \
3031 < $infile > ${DESTDIR}/fixinc.tmp
3033 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
3034 fi # end of bypass 'if'
3035 ;; # case end for file name test
3042 case "${file}" in .
/Xm
/Traversal.h
)
3044 -z "`egrep '__cplusplus' ${file}`"
3045 ) > /dev
/null
2>&1 ; then
3048 if [ ! -r ${DESTFILE} ]
3050 else infile
=${DESTFILE} ; fi
3052 sed -e '/Widget old, new;/i\
3057 -e '/Widget old, new;/a\
3060 -e 's/Widget new,/Widget c_new,/g' \
3061 < $infile > ${DESTDIR}/fixinc.tmp
3063 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
3064 fi # end of bypass 'if'
3065 ;; # case end for file name test
3070 # Fix 107: X11_Sprintf
3072 case "${file}" in .
/X11
*/Xmu.h
)
3075 if [ ! -r ${DESTFILE} ]
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
3084 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
3085 ;; # case end for file name test
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
3096 echo "Fixed ${file}:${fixlist}"
3098 # Find any include directives that use "file".
3100 dir
=`echo ${file} | sed -e s';/[^/]*$;;'`
3101 ddir
=${DESTDIR}/$dir
3104 egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${DESTFILE} |
3105 sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`
3107 required
="$required ${SRCDIR} $dir/$include ${ddir}/$include"
3110 done # for file in $files
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`
3120 while [ $# != 0 ]; do
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.
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
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"
3150 echo 'Cleaning up DONE files.'
3152 find .
-name DONE
-exec rm -f '{}' ';'
3154 echo 'Removing unneeded directories:'
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
3161 # # # # # # # # # # # # # # # # # # # # #
3163 # End of for INPUT directories
3167 # # # # # # # # # # # # # # # # # # # # #
3169 if [ x
${INSTALL_ASSERT_H} != x
] && [ -f ${srcdir}/assert.h
]
3172 rm -f include
/assert.h
3173 cp ${srcdir}/assert.h include
/assert.h ||
exit 1
3174 chmod a
+r include
/assert.h