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 104 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 # Define what target system we're fixing.
59 if test -r .
/Makefile
; then
60 target_canonical
="`sed -n -e 's,^target[ ]*=[ ]*\(.*\)$,\1,p' < Makefile`"
63 # If not from the Makefile, then try config.guess
65 if test -z "${target_canonical}" ; then
66 if test -x .
/config.guess
; then
67 target_canonical
="`config.guess`" ; fi
68 test -z "${target_canonical}" && target_canonical
=unknown
70 export target_canonical
72 # # # # # # # # # # # # # # # # # # # # #
74 # Define PWDCMD as a command to use to get the working dir
75 # in the form that we want.
80 # On an Apollo, discard everything before `/usr'.
81 PWDCMD
="eval pwd | sed -e 's,.*/usr/,/usr/,'"
88 # Make LIB absolute only if needed to avoid problems with the amd.
93 cd $LIB; LIB
=`${PWDCMD}`
97 echo Fixing headers into
${LIB} for ${target_canonical} target
99 # Determine whether this system has symbolic links.
100 if ln -s X
$LIB/ShouldNotExist
2>/dev
/null
; then
101 rm -f $LIB/ShouldNotExist
103 elif ln -s X
/tmp
/ShouldNotExist
2>/dev
/null
; then
104 rm -f /tmp
/ShouldNotExist
110 # # # # # # # # # # # # # # # # # # # # #
112 # Search each input directory for broken header files.
113 # This loop ends near the end of the file.
117 INPUTLIST
="/usr/include"
122 for INPUT
in ${INPUTLIST} ; do
126 cd ${INPUT} ||
continue
130 # # # # # # # # # # # # # # # # # # # # #
132 echo Finding directories and links to directories
134 # Find all directories and all symlinks that point to directories.
135 # Put the list in $all_dirs.
136 # Each time we find a symlink, add it to newdirs
137 # so that we do another find within the dir the link points to.
138 # Note that $all_dirs may have duplicates in it;
139 # later parts of this file are supposed to ignore them.
145 while [ -n "$dirs" ] && [ $levels -gt 0 ]
147 levels
=`expr $levels - 1`
151 echo " Searching $INPUT/$d"
153 # Find all directories under $d, relative to $d, excluding $d itself.
154 # (The /. is needed after $d in case $d is a symlink.)
155 all_dirs
="$all_dirs `find $d/. -type d -print | \
156 sed -e '/\/\.$/d' -e 's@/./@/@g'`"
157 # Find all links to directories.
158 # Using `-exec test -d' in find fails on some systems,
159 # and trying to run test via sh fails on others,
160 # so this is the simplest alternative left.
161 # First find all the links, then test each one.
164 theselinks
=`find $d/. -type l -print | sed -e 's@/./@/@g'`
165 for d1
in $theselinks --dummy--
167 # If the link points to a directory,
168 # add that dir to $newdirs
171 all_dirs
="$all_dirs $d1"
172 if [ "`ls -ld $d1 | sed -n 's/.*-> //p'`" != "." ]
174 newdirs
="$newdirs $d1"
175 search_dirs
="$search_dirs $d1"
184 # # # # # # # # # # # # # # # # # # # # #
187 echo "All directories (including links to directories):"
190 for file in $all_dirs; do
192 if [ ! -d $LIB/$file ]
193 then mkdir
$LIB/$file
198 # # # # # # # # # # # # # # # # # # # # #
200 # treetops gets an alternating list
201 # of old directories to copy
202 # and the new directories to copy to.
206 echo 'Making symbolic directory links'
209 for sym_link
in $search_dirs; do
211 dest
=`ls -ld ${sym_link} | sed -n 's/.*-> //p'`
213 # In case $dest is relative, get to ${sym_link}'s dir first.
215 cd .
/`echo ${sym_link} | sed 's;/[^/]*$;;'`
217 # Check that the target directory exists.
218 # Redirections changed to avoid bug in sh on Ultrix.
220 (cd $dest) > /dev
/null
2>&1
224 # full_dest_dir gets the dir that the link actually leads to.
226 full_dest_dir
=`${PWDCMD}`
228 # Canonicalize ${INPUT} now to minimize the time an
229 # automounter has to change the result of ${PWDCMD}.
231 cinput
=`cd ${INPUT}; ${PWDCMD}`
233 # If a link points to ., make a similar link to .
235 if [ ${full_dest_dir} = ${cinput} ]; then
236 echo ${sym_link} '->' .
': Making self link'
237 rm -fr ${LIB}/${sym_link} > /dev
/null
2>&1
238 ln -s .
${LIB}/${sym_link} > /dev
/null
2>&1
240 # If link leads back into ${INPUT},
241 # make a similar link here.
243 elif expr ${full_dest_dir} : "${cinput}/.*" > /dev
/null
; then
244 # Y gets the actual target dir name, relative to ${INPUT}.
245 y
=`echo ${full_dest_dir} | sed -n "s&${cinput}/&&p"`
246 # DOTS is the relative path from ${LIB}/${sym_link} back to ${LIB}.
247 dots
=`echo "${sym_link}" |
248 sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
249 echo ${sym_link} '->' $dots$y ': Making local link'
250 rm -fr ${LIB}/${sym_link} > /dev
/null
2>&1
251 ln -s $dots$y ${LIB}/${sym_link} > /dev
/null
2>&1
254 # If the link is to a dir $target outside ${INPUT},
255 # repoint the link at ${INPUT}/root$target
256 # and process $target into ${INPUT}/root$target
257 # treat this directory as if it actually contained the files.
259 echo ${sym_link} '->' root
${full_dest_dir} ': Making rooted link'
260 if [ -d $LIB/root
${full_dest_dir} ]
263 dirname=root
${full_dest_dir}/
266 while [ x
$dirname != x
]; do
267 component
=`echo $dirname | sed -e 's|/.*$||'`
268 mkdir
$component >/dev
/null
2>&1
270 dirmade
=$dirmade/$component
271 dirname=`echo $dirname | sed -e 's|[^/]*/||'`
275 # Duplicate directory structure created in ${LIB}/${sym_link} in new
278 for file2
in $all_dirs; do
281 dupdir
=${LIB}/root
${full_dest_dir}/`echo $file2 |
282 sed -n "s|^${sym_link}/||p"`
283 echo "Duplicating ${sym_link}'s ${dupdir}"
295 # Get the path from ${LIB} to ${sym_link}, accounting for symlinks.
297 parent
=`echo "${sym_link}" | sed -e 's@/[^/]*$@@'`
298 libabs
=`cd ${LIB}; ${PWDCMD}`
299 file2
=`cd ${LIB}; cd $parent; ${PWDCMD} | sed -e "s@^${libabs}@@"`
301 # DOTS is the relative path from ${LIB}/${sym_link} back to ${LIB}.
303 dots
=`echo "$file2" | sed -e 's@/[^/]*@../@g'`
304 rm -fr ${LIB}/${sym_link} > /dev
/null
2>&1
305 ln -s ${dots}root${full_dest_dir} ${LIB}/${sym_link} > /dev
/null
2>&1
306 treetops
="$treetops ${sym_link} ${LIB}/root${full_dest_dir}"
312 # # # # # # # # # # # # # # # # # # # # #
317 while [ $# != 0 ]; do
318 # $1 is an old directory to copy, and $2 is the new directory to copy to.
320 SRCDIR
=`cd ${INPUT} ; cd $1 ; ${PWDCMD}`
327 DESTDIR
=`cd $1;${PWDCMD}`
331 # The same dir can appear more than once in treetops.
332 # There's no need to scan it more than once.
334 if [ -f ${DESTDIR}/DONE
]
337 touch ${DESTDIR}/DONE
338 echo Fixing directory
${SRCDIR} into
${DESTDIR}
340 # Check files which are symlinks as well as those which are files.
343 files
=`if $LINKS; then
344 find ${FIND_BASE}/. -name '*.h' \( -type f -o -type l \) -print
346 find ${FIND_BASE}/. -name '*.h' -type f -print
348 sed -e 's;/\./;/;g' -e 's;//*;/;g' `
350 echo Checking header files
351 for file in $files; do
353 # Skip unreadable files, symlinks to directories and glibc files
354 if test ! -r "${file}" ||
test -d "${file}/." \
355 || fgrep
'This file is part of the GNU C Library' "${file}" \
356 > /dev
/null
2>&1; then
361 DESTFILE
=${DESTDIR}/`echo ${file} | sed "s;${FIND_BASE}/;;" `
366 case "${file}" in ./sys/wait.h )
367 if ( test -n "`egrep 'bos325,' ${file}`"
368 ) > /dev/null 2>&1 ; then
371 if [ ! -r ${DESTFILE} ]
373 else infile=${DESTFILE} ; fi
375 sed -e '/^extern pid_t wait3();$/i\
378 < $infile > ${DESTDIR}/fixinc.tmp
380 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
381 fi # end of selection 'if'
382 ;; # case end for file name test
387 # Fix 2: Aix_Volatile
389 case "${file}" in ./sys/signal.h )
390 if ( test -n "`egrep 'typedef volatile int sig_atomic_t' ${file}`"
391 ) > /dev/null 2>&1 ; then
394 if [ ! -r ${DESTFILE} ]
396 else infile=${DESTFILE} ; fi
398 sed -e 's/typedef volatile int sig_atomic_t/typedef int sig_atomic_t/' \
399 < $infile > ${DESTDIR}/fixinc.tmp
401 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
402 fi # end of selection 'if'
403 ;; # case end for file name test
408 # Fix 3: Alpha_Getopt
410 case "${file}" in ./stdio.h | \
412 if ( test -n "`egrep 'getopt\\(int, char \\*\\[' ${file}`"
413 ) > /dev/null 2>&1 ; then
416 if [ ! -r ${DESTFILE} ]
418 else infile=${DESTFILE} ; fi
420 sed -e 's/getopt(int, char \*\[\],[ ]*char \*)/getopt(int, char *const[], const char *)/' \
421 < $infile > ${DESTDIR}/fixinc.tmp
423 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
424 fi # end of selection 'if'
425 ;; # case end for file name test
430 # Fix 4: Alpha_Parens
432 case "${file}" in ./sym.h )
433 if ( test -n "`egrep '#ifndef\\(__mips64\\)' ${file}`"
434 ) > /dev/null 2>&1 ; then
437 if [ ! -r ${DESTFILE} ]
439 else infile=${DESTFILE} ; fi
441 sed -e 's/#ifndef(__mips64)/#ifndef __mips64/' \
442 < $infile > ${DESTDIR}/fixinc.tmp
444 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
445 fi # end of selection 'if'
446 ;; # case end for file name test
453 case "${file}" in ./unistd.h )
454 if ( test -n "`egrep 'char[ ]*\\*[ ]*sbrk[ ]*\\(' ${file}`"
455 ) > /dev/null 2>&1 ; then
458 if [ ! -r ${DESTFILE} ]
460 else infile=${DESTFILE} ; fi
462 sed -e 's/char\([ ]*\*[ ]*sbrk[ ]*(\)/void\1/' \
463 < $infile > ${DESTDIR}/fixinc.tmp
465 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
466 fi # end of selection 'if'
467 ;; # case end for file name test
472 # Fix 6: Arm_Norcroft_Hint
474 case "${file}" in ./X11/Intrinsic.h )
475 if ( test -n "`egrep '___type p_type' ${file}`"
476 ) > /dev/null 2>&1 ; then
479 if [ ! -r ${DESTFILE} ]
481 else infile=${DESTFILE} ; fi
483 sed -e 's/___type p_type/p_type/' \
484 < $infile > ${DESTDIR}/fixinc.tmp
486 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
487 fi # end of selection 'if'
488 ;; # case end for file name test
495 case "${file}" in ./stdlib.h )
496 if ( test -n "`egrep '#[ ]*define[ ]*__wchar_t' ${file}`"
497 ) > /dev/null 2>&1 ; then
500 if [ ! -r ${DESTFILE} ]
502 else infile=${DESTFILE} ; fi
504 sed -e 's/\(#[ ]*ifndef[ ]*\)__wchar_t/\1_GCC_WCHAR_T/' \
505 -e 's/\(#[ ]*define[ ]*\)__wchar_t/\1_GCC_WCHAR_T/' \
506 < $infile > ${DESTDIR}/fixinc.tmp
508 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
509 fi # end of selection 'if'
510 ;; # case end for file name test
517 case "${file}" in ./sys/param.h )
518 if ( test -n "`egrep '#ifndef NOINLINE' ${file}`"
519 ) > /dev/null 2>&1 ; then
522 if [ ! -r ${DESTFILE} ]
524 else infile=${DESTFILE} ; fi
526 sed -e 's|#ifndef NOINLINE|#if !defined(NOINLINE) \&\& !defined(__GNUC__)|' \
527 < $infile > ${DESTDIR}/fixinc.tmp
529 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
530 fi # end of selection 'if'
531 ;; # case end for file name test
538 case "${file}" in ./curses.h | \
539 ./curses_colr/curses.h | \
544 if [ ! -r ${DESTFILE} ]
546 else infile=${DESTFILE} ; fi
548 sed -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/i\
551 -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/a\
554 -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/i\
557 -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/a\
560 -e '/^[ ]*typedef[ ][ ]*unsigned char[ ][ ]*bool[ ]*;/i\
563 -e '/^[ ]*typedef[ ][ ]*unsigned char[ ][ ]*bool[ ]*;/a\
566 -e '/^typedef[ ][ ]*int[ ][ ]*bool[ ]*;/i\
569 -e '/^typedef[ ][ ]*int[ ][ ]*bool[ ]*;/a\
572 -e '/^[ ]*typedef[ ][ ]*unsigned int[ ][ ]*bool[ ]*;/i\
575 -e '/^[ ]*typedef[ ][ ]*unsigned int[ ][ ]*bool[ ]*;/a\
578 < $infile > ${DESTDIR}/fixinc.tmp
580 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
581 ;; # case end for file name test
586 # Fix 10: Bad_Struct_Term
588 case "${file}" in ./curses.h )
589 if ( test -n "`egrep '^[ ]*typedef[ ]+struct[ ]+term[ ]*;' ${file}`"
590 ) > /dev/null 2>&1 ; then
593 if [ ! -r ${DESTFILE} ]
595 else infile=${DESTFILE} ; fi
597 sed -e 's/^[ ]*typedef[ ][ ]*\(struct[ ][ ]*term[ ]*;[ ]*\)$/\1/' \
598 < $infile > ${DESTDIR}/fixinc.tmp
600 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
601 fi # end of selection 'if'
602 ;; # case end for file name test
609 case "${file}" in ./sundev/vuid_event.h )
612 if [ ! -r ${DESTFILE} ]
614 else infile=${DESTFILE} ; fi
616 sed -e 's/doesn'\''t/does not/' \
617 < $infile > ${DESTDIR}/fixinc.tmp
619 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
620 ;; # case end for file name test
627 case "${file}" in ./libgen.h | \
643 if [ ! -r ${DESTFILE} ]
645 else infile=${DESTFILE} ; fi
647 sed -e 's/^[ ]*#[ ]*define[ ]*\([^(]*\)\(([^)]*)\)[ ]*\(_.\)\1\2[ ]*$/#define \1 \3\1/' \
648 < $infile > ${DESTDIR}/fixinc.tmp
650 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
651 ;; # case end for file name test
656 # Fix 13: Broken_Assert_Stdio
658 case "${file}" in ./assert.h )
659 if ( test -n "`egrep 'stderr' ${file}`" -a \
660 -z "`egrep 'include.*stdio.h' ${file}`"
661 ) > /dev/null 2>&1 ; then
664 if [ ! -r ${DESTFILE} ]
666 else infile=${DESTFILE} ; fi
671 < $infile > ${DESTDIR}/fixinc.tmp
673 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
674 fi # end of selection 'if'
675 ;; # case end for file name test
680 # Fix 14: Broken_Assert_Stdlib
682 case "${file}" in ./assert.h )
683 if ( test -n "`egrep 'exit *\\(|abort *\\(' ${file}`" -a \
684 -z "`egrep 'include.*stdlib.h' ${file}`"
685 ) > /dev/null 2>&1 ; then
687 broken_assert_stdlib
"
688 if [ ! -r ${DESTFILE} ]
690 else infile=${DESTFILE} ; fi
697 < $infile > ${DESTDIR}/fixinc.tmp
699 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
700 fi # end of selection 'if'
701 ;; # case end for file name test
706 # Fix 15: Bsd43_Io_Macros
708 if ( test -n "`egrep 'BSD43__IO' ${file}`"
709 ) > /dev/null 2>&1 ; then
712 if [ ! -r ${DESTFILE} ]
714 else infile=${DESTFILE} ; fi
716 sed -e '/[ ]BSD43__IO[A-Z]*[ ]*(/s/(\(.\),/('\''\1'\'',/' \
717 -e '/#[ ]*define[ ]*[ ]BSD43__IO/s/'\''\([cgx]\)'\''/\1/g' \
718 < $infile > ${DESTDIR}/fixinc.tmp
720 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
721 fi # end of selection 'if'
725 # Fix 16: Dec_Intern_Asm
727 case "${file}" in ./c_asm.h )
730 if [ ! -r ${DESTFILE} ]
732 else infile=${DESTFILE} ; fi
734 sed -e '/^[ ]*float[ ]*fasm/i\
737 -e '/^[ ]*#[ ]*pragma[ ]*intrinsic([ ]*dasm/a\
740 < $infile > ${DESTDIR}/fixinc.tmp
742 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
743 ;; # case end for file name test
748 # Fix 17: No_Double_Slash
750 if ( test -n "`egrep '(^|[^:])//[^\"*]' ${file}`" -a \
751 '(' -z `echo ${file} | egrep '(CC|cxx|\+\+)/' ` ')'
752 ) > /dev/null 2>&1 ; then
755 if [ ! -r ${DESTFILE} ]
757 else infile=${DESTFILE} ; fi
759 sed -e 's,^//.*$,,' \
760 -e 's,[^:]//[^"].
*$
,,' \
761 < $infile > ${DESTDIR}/fixinc.tmp
763 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
764 fi # end of selection 'if'
770 case "${file}" in ./sunwindow/win_lock.h | \
771 ./sunwindow/win_cursor.h )
774 if [ ! -r ${DESTFILE} ]
776 else infile=${DESTFILE} ; fi
778 sed -e 's
/ecd.cursor
/ecd_cursor
/' \
779 < $infile > ${DESTDIR}/fixinc.tmp
781 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
782 ;; # case end for file name test
787 # Fix 19: Sco5_Stat_Wrappers
789 case "${file}" in ./sys/stat.h )
790 case "$target_canonical" in i*86-*-sco3.2v5* )
793 if [ ! -r ${DESTFILE} ]
795 else infile=${DESTFILE} ; fi
797 sed -e '/^static int
[ ]*[a-z
]*stat
(/i\
806 #endif /* __cplusplus */\
808 < $infile > ${DESTDIR}/fixinc.tmp
810 mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
811 ;; # case end for machine type test
813 ;; # case end for file name test
820 if ( test -n "`egrep '^
[ ]*#[ ]*else[ ]+[!-.0-~]' ${file}`"
821 ) > /dev
/null
2>&1 ; then
824 if [ ! -r ${DESTFILE} ]
826 else infile
=${DESTFILE} ; fi
830 s/\\$/\\+++fixinc_eol+++/
832 s/\\+++fixinc_eol+++/\\/g
833 s%^\([ ]*#[ ]*else\)[ ]*/[^*].*%\1%
834 s%^\([ ]*#[ ]*else\)[ ]*[^/ ].*%\1%' \
835 < $infile > ${DESTDIR}/fixinc.tmp
837 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
838 fi # end of selection 'if'
842 # Fix 21: Endif_Label
844 if ( test -n "`egrep '^[ ]*#[ ]*endif[ ]+[!-.0-z{|}~]' ${file}`"
845 ) > /dev
/null
2>&1 ; then
848 if [ ! -r ${DESTFILE} ]
850 else infile
=${DESTFILE} ; fi
854 s/\\$/\\+++fixinc_eol+++/
856 s/\\+++fixinc_eol+++/\\/g
857 s%^\([ ]*#[ ]*endif\)[ ]*/[^*].*%\1%
858 s%^\([ ]*#[ ]*endif\)[ ]*\*[^/].*%\1%
859 s%^\([ ]*#[ ]*endif\)[ ]*[^/* ].*%\1%' \
860 < $infile > ${DESTDIR}/fixinc.tmp
862 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
863 fi # end of selection 'if'
869 case "${file}" in .
/sys
/spinlock.h
)
870 if ( test -n "`egrep 'include.*\"\\.\\./machine/' ${file}`"
871 ) > /dev
/null
2>&1 ; then
874 if [ ! -r ${DESTFILE} ]
876 else infile
=${DESTFILE} ; fi
878 sed -e 's,"../machine/inline.h",<machine/inline.h>,' \
879 -e 's,"../machine/psl.h",<machine/psl.h>,' \
880 < $infile > ${DESTDIR}/fixinc.tmp
882 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
883 fi # end of selection 'if'
884 ;; # case end for file name test
891 case "${file}" in .
/sys
/file.h
)
892 if ( test -n "`egrep 'HPUX_SOURCE' ${file}`"
893 ) > /dev
/null
2>&1 ; then
896 if [ ! -r ${DESTFILE} ]
898 else infile
=${DESTFILE} ; fi
900 sed -e 's/(\.\.\.)/(struct file * ...)/' \
901 < $infile > ${DESTDIR}/fixinc.tmp
903 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
904 fi # end of selection 'if'
905 ;; # case end for file name test
910 # Fix 24: Cxx_Unready
912 case "${file}" in .
/sys
/mman.h | \
914 if ( test -z "`egrep '\"C\"|__BEGIN_DECLS' ${file}`"
915 ) > /dev
/null
2>&1 ; then
918 if [ ! -r ${DESTFILE} ]
920 else infile
=${DESTFILE} ; fi
933 < $infile > ${DESTDIR}/fixinc.tmp
935 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
936 fi # end of selection 'if'
937 ;; # case end for file name test
942 # Fix 25: Hpux_Maxint
944 case "${file}" in .
/sys
/param.h
)
947 if [ ! -r ${DESTFILE} ]
949 else infile
=${DESTFILE} ; fi
951 sed -e '/^#[ ]*define[ ]*MAXINT[ ]/i\
954 -e '/^#[ ]*define[ ]*MAXINT[ ]/a\
957 < $infile > ${DESTDIR}/fixinc.tmp
959 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
960 ;; # case end for file name test
965 # Fix 26: Hpux_Systime
967 case "${file}" in .
/sys
/time.h
)
968 if ( test -n "`egrep '^extern struct sigevent;' ${file}`"
969 ) > /dev
/null
2>&1 ; then
972 if [ ! -r ${DESTFILE} ]
974 else infile
=${DESTFILE} ; fi
976 sed -e 's/^extern struct sigevent;/struct sigevent;/' \
977 < $infile > ${DESTDIR}/fixinc.tmp
979 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
980 fi # end of selection 'if'
981 ;; # case end for file name test
986 # Fix 27: Interactv_Add1
988 case "${file}" in .
/stdio.h | \
994 if ( test '(' -d /etc
/conf
/kconfig.d
')' -a \
995 '(' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`" ')'
996 ) > /dev
/null
2>&1 ; then
999 if [ ! -r ${DESTFILE} ]
1001 else infile
=${DESTFILE} ; fi
1003 sed -e 's/!defined(__STDC__) && !defined(_POSIX_SOURCE)/!defined(_POSIX_SOURCE)/' \
1004 < $infile > ${DESTDIR}/fixinc.tmp
1006 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1007 fi # end of selection 'if'
1008 ;; # case end for file name test
1013 # Fix 28: Interactv_Add2
1015 case "${file}" in .
/math.h
)
1016 if ( test '(' -d /etc
/conf
/kconfig.d
')' -a \
1017 '(' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`" ')'
1018 ) > /dev
/null
2>&1 ; then
1021 if [ ! -r ${DESTFILE} ]
1023 else infile
=${DESTFILE} ; fi
1025 sed -e 's/fmod(double)/fmod(double, double)/' \
1026 < $infile > ${DESTDIR}/fixinc.tmp
1028 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1029 fi # end of selection 'if'
1030 ;; # case end for file name test
1035 # Fix 29: Interactv_Add3
1037 case "${file}" in .
/sys
/limits.h
)
1038 if ( test '(' -d /etc
/conf
/kconfig.d
')' -a \
1039 '(' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`" ')'
1040 ) > /dev
/null
2>&1 ; then
1043 if [ ! -r ${DESTFILE} ]
1045 else infile
=${DESTFILE} ; fi
1047 sed -e '/CHILD_MAX/s,/\* Max, Max,' \
1048 -e '/OPEN_MAX/s,/\* Max, Max,' \
1049 < $infile > ${DESTDIR}/fixinc.tmp
1051 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1052 fi # end of selection 'if'
1053 ;; # case end for file name test
1058 # Fix 30: Io_Def_Quotes
1060 if ( test -n "`egrep '[ ]*[ ](_|DES)IO[A-Z]*[ ]*\\( *[^,'\\'']' ${file}`"
1061 ) > /dev
/null
2>&1 ; then
1064 if [ ! -r ${DESTFILE} ]
1066 else infile
=${DESTFILE} ; fi
1068 sed -e 's/\([ ]*[ ]_IO[A-Z]*[ ]*(\)\([^,'\'']\),/\1'\''\2'\'',/' \
1069 -e 's/\([ ]*[ ]DESIO[A-Z]*[ ]*(\)\([^,'\'']\),/\1'\''\2'\'',/' \
1070 -e '/#[ ]*define[ ]*[ ]_IO/s/'\''\([cgxtf]\)'\''/\1/g' \
1071 -e '/#[ ]*define[ ]*[ ]DESIOC/s/'\''\([cdgx]\)'\''/\1/g' \
1072 < $infile > ${DESTDIR}/fixinc.tmp
1074 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1075 fi # end of selection 'if'
1079 # Fix 31: Ioctl_Fix_Ctrl
1081 if ( test -n "`egrep 'CTRL[ ]' ${file}`"
1082 ) > /dev
/null
2>&1 ; then
1085 if [ ! -r ${DESTFILE} ]
1087 else infile
=${DESTFILE} ; fi
1089 sed -e '/[^A-Z0-9_]CTRL[ ]*(/s/\([^'\'']\))/'\''\1'\'')/' \
1090 -e '/[^A-Z0-9]_CTRL[ ]*(/s/\([^'\'']\))/'\''\1'\'')/' \
1091 -e '/#[ ]*define[ ]*[ ]CTRL/s/'\''\([cgx]\)'\''/\1/g' \
1092 -e '/#[ ]*define[ ]*[ ]_CTRL/s/'\''\([cgx]\)'\''/\1/g' \
1093 -e '/#[ ]*define[ ]*[ ]BSD43_CTRL/s/'\''\([cgx]\)'\''/\1/g' \
1094 < $infile > ${DESTDIR}/fixinc.tmp
1096 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1097 fi # end of selection 'if'
1101 # Fix 32: Ip_Missing_Semi
1103 case "${file}" in .
/netinet
/ip.h
)
1106 if [ ! -r ${DESTFILE} ]
1108 else infile
=${DESTFILE} ; fi
1110 sed -e '/^struct/,/^};/s/}$/};/' \
1111 < $infile > ${DESTDIR}/fixinc.tmp
1113 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1114 ;; # case end for file name test
1119 # Fix 33: Irix_Multiline_Cmnt
1121 case "${file}" in .
/sys
/types.h
)
1123 irix_multiline_cmnt"
1124 if [ ! -r ${DESTFILE} ]
1126 else infile
=${DESTFILE} ; fi
1128 sed -e 's@type of the result@type of the result */@' \
1129 -e 's@of the sizeof@/* of the sizeof@' \
1130 < $infile > ${DESTDIR}/fixinc.tmp
1132 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1133 ;; # case end for file name test
1138 # Fix 34: Irix_Sockaddr
1140 case "${file}" in .
/rpc
/auth.h
)
1141 if ( test -n "`egrep 'authdes_create.*struct sockaddr' ${file}`"
1142 ) > /dev
/null
2>&1 ; then
1145 if [ ! -r ${DESTFILE} ]
1147 else infile
=${DESTFILE} ; fi
1149 sed -e '/authdes_create.*struct sockaddr/i\
1152 < $infile > ${DESTDIR}/fixinc.tmp
1154 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1155 fi # end of selection 'if'
1156 ;; # case end for file name test
1161 # Fix 35: Irix_Struct__File
1163 case "${file}" in .
/rpc
/xdr.h
)
1166 if [ ! -r ${DESTFILE} ]
1168 else infile
=${DESTFILE} ; fi
1170 sed -e '/xdrstdio_create.*struct __file_s/i\
1173 < $infile > ${DESTDIR}/fixinc.tmp
1175 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1176 ;; # case end for file name test
1183 case "${file}" in .
/math.h
)
1184 if ( test -n "`egrep 'fmod\\(double\\)' ${file}`"
1185 ) > /dev
/null
2>&1 ; then
1188 if [ ! -r ${DESTFILE} ]
1190 else infile
=${DESTFILE} ; fi
1192 sed -e 's/fmod(double)/fmod(double, double)/' \
1193 < $infile > ${DESTDIR}/fixinc.tmp
1195 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1196 fi # end of selection 'if'
1197 ;; # case end for file name test
1202 # Fix 37: Motorola_Nested
1204 case "${file}" in .
/limits.h | \
1206 case "$target_canonical" in m68k-motorola-sysv
* )
1209 if [ ! -r ${DESTFILE} ]
1211 else infile
=${DESTFILE} ; fi
1213 sed -e 's@^\(#undef[ ][ ]*PIPE_BUF[ ]*/\* max # bytes atomic in write to a\)$@\1 */@' \
1214 -e 's@\(/\*#define HUGE_VAL 3.40282346638528860e+38 \)\(/\*error value returned by Math lib\*/\)$@\1*/ \2@' \
1215 < $infile > ${DESTDIR}/fixinc.tmp
1217 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1218 ;; # case end for machine type test
1220 ;; # case end for file name test
1225 # Fix 38: Isc_Sys_Limits
1227 case "${file}" in .
/sys
/limits.h
)
1228 if ( test -n "`egrep 'CHILD_MAX' ${file}`"
1229 ) > /dev
/null
2>&1 ; then
1232 if [ ! -r ${DESTFILE} ]
1234 else infile
=${DESTFILE} ; fi
1236 sed -e '/CHILD_MAX/s,/\* Max, Max,' \
1237 -e '/OPEN_MAX/s,/\* Max, Max,' \
1238 < $infile > ${DESTDIR}/fixinc.tmp
1240 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1241 fi # end of selection 'if'
1242 ;; # case end for file name test
1247 # Fix 39: Kandr_Concat
1249 case "${file}" in .
/sparc
/asm_linkage.h | \
1250 .
/sun
3/asm_linkage.h | \
1251 .
/sun3x
/asm_linkage.h | \
1252 .
/sun
4/asm_linkage.h | \
1253 .
/sun4c
/asm_linkage.h | \
1254 .
/sun4m
/asm_linkage.h | \
1255 .
/sun4c
/debug
/asm_linkage.h | \
1256 .
/sun4m
/debug
/asm_linkage.h | \
1257 .
/arm
/as_support.h | \
1260 .
/dev
/chardefmac.h | \
1265 .
/Xm.acorn
/XmP.h | \
1267 if ( test -n "`egrep '/\\*\\*/' ${file}`"
1268 ) > /dev
/null
2>&1 ; then
1271 if [ ! -r ${DESTFILE} ]
1273 else infile
=${DESTFILE} ; fi
1275 sed -e 's|/\*\*/|##|g' \
1276 < $infile > ${DESTDIR}/fixinc.tmp
1278 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1279 fi # end of selection 'if'
1280 ;; # case end for file name test
1285 # Fix 40: Limits_Ifndefs
1287 case "${file}" in .
/limits.h | \
1289 if ( test -z "`egrep 'ifndef[ ]+FLT_MIN' ${file}`"
1290 ) > /dev
/null
2>&1 ; then
1293 if [ ! -r ${DESTFILE} ]
1295 else infile
=${DESTFILE} ; fi
1297 sed -e '/[ ]FLT_MIN[ ]/i\
1300 -e '/[ ]FLT_MIN[ ]/a\
1303 -e '/[ ]FLT_MAX[ ]/i\
1306 -e '/[ ]FLT_MAX[ ]/a\
1309 -e '/[ ]FLT_DIG[ ]/i\
1312 -e '/[ ]FLT_DIG[ ]/a\
1315 -e '/[ ]DBL_MIN[ ]/i\
1318 -e '/[ ]DBL_MIN[ ]/a\
1321 -e '/[ ]DBL_MAX[ ]/i\
1324 -e '/[ ]DBL_MAX[ ]/a\
1327 -e '/[ ]DBL_DIG[ ]/i\
1330 -e '/[ ]DBL_DIG[ ]/a\
1333 -e '/^\(\/\*#define HUGE_VAL 3\.[0-9e+]* *\)\/\*/s//\1/' \
1334 < $infile > ${DESTDIR}/fixinc.tmp
1336 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1337 fi # end of selection 'if'
1338 ;; # case end for file name test
1343 # Fix 41: Lynx_Void_Int
1345 case "${file}" in .
/curses.h
)
1346 if ( test -n "`egrep '#[ ]*define[ ]+void[ ]+int' ${file}`"
1347 ) > /dev
/null
2>&1 ; then
1350 if [ ! -r ${DESTFILE} ]
1352 else infile
=${DESTFILE} ; fi
1354 sed -e '/#[ ]*define[ ][ ]*void[ ]int/d' \
1355 < $infile > ${DESTDIR}/fixinc.tmp
1357 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1358 fi # end of selection 'if'
1359 ;; # case end for file name test
1364 # Fix 42: Lynxos_Fcntl_Proto
1366 case "${file}" in .
/fcntl.h
)
1367 if ( test -n "`egrep 'fcntl.*\\(int, int, int\\)' ${file}`"
1368 ) > /dev
/null
2>&1 ; then
1371 if [ ! -r ${DESTFILE} ]
1373 else infile
=${DESTFILE} ; fi
1375 sed -e 's/\(fcntl.*(int, int, \)int)/\1...)/' \
1376 < $infile > ${DESTDIR}/fixinc.tmp
1378 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1379 fi # end of selection 'if'
1380 ;; # case end for file name test
1385 # Fix 43: M88k_Bad_Hypot_Opt
1387 case "${file}" in .
/math.h
)
1388 case "$target_canonical" in m88k-motorola-sysv3
* )
1391 if [ ! -r ${DESTFILE} ]
1393 else infile
=${DESTFILE} ; fi
1395 sed -e 's/extern double floor(), ceil(), fmod(), fabs();/extern double floor(), ceil(), fmod(), fabs _PARAMS((double));/' \
1396 -e '/^extern double hypot();$/a\
1397 \/* Workaround a stupid Motorola optimization if one\
1398 of x or y is 0.0 and the other is negative! *\/\
1400 static __inline__ double fake_hypot (double x, double y)\
1402 static __inline__ double fake_hypot (x, y)\
1406 return fabs (hypot (x, y));\
1408 #define hypot fake_hypot
1410 < $infile > ${DESTDIR}/fixinc.tmp
1412 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1413 ;; # case end for machine type test
1415 ;; # case end for file name test
1420 # Fix 44: M88k_Bad_S_If
1422 case "${file}" in .
/sys
/stat.h
)
1423 case "$target_canonical" in m88k-
*-sysv3* )
1424 if ( test -n "`egrep '#define[ ]+S_IS[A-Z]*(m)[ ]' ${file}`"
1425 ) > /dev
/null
2>&1 ; then
1428 if [ ! -r ${DESTFILE} ]
1430 else infile
=${DESTFILE} ; fi
1432 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)/' \
1433 -e 's/^\(#define[ ]*S_IS[A-Z]*(m)\)[ ]*(m[ ]*&[ ]*\(0[0-9]*\)[ ]*)/\1 (((m)\&S_IFMT)==\2)/' \
1434 < $infile > ${DESTDIR}/fixinc.tmp
1436 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1437 fi # end of selection 'if'
1438 ;; # case end for machine type test
1440 ;; # case end for file name test
1445 # Fix 45: M88k_Multi_Incl
1447 case "${file}" in .
/time.h
)
1448 case "$target_canonical" in m88k-tektronix-sysv3
* )
1449 if ( test -z "`egrep '#ifndef' ${file}`"
1450 ) > /dev
/null
2>&1 ; then
1453 if [ ! -r ${DESTFILE} ]
1455 else infile
=${DESTFILE} ; fi
1456 ( echo Fixing
$file, to protect against multiple inclusion.
>&2
1457 cpp_wrapper
=`echo $file | sed -e 's,\.,_,g' -e 's,/,_,g'`
1458 echo "#ifndef __GCC_GOT_${cpp_wrapper}_"
1459 echo "#define __GCC_GOT_${cpp_wrapper}_"
1461 echo "#endif /* ! __GCC_GOT_${cpp_wrapper}_ */" ) < $infile > ${DESTDIR}/fixinc.tmp
1463 # Shell scripts have the potential of removing the output
1464 # We interpret that to mean the file is not to be altered
1466 if test ! -f ${DESTDIR}/fixinc.tmp
1469 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1470 fi # end of selection 'if'
1471 ;; # case end for machine type test
1473 ;; # case end for file name test
1478 # Fix 46: Machine_Name
1480 if ( test -n "`egrep '^#[ ]*(if|elif).*[^a-zA-Z0-9_](_*[MSRrhim]|[Mbimnpstuv])[a-zA-Z0-9_]' ${file}`"
1481 ) > /dev
/null
2>&1 ; then
1484 if [ ! -r ${DESTFILE} ]
1486 else infile
=${DESTFILE} ; fi
1490 s/\\$/\\+++fixinc_eol+++/
1492 s/\\+++fixinc_eol+++/\\/g
1494 s/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g
1496 s/ _*MIPSE\([LB]\) / __MIPSE\1__ /g
1497 s/ _*SYSTYPE_\([A-Z0-9]*\) / __SYSTYPE_\1__ /g
1498 s/ _*\([Rr][34]\)000 / __\1000__ /g
1499 s/ _*host_mips / __host_mips__ /g
1500 s/ _*i386 / __i386__ /g
1501 s/ _*mips / __mips__ /g
1502 s/ bsd4\([0-9]\) / __bsd4\1__ /g
1503 s/ is68k / __is68k__ /g
1504 s/ m68k / __m68k__ /g
1505 s/ m88k / __m88k__ /g
1506 s/ mc680\([0-9]\)0 / __mc680\10__ /g
1507 s/ news\([0-9]*\) / __news\1__ /g
1508 s/ ns32000 / __ns32000__ /g
1509 s/ pdp11 / __pdp11__ /g
1512 s/ sony_news / __sony_news__ /g
1513 s/ sparc / __sparc__ /g
1514 s/ sun\([a-z0-9]*\) / __sun\1__ /g
1515 s/ tahoe / __tahoe__ /g
1516 s/ tower\([_0-9]*\) / __tower\1__ /g
1517 s/ u370 / __u370__ /g
1518 s/ u3b\([0-9]*\) / __u3b\1__ /g
1519 s/ unix / __unix__ /g
1521 s/ \([a-zA-Z0-9_][a-zA-Z0-9_]*\) /\1/g
1523 < $infile > ${DESTDIR}/fixinc.tmp
1525 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1526 fi # end of selection 'if'
1530 # Fix 47: Math_Exception
1532 case "${file}" in .
/math.h
)
1533 if ( test -n "`egrep 'struct exception' ${file}`"
1534 ) > /dev
/null
2>&1 ; then
1537 if [ ! -r ${DESTFILE} ]
1539 else infile
=${DESTFILE} ; fi
1541 sed -e '/struct exception/i\
1543 #define exception __math_exception\
1546 -e '/struct exception/a\
1553 #define exception __math_exception\
1561 < $infile > ${DESTDIR}/fixinc.tmp
1563 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1564 fi # end of selection 'if'
1565 ;; # case end for file name test
1570 # Fix 48: Math_Gcc_Ifndefs
1572 case "${file}" in .
/math.h
)
1575 if [ ! -r ${DESTFILE} ]
1577 else infile
=${DESTFILE} ; fi
1578 ( dbl_max_def
=`egrep 'define[ ]+DBL_MAX[ ]+.*' float.h 2>/dev/null`
1580 if ( test -n "${dbl_max_def}" \
1581 -a -n "`egrep '#define[ ]*HUGE_VAL[ ]+DBL_MAX' $file`" \
1582 -a -z "`egrep '#define[ ]+DBL_MAX[ ]+' $file`"
1584 then sed -e '/define[ ]HUGE_VAL[ ]DBL_MAX/s/DBL_MAX/$dbl_max_def/'
1586 sed -e '/define[ ]HUGE_VAL[ ]/i\
1588 ' -e '/define[ ]HUGE_VAL[ ]/a\
1590 ' ) < $infile > ${DESTDIR}/fixinc.tmp
1592 # Shell scripts have the potential of removing the output
1593 # We interpret that to mean the file is not to be altered
1595 if test ! -f ${DESTDIR}/fixinc.tmp
1598 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1599 ;; # case end for file name test
1604 # Fix 49: Nested_Comment
1606 case "${file}" in .
/rpc
/rpc.h
)
1609 if [ ! -r ${DESTFILE} ]
1611 else infile
=${DESTFILE} ; fi
1613 sed -e 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@' \
1614 < $infile > ${DESTDIR}/fixinc.tmp
1616 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1617 ;; # case end for file name test
1622 # Fix 50: News_Os_Recursion
1624 case "${file}" in .
/stdlib.h
)
1625 if ( test -n "`egrep '#include <stdlib.h>' ${file}`"
1626 ) > /dev
/null
2>&1 ; then
1629 if [ ! -r ${DESTFILE} ]
1631 else infile
=${DESTFILE} ; fi
1633 sed -e '/^#include <stdlib.h>/i\
1634 #ifdef BOGUS_RECURSION
1636 -e '/^#include <stdlib.h>/a\
1639 < $infile > ${DESTDIR}/fixinc.tmp
1641 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1642 fi # end of selection 'if'
1643 ;; # case end for file name test
1648 # Fix 51: Next_Math_Prefix
1650 case "${file}" in .
/ansi
/math.h
)
1651 if ( test -n "`egrep '^extern.*double.*__const__.*' ${file}`"
1652 ) > /dev
/null
2>&1 ; then
1655 if [ ! -r ${DESTFILE} ]
1657 else infile
=${DESTFILE} ; fi
1659 sed -e '/^extern.*double.*__const__.*sqrt(/s/__const__//' \
1660 -e '/^extern.*double.*__const__.*fabs(/s/__const__//' \
1661 -e '/^extern.*double.*__const__.*cos(/s/__const__//' \
1662 -e '/^extern.*double.*__const__.*hypot(/s/__const__//' \
1663 -e '/^extern.*double.*__const__.*sin(/s/__const__//' \
1664 < $infile > ${DESTDIR}/fixinc.tmp
1666 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1667 fi # end of selection 'if'
1668 ;; # case end for file name test
1673 # Fix 52: Next_Template
1675 case "${file}" in .
/bsd
/libc.h
)
1676 if ( test -n "`egrep 'template' ${file}`"
1677 ) > /dev
/null
2>&1 ; then
1680 if [ ! -r ${DESTFILE} ]
1682 else infile
=${DESTFILE} ; fi
1684 sed -e '/\(.*template\)/s/template//' \
1685 -e '/extern.*volatile.*void.*abort/s/volatile//' \
1686 < $infile > ${DESTDIR}/fixinc.tmp
1688 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1689 fi # end of selection 'if'
1690 ;; # case end for file name test
1695 # Fix 53: Next_Volitile
1697 case "${file}" in .
/ansi
/stdlib.h
)
1698 if ( test -n "`egrep 'volatile' ${file}`"
1699 ) > /dev
/null
2>&1 ; then
1702 if [ ! -r ${DESTFILE} ]
1704 else infile
=${DESTFILE} ; fi
1706 sed -e '/extern.*volatile.*void.*exit/s/volatile//' \
1707 -e '/extern.*volatile.*void.*abort/s/volatile//' \
1708 < $infile > ${DESTDIR}/fixinc.tmp
1710 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1711 fi # end of selection 'if'
1712 ;; # case end for file name test
1717 # Fix 54: Next_Wait_Union
1719 case "${file}" in .
/sys
/wait.h
)
1720 if ( test -n "`egrep 'wait\\(union wait' ${file}`"
1721 ) > /dev
/null
2>&1 ; then
1724 if [ ! -r ${DESTFILE} ]
1726 else infile
=${DESTFILE} ; fi
1728 sed -e 's@wait(union wait@wait(void@' \
1729 < $infile > ${DESTDIR}/fixinc.tmp
1731 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1732 fi # end of selection 'if'
1733 ;; # case end for file name test
1738 # Fix 55: Nodeent_Syntax
1740 case "${file}" in .
/netdnet
/dnetdb.h
)
1743 if [ ! -r ${DESTFILE} ]
1745 else infile
=${DESTFILE} ; fi
1747 sed -e 's/char.*na_addr *$/char *na_addr;/' \
1748 < $infile > ${DESTDIR}/fixinc.tmp
1750 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1751 ;; # case end for file name test
1756 # Fix 56: Osf_Namespace_A
1758 case "${file}" in .
/reg_types.h | \
1760 if ( test '(' -r reg_types.h
')' -a \
1761 '(' -r sys
/lc_core.h
')' -a \
1762 '(' -n "`grep '} regex_t;' reg_types.h`" ')' -a \
1763 '(' -z "`grep __regex_t regex.h`" ')'
1764 ) > /dev
/null
2>&1 ; then
1767 if [ ! -r ${DESTFILE} ]
1769 else infile
=${DESTFILE} ; fi
1771 sed -e 's/regex_t/__regex_t/g' \
1772 -e 's/regoff_t/__regoff_t/g' \
1773 -e 's/regmatch_t/__regmatch_t/g' \
1774 < $infile > ${DESTDIR}/fixinc.tmp
1776 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1777 fi # end of selection 'if'
1778 ;; # case end for file name test
1783 # Fix 57: Osf_Namespace_B
1785 case "${file}" in .
/regex.h
)
1786 if ( test '(' -r reg_types.h
')' -a \
1787 '(' -r sys
/lc_core.h
')' -a \
1788 '(' -n "`grep '} regex_t;' reg_types.h`" ')' -a \
1789 '(' -z "`grep __regex_t regex.h`" ')'
1790 ) > /dev
/null
2>&1 ; then
1793 if [ ! -r ${DESTFILE} ]
1795 else infile
=${DESTFILE} ; fi
1797 sed -e '/#include <reg_types.h>/a\
1798 typedef __regex_t regex_t;\
1799 typedef __regoff_t regoff_t;\
1800 typedef __regmatch_t regmatch_t;
1802 < $infile > ${DESTDIR}/fixinc.tmp
1804 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1805 fi # end of selection 'if'
1806 ;; # case end for file name test
1811 # Fix 58: Pthread_Page_Size
1813 case "${file}" in .
/pthread.h
)
1814 if ( test -n "`egrep '^int __page_size' ${file}`"
1815 ) > /dev
/null
2>&1 ; then
1818 if [ ! -r ${DESTFILE} ]
1820 else infile
=${DESTFILE} ; fi
1822 sed -e 's/^int __page_size/extern int __page_size/' \
1823 < $infile > ${DESTDIR}/fixinc.tmp
1825 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1826 fi # end of selection 'if'
1827 ;; # case end for file name test
1832 # Fix 59: Rs6000_Double
1834 case "${file}" in .
/math.h
)
1835 if ( test -n "`egrep '[^a-zA-Z_]class\\(' ${file}`"
1836 ) > /dev
/null
2>&1 ; then
1839 if [ ! -r ${DESTFILE} ]
1841 else infile
=${DESTFILE} ; fi
1843 sed -e '/class[(]/i\
1849 < $infile > ${DESTDIR}/fixinc.tmp
1851 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1852 fi # end of selection 'if'
1853 ;; # case end for file name test
1858 # Fix 60: Rs6000_Fchmod
1860 case "${file}" in .
/sys
/stat.h
)
1861 if ( test -n "`egrep 'fchmod\\(char' ${file}`"
1862 ) > /dev
/null
2>&1 ; then
1865 if [ ! -r ${DESTFILE} ]
1867 else infile
=${DESTFILE} ; fi
1869 sed -e 's/fchmod(char \*/fchmod(int/' \
1870 < $infile > ${DESTDIR}/fixinc.tmp
1872 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1873 fi # end of selection 'if'
1874 ;; # case end for file name test
1879 # Fix 61: Rs6000_Param
1881 case "${file}" in .
/stdio.h | \
1885 if [ ! -r ${DESTFILE} ]
1887 else infile
=${DESTFILE} ; fi
1889 sed -e 's@rename(const char \*old, const char \*new)@rename(const char *_old, const char *_new)@' \
1890 < $infile > ${DESTDIR}/fixinc.tmp
1892 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1893 ;; # case end for file name test
1898 # Fix 62: Sony_Include
1900 case "${file}" in .
/machine
/machparam.h
)
1901 if ( test -n "`egrep '\"\\.\\./machine/endian.h\"' ${file}`"
1902 ) > /dev
/null
2>&1 ; then
1905 if [ ! -r ${DESTFILE} ]
1907 else infile
=${DESTFILE} ; fi
1909 sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \
1910 < $infile > ${DESTDIR}/fixinc.tmp
1912 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1913 fi # end of selection 'if'
1914 ;; # case end for file name test
1919 # Fix 63: Statsswtch
1921 case "${file}" in .
/rpcsvc
/rstat.h
)
1922 if ( test -n "`egrep 'boottime$' ${file}`"
1923 ) > /dev
/null
2>&1 ; then
1926 if [ ! -r ${DESTFILE} ]
1928 else infile
=${DESTFILE} ; fi
1930 sed -e 's/boottime$/boottime;/' \
1931 < $infile > ${DESTDIR}/fixinc.tmp
1933 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1934 fi # end of selection 'if'
1935 ;; # case end for file name test
1940 # Fix 64: Stdio_Va_List
1942 case "${file}" in .
/stdio.h
)
1945 if [ ! -r ${DESTFILE} ]
1947 else infile
=${DESTFILE} ; fi
1948 ( if ( egrep "__need___va_list" $file ) > /dev
/null
2>&1 ; then
1951 echo "#define __need___va_list"
1952 echo "#include <stdarg.h>"
1955 sed -e 's@ va_list @ __gnuc_va_list @' \
1956 -e 's@ va_list)@ __gnuc_va_list)@' \
1957 -e 's@ _BSD_VA_LIST_));@ __gnuc_va_list));@' \
1958 -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \
1959 -e 's@ va_list@ __va_list__@' \
1960 -e 's@\*va_list@*__va_list__@' \
1961 -e 's@ __va_list)@ __gnuc_va_list)@' \
1962 -e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \
1963 -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \
1964 -e 's@VA_LIST@DUMMY_VA_LIST@' \
1965 -e 's@_Va_LIST@_VA_LIST@' ) < $infile > ${DESTDIR}/fixinc.tmp
1967 # Shell scripts have the potential of removing the output
1968 # We interpret that to mean the file is not to be altered
1970 if test ! -f ${DESTDIR}/fixinc.tmp
1973 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1974 ;; # case end for file name test
1979 # Fix 65: Sun_Bogus_Ifdef
1981 case "${file}" in .
/hsfs
/hsfs_spec.h | \
1983 if ( test -n "`egrep '#ifdef __i386__ || __vax__' ${file}`"
1984 ) > /dev
/null
2>&1 ; then
1987 if [ ! -r ${DESTFILE} ]
1989 else infile
=${DESTFILE} ; fi
1991 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
1992 < $infile > ${DESTDIR}/fixinc.tmp
1994 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
1995 fi # end of selection 'if'
1996 ;; # case end for file name test
2001 # Fix 66: Sun_Bogus_Ifdef_Sun4c
2003 case "${file}" in .
/hsfs
/hsnode.h
)
2004 if ( test -n "`egrep '#ifdef __i386__ || __sun4c__' ${file}`"
2005 ) > /dev
/null
2>&1 ; then
2007 sun_bogus_ifdef_sun4c"
2008 if [ ! -r ${DESTFILE} ]
2010 else infile
=${DESTFILE} ; fi
2012 sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \
2013 < $infile > ${DESTDIR}/fixinc.tmp
2015 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2016 fi # end of selection 'if'
2017 ;; # case end for file name test
2022 # Fix 67: Sun_Catmacro
2024 case "${file}" in .
/pixrect
/memvar.h
)
2025 if ( test -n "`egrep '^#define[ ]+CAT\\(a,b\\)' ${file}`"
2026 ) > /dev
/null
2>&1 ; then
2029 if [ ! -r ${DESTFILE} ]
2031 else infile
=${DESTFILE} ; fi
2033 sed -e '/^#define[ ]CAT(a,b)/ i\
2035 #define CAT(a,b) a##b\
2038 -e '/^#define[ ]CAT(a,b)/ a\
2041 < $infile > ${DESTDIR}/fixinc.tmp
2043 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2044 fi # end of selection 'if'
2045 ;; # case end for file name test
2050 # Fix 68: Sun_Malloc
2052 case "${file}" in .
/malloc.h
)
2055 if [ ! -r ${DESTFILE} ]
2057 else infile
=${DESTFILE} ; fi
2059 sed -e 's/typedef[ ]char \* malloc_t/typedef void \* malloc_t/g' \
2060 -e 's/int[ ][ ]*free/void free/g' \
2061 -e 's/char\([ ]*\*[ ]*malloc\)/void\1/g' \
2062 -e 's/char\([ ]*\*[ ]*realloc\)/void\1/g' \
2063 < $infile > ${DESTDIR}/fixinc.tmp
2065 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2066 ;; # case end for file name test
2071 # Fix 69: Sun_Memcpy
2073 case "${file}" in .
/memory.h
)
2074 if ( test -n "`egrep '/\\* @\\(#\\)(head/memory.h 50.1 |memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2 )\\*/' ${file}`"
2075 ) > /dev
/null
2>&1 ; then
2078 if [ ! -r ${DESTFILE} ]
2080 else infile
=${DESTFILE} ; fi
2083 /* This file was generated by fixincludes */\
2084 #ifndef __memory_h__\
2085 #define __memory_h__\
2088 extern void *memccpy();\
2089 extern void *memchr();\
2090 extern void *memcpy();\
2091 extern void *memset();\
2093 extern char *memccpy();\
2094 extern char *memchr();\
2095 extern char *memcpy();\
2096 extern char *memset();\
2097 #endif /* __STDC__ */\
2099 extern int memcmp();\
2101 #endif /* __memory_h__ */
2104 < $infile > ${DESTDIR}/fixinc.tmp
2106 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2107 fi # end of selection 'if'
2108 ;; # case end for file name test
2113 # Fix 70: Sun_Rusers_Semi
2115 case "${file}" in .
/rpcsvc
/rusers.h
)
2116 if ( test -n "`egrep '_cnt$' ${file}`"
2117 ) > /dev
/null
2>&1 ; then
2120 if [ ! -r ${DESTFILE} ]
2122 else infile
=${DESTFILE} ; fi
2124 sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' \
2125 < $infile > ${DESTDIR}/fixinc.tmp
2127 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2128 fi # end of selection 'if'
2129 ;; # case end for file name test
2134 # Fix 71: Sun_Signal
2136 case "${file}" in .
/sys
/signal.h | \
2138 if ( test -n "`egrep '^void \\(\\*signal\\(\\)\\)\\(\\);' ${file}`"
2139 ) > /dev
/null
2>&1 ; then
2142 if [ ! -r ${DESTFILE} ]
2144 else infile
=${DESTFILE} ; fi
2146 sed -e '/^void (\*signal())();$/i\
2148 void (*signal(...))(...);\
2151 -e '/^void (\*signal())();$/a\
2154 < $infile > ${DESTDIR}/fixinc.tmp
2156 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2157 fi # end of selection 'if'
2158 ;; # case end for file name test
2163 # Fix 72: Sun_Auth_Proto
2165 case "${file}" in .
/rpc
/auth.h | \
2169 if ( test -n "`egrep '\\(\\*[a-z][a-z_]*\\)\\(\\)' ${file}`" -a \
2170 -z "`egrep '\\(\\*[a-z][a-z_]*\\)\\([ ]*[a-zA-Z.].*\\)' ${file}`"
2171 ) > /dev
/null
2>&1 ; then
2174 if [ ! -r ${DESTFILE} ]
2176 else infile
=${DESTFILE} ; fi
2178 sed -e 's/^\(.*(\*[a-z][a-z_]*)(\)\();.*\)/\
2184 < $infile > ${DESTDIR}/fixinc.tmp
2186 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2187 fi # end of selection 'if'
2188 ;; # case end for file name test
2193 # Fix 73: Sunos_Matherr_Decl
2195 case "${file}" in .
/math.h
)
2198 if [ ! -r ${DESTFILE} ]
2200 else infile
=${DESTFILE} ; fi
2202 sed -e '/^struct exception/,$b' \
2206 < $infile > ${DESTDIR}/fixinc.tmp
2208 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2209 ;; # case end for file name test
2214 # Fix 74: Sunos_Strlen
2216 case "${file}" in .
/strings.h
)
2219 if [ ! -r ${DESTFILE} ]
2221 else infile
=${DESTFILE} ; fi
2223 sed -e 's/int[ ]*strlen();/__SIZE_TYPE__ strlen();/' \
2224 < $infile > ${DESTDIR}/fixinc.tmp
2226 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2227 ;; # case end for file name test
2234 case "${file}" in .
/sys
/types.h | \
2236 .
/sys
/stdtypes.h | \
2240 if ( test -n "`egrep 'typedef[ ]+[a-z_][ a-z_]*[ ](size|ptrdiff|wchar)_t' ${file}`"
2241 ) > /dev
/null
2>&1 ; then
2244 if [ ! -r ${DESTFILE} ]
2246 else infile
=${DESTFILE} ; fi
2248 sed -e '/^[ ]*\*[ ]*typedef unsigned int size_t;/N' \
2249 -e 's/^\([ ]*\*[ ]*typedef unsigned int size_t;\n[ ]*\*\/\)/\1\
2250 #ifndef __SIZE_TYPE__\
2251 #define __SIZE_TYPE__ long unsigned int\
2253 typedef __SIZE_TYPE__ size_t;\
2255 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/i\
2256 #ifndef __SIZE_TYPE__\
2257 #define __SIZE_TYPE__ long unsigned int\
2260 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/typedef __SIZE_TYPE__ size_t/' \
2261 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/i\
2262 #ifndef __PTRDIFF_TYPE__\
2263 #define __PTRDIFF_TYPE__ long int\
2266 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/typedef __PTRDIFF_TYPE__ ptrdiff_t/' \
2267 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/i\
2268 #ifndef __WCHAR_TYPE__\
2269 #define __WCHAR_TYPE__ int\
2273 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/a\
2276 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/typedef __WCHAR_TYPE__ wchar_t/' \
2277 < $infile > ${DESTDIR}/fixinc.tmp
2279 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2280 fi # end of selection 'if'
2281 ;; # case end for file name test
2286 # Fix 76: Systypes_For_Aix
2288 case "${file}" in .
/sys
/types.h
)
2289 if ( test -n "`egrep 'typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t' ${file}`" -a \
2290 -z "`egrep '_GCC_SIZE_T' ${file}`"
2291 ) > /dev
/null
2>&1 ; then
2294 if [ ! -r ${DESTFILE} ]
2296 else infile
=${DESTFILE} ; fi
2298 sed -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/i\
2299 #ifndef _GCC_SIZE_T\
2302 -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/a\
2305 < $infile > ${DESTDIR}/fixinc.tmp
2307 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2308 fi # end of selection 'if'
2309 ;; # case end for file name test
2314 # Fix 77: Sysv68_String
2316 case "${file}" in .
/string.h
)
2319 if [ ! -r ${DESTFILE} ]
2321 else infile
=${DESTFILE} ; fi
2323 sed -e 's/extern[ ]*int[ ]*strlen();/extern unsigned int strlen();/' \
2324 -e 's/extern[ ]*int[ ]*ffs[ ]*(long);/extern int ffs(int);/' \
2325 -e 's/strdup(char \*s1);/strdup(const char *s1);/' \
2326 -e '/^extern char$/N' \
2327 -e 's/^extern char\(\n \*memccpy(),\)$/extern void\1/' \
2328 -e '/^ strncmp(),$/N' \
2329 -e 's/^\( strncmp()\),\n\( strlen(),\)$/\1;\
2330 extern unsigned int\
2332 -e '/^extern int$/N' \
2333 -e 's/^extern int\(\n strlen(),\)/extern size_t\1/' \
2334 < $infile > ${DESTDIR}/fixinc.tmp
2336 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2337 ;; # case end for file name test
2342 # Fix 78: Sysz_Stdlib_For_Sun
2344 case "${file}" in .
/stdlib.h
)
2346 sysz_stdlib_for_sun"
2347 if [ ! -r ${DESTFILE} ]
2349 else infile
=${DESTFILE} ; fi
2351 sed -e 's/int abort/void abort/g' \
2352 -e 's/int free/void free/g' \
2353 -e 's/char[ ]*\*[ ]*calloc/void \* calloc/g' \
2354 -e 's/char[ ]*\*[ ]*malloc/void \* malloc/g' \
2355 -e 's/char[ ]*\*[ ]*realloc/void \* realloc/g' \
2356 -e 's/int[ ][ ]*exit/void exit/g' \
2357 -e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/i\
2358 #ifndef _GCC_SIZE_T\
2361 -e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/a\
2364 < $infile > ${DESTDIR}/fixinc.tmp
2366 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2367 ;; # case end for file name test
2372 # Fix 79: Sysz_Stdtypes_For_Sun
2374 case "${file}" in .
/sys
/stdtypes.h
)
2376 sysz_stdtypes_for_sun"
2377 if [ ! -r ${DESTFILE} ]
2379 else infile
=${DESTFILE} ; fi
2381 sed -e '/[ ]size_t.*;/i\
2382 #ifndef _GCC_SIZE_T\
2385 -e '/[ ]size_t.*;/a\
2388 -e '/[ ]ptrdiff_t.*;/i\
2389 #ifndef _GCC_PTRDIFF_T\
2390 #define _GCC_PTRDIFF_T
2392 -e '/[ ]ptrdiff_t.*;/a\
2395 -e '/[ ]wchar_t.*;/i\
2396 #ifndef _GCC_WCHAR_T\
2397 #define _GCC_WCHAR_T
2399 -e '/[ ]wchar_t.*;/a\
2402 < $infile > ${DESTDIR}/fixinc.tmp
2404 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2405 ;; # case end for file name test
2410 # Fix 80: Tinfo_Cplusplus
2412 case "${file}" in .
/tinfo.h
)
2415 if [ ! -r ${DESTFILE} ]
2417 else infile
=${DESTFILE} ; fi
2419 sed -e 's/[ ]_cplusplus/ __cplusplus/' \
2420 < $infile > ${DESTDIR}/fixinc.tmp
2422 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2423 ;; # case end for file name test
2428 # Fix 81: Ultrix_Ansi_Compat
2430 case "${file}" in .
/ansi_compat.h
)
2431 if ( test -n "`egrep 'ULTRIX' ${file}`"
2432 ) > /dev
/null
2>&1 ; then
2435 if [ ! -r ${DESTFILE} ]
2437 else infile
=${DESTFILE} ; fi
2440 /* This file intentionally left blank. */
2443 < $infile > ${DESTDIR}/fixinc.tmp
2445 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2446 fi # end of selection 'if'
2447 ;; # case end for file name test
2452 # Fix 82: Ultrix_Fix_Fixproto
2454 case "${file}" in .
/sys
/utsname.h
)
2455 if ( test -n "`egrep 'ULTRIX' ${file}`"
2456 ) > /dev
/null
2>&1 ; then
2458 ultrix_fix_fixproto"
2459 if [ ! -r ${DESTFILE} ]
2461 else infile
=${DESTFILE} ; fi
2463 sed -e '/^[ ]*extern[ ]*int[ ]*uname();$/i\
2466 < $infile > ${DESTDIR}/fixinc.tmp
2468 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2469 fi # end of selection 'if'
2470 ;; # case end for file name test
2475 # Fix 83: Ultrix_Atof_Param
2477 case "${file}" in .
/math.h
)
2480 if [ ! -r ${DESTFILE} ]
2482 else infile
=${DESTFILE} ; fi
2484 sed -e 's@atof(\([ ]*char[ ]*\*[^)]*\))@atof(const \1)@' \
2485 -e 's@inline int abs(int [a-z][a-z]*) {.*}@extern "C" int abs(int);@' \
2486 -e 's@inline double abs(double [a-z][a-z]*) {.*}@@' \
2487 -e 's@inline int sqr(int [a-z][a-z]*) {.*}@@' \
2488 -e 's@inline double sqr(double [a-z][a-z]*) {.*}@@' \
2489 < $infile > ${DESTDIR}/fixinc.tmp
2491 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2492 ;; # case end for file name test
2497 # Fix 84: Ultrix_Const
2499 case "${file}" in .
/stdio.h
)
2502 if [ ! -r ${DESTFILE} ]
2504 else infile
=${DESTFILE} ; fi
2506 sed -e 's@perror( char \*__s );@perror( const char *__s );@' \
2507 -e 's@fputs( char \*__s,@fputs( const char *__s,@' \
2508 -e 's@fopen( char \*__filename, char \*__type );@fopen( const char *__filename, const char *__type );@' \
2509 -e 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@' \
2510 -e 's@fscanf( FILE \*__stream, char \*__format,@fscanf( FILE *__stream, const char *__format,@' \
2511 -e 's@scanf( char \*__format,@scanf( const char *__format,@' \
2512 -e 's@sscanf( char \*__s, char \*__format,@sscanf( const char *__s, const char *__format,@' \
2513 -e 's@popen(char \*, char \*);@popen(const char *, const char *);@' \
2514 -e 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@' \
2515 < $infile > ${DESTDIR}/fixinc.tmp
2517 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2518 ;; # case end for file name test
2523 # Fix 85: Ultrix_Ifdef
2525 case "${file}" in .
/sys
/file.h
)
2526 if ( test -n "`egrep '#ifdef KERNEL' ${file}`"
2527 ) > /dev
/null
2>&1 ; then
2530 if [ ! -r ${DESTFILE} ]
2532 else infile
=${DESTFILE} ; fi
2534 sed -e 's/#ifdef KERNEL/#if defined(KERNEL)/' \
2535 < $infile > ${DESTDIR}/fixinc.tmp
2537 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2538 fi # end of selection 'if'
2539 ;; # case end for file name test
2544 # Fix 86: Ultrix_Nested_Cmnt
2546 case "${file}" in .
/rpc
/svc.h
)
2549 if [ ! -r ${DESTFILE} ]
2551 else infile
=${DESTFILE} ; fi
2553 sed -e 's@^\( \* int protocol; \)/\*@\1*/ /*@' \
2554 < $infile > ${DESTDIR}/fixinc.tmp
2556 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2557 ;; # case end for file name test
2562 # Fix 87: Ultrix_Static
2564 case "${file}" in .
/machine
/cpu.h
)
2565 if ( test -n "`egrep '#include \"r[34]_cpu' ${file}`"
2566 ) > /dev
/null
2>&1 ; then
2569 if [ ! -r ${DESTFILE} ]
2571 else infile
=${DESTFILE} ; fi
2573 sed -e 's/^static struct tlb_pid_state/struct tlb_pid_state/' \
2574 -e 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/' \
2575 -e 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/' \
2576 < $infile > ${DESTDIR}/fixinc.tmp
2578 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2579 fi # end of selection 'if'
2580 ;; # case end for file name test
2585 # Fix 88: Undefine_Null
2587 if ( test -n "`egrep '^#[ ]*define[ ]*[ ]NULL[ ]' ${file}`" -a \
2588 -z "`egrep '#[ ]*(ifn|un)def[ ]*[ ]NULL($|[ ])' ${file}`"
2589 ) > /dev
/null
2>&1 ; then
2592 if [ ! -r ${DESTFILE} ]
2594 else infile
=${DESTFILE} ; fi
2596 sed -e '/^#[ ]*define[ ][ ]*NULL[ ]/i\
2599 < $infile > ${DESTDIR}/fixinc.tmp
2601 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2602 fi # end of selection 'if'
2606 # Fix 89: Va_I960_Macro
2608 case "${file}" in .
/arch
/i960
/archI960.h
)
2609 if ( test -n "`egrep '__(vsiz|vali|vpad|alignof__)' ${file}`"
2610 ) > /dev
/null
2>&1 ; then
2613 if [ ! -r ${DESTFILE} ]
2615 else infile
=${DESTFILE} ; fi
2617 sed -e 's/__vsiz/__vxvsiz/' \
2618 -e 's/__vali/__vxvali/' \
2619 -e 's/__vpad/__vxvpad/' \
2620 -e 's/__alignof__/__vxalignof__/' \
2621 < $infile > ${DESTDIR}/fixinc.tmp
2623 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2624 fi # end of selection 'if'
2625 ;; # case end for file name test
2632 case "${file}" in .
/curses.h | \
2643 if ( test -n "`egrep '#[ ]*define[ ][ ]*NULL[ ].*void' ${file}`"
2644 ) > /dev
/null
2>&1 ; then
2647 if [ ! -r ${DESTFILE} ]
2649 else infile
=${DESTFILE} ; fi
2651 sed -e 's/^#[ ]*define[ ]*NULL[ ]*((void[ ]*\*)0)/#define NULL 0/' \
2652 < $infile > ${DESTDIR}/fixinc.tmp
2654 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2655 fi # end of selection 'if'
2656 ;; # case end for file name test
2661 # Fix 91: Vxworks_Gcc_Problem
2663 case "${file}" in .
/types
/vxTypesBase.h
)
2664 if ( test -n "`egrep '__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__' ${file}`"
2665 ) > /dev
/null
2>&1 ; then
2667 vxworks_gcc_problem"
2668 if [ ! -r ${DESTFILE} ]
2670 else infile
=${DESTFILE} ; fi
2672 sed -e 's/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/#if 1/' \
2674 #ifndef _GCC_SIZE_T\
2680 -e '/[ ]ptrdiff_t/i\
2681 #ifndef _GCC_PTRDIFF_T\
2682 #define _GCC_PTRDIFF_T
2684 -e '/[ ]ptrdiff_t/a\
2688 #ifndef _GCC_WCHAR_T\
2689 #define _GCC_WCHAR_T
2694 < $infile > ${DESTDIR}/fixinc.tmp
2696 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2697 fi # end of selection 'if'
2698 ;; # case end for file name test
2703 # Fix 92: Vxworks_Needs_Vxtypes
2705 case "${file}" in .
/time.h
)
2706 if ( test -n "`egrep 'uint_t[ ][ ]*_clocks_per_sec' ${file}`"
2707 ) > /dev
/null
2>&1 ; then
2709 vxworks_needs_vxtypes"
2710 if [ ! -r ${DESTFILE} ]
2712 else infile
=${DESTFILE} ; fi
2714 sed -e 's/uint_t/unsigned int/' \
2715 < $infile > ${DESTDIR}/fixinc.tmp
2717 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2718 fi # end of selection 'if'
2719 ;; # case end for file name test
2724 # Fix 93: Vxworks_Needs_Vxworks
2726 case "${file}" in .
/sys
/stat.h
)
2727 if ( test -n "`egrep '#[ ]define[ ][ ]*__INCstath' ${file}`" -a \
2728 '(' -r types
/vxTypesOld.h
')' -a \
2729 '(' -n "`egrep '#include' $file`" ')' -a \
2730 '(' -n "`egrep ULONG $file`" ')'
2731 ) > /dev
/null
2>&1 ; then
2733 vxworks_needs_vxworks"
2734 if [ ! -r ${DESTFILE} ]
2736 else infile
=${DESTFILE} ; fi
2738 sed -e '/#[ ]define[ ][ ]*__INCstath/a\
2739 #include <types/vxTypesOld.h>
2741 < $infile > ${DESTDIR}/fixinc.tmp
2743 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2744 fi # end of selection 'if'
2745 ;; # case end for file name test
2750 # Fix 94: Vxworks_Time
2752 case "${file}" in .
/time.h
)
2753 if ( test -n "`egrep 'VOIDFUNCPTR' ${file}`" -a \
2754 '(' -r vxWorks.h
')'
2755 ) > /dev
/null
2>&1 ; then
2758 if [ ! -r ${DESTFILE} ]
2760 else infile
=${DESTFILE} ; fi
2762 sed -e '/VOIDFUNCPTR/i\
2763 #ifndef __gcc_VOIDFUNCPTR_defined\
2765 typedef void (*__gcc_VOIDFUNCPTR) (...);\
2767 typedef void (*__gcc_VOIDFUNCPTR) ();\
2769 #define __gcc_VOIDFUNCPTR_defined\
2772 -e 's/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g' \
2773 < $infile > ${DESTDIR}/fixinc.tmp
2775 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2776 fi # end of selection 'if'
2777 ;; # case end for file name test
2784 case "${file}" in .
/X11
/ShellP.h
)
2785 if ( test -z "`egrep '__cplusplus' ${file}`"
2786 ) > /dev
/null
2>&1 ; then
2789 if [ ! -r ${DESTFILE} ]
2791 else infile
=${DESTFILE} ; fi
2793 sed -e '/char \*class;/i\
2798 -e '/char \*class;/a\
2801 < $infile > ${DESTDIR}/fixinc.tmp
2803 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2804 fi # end of selection 'if'
2805 ;; # case end for file name test
2810 # Fix 96: X11_Class_Usage
2812 case "${file}" in .
/Xm
/BaseClassI.h
)
2813 if ( test -z "`egrep '__cplusplus' ${file}`"
2814 ) > /dev
/null
2>&1 ; then
2817 if [ ! -r ${DESTFILE} ]
2819 else infile
=${DESTFILE} ; fi
2821 sed -e 's/ class[)]/ c_class)/g' \
2822 < $infile > ${DESTDIR}/fixinc.tmp
2824 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2825 fi # end of selection 'if'
2826 ;; # case end for file name test
2833 case "${file}" in .
/Xm
/Traversal.h
)
2834 if ( test -z "`egrep '__cplusplus' ${file}`"
2835 ) > /dev
/null
2>&1 ; then
2838 if [ ! -r ${DESTFILE} ]
2840 else infile
=${DESTFILE} ; fi
2842 sed -e '/Widget old, new;/i\
2847 -e '/Widget old, new;/a\
2850 -e 's/Widget new,/Widget c_new,/g' \
2851 < $infile > ${DESTDIR}/fixinc.tmp
2853 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2854 fi # end of selection 'if'
2855 ;; # case end for file name test
2860 # Fix 98: X11_Sprintf
2862 case "${file}" in .
/X11
*/Xmu.h
)
2865 if [ ! -r ${DESTFILE} ]
2867 else infile
=${DESTFILE} ; fi
2869 sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
2870 extern char * sprintf();\
2871 #endif /* !defined __STDC__ */,' \
2872 < $infile > ${DESTDIR}/fixinc.tmp
2874 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2875 ;; # case end for file name test
2880 # Fix 99: Zzz_Ki_Iface
2882 case "${file}" in .
/sys
/ki_iface.h
)
2883 if ( test -n "`egrep 'These definitions are for HP Internal developers' ${file}`"
2884 ) > /dev
/null
2>&1 ; then
2887 if [ ! -r ${DESTFILE} ]
2889 else infile
=${DESTFILE} ; fi
2890 ( echo "Removing incorrect fix to <$file>" >&2
2891 rm -f ${DESTDIR}/$file ${DESTDIR}/fixinc.tmp
2892 cat > /dev
/null
) < $infile > ${DESTDIR}/fixinc.tmp
2894 # Shell scripts have the potential of removing the output
2895 # We interpret that to mean the file is not to be altered
2897 if test ! -f ${DESTDIR}/fixinc.tmp
2900 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2901 fi # end of selection 'if'
2902 ;; # case end for file name test
2909 case "${file}" in .
/sys
/ki.h
)
2910 if ( test -n "`egrep '11.00 HP-UX LP64' ${file}`"
2911 ) > /dev
/null
2>&1 ; then
2914 if [ ! -r ${DESTFILE} ]
2916 else infile
=${DESTFILE} ; fi
2917 ( echo "Removing incorrect fix to <$file>" >&2
2918 rm -f ${DESTDIR}/$file ${DESTDIR}/fixinc.tmp
2919 cat > /dev
/null
) < $infile > ${DESTDIR}/fixinc.tmp
2921 # Shell scripts have the potential of removing the output
2922 # We interpret that to mean the file is not to be altered
2924 if test ! -f ${DESTDIR}/fixinc.tmp
2927 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2928 fi # end of selection 'if'
2929 ;; # case end for file name test
2934 # Fix 101: Zzz_Ki_Calls
2936 case "${file}" in .
/sys
/ki_calls.h
)
2937 if ( test -n "`egrep 'kthread_create_caller_t' ${file}`"
2938 ) > /dev
/null
2>&1 ; then
2941 if [ ! -r ${DESTFILE} ]
2943 else infile
=${DESTFILE} ; fi
2944 ( echo "Removing incorrect fix to <$file>" >&2
2945 rm -f ${DESTDIR}/$file ${DESTDIR}/fixinc.tmp
2946 cat > /dev
/null
) < $infile > ${DESTDIR}/fixinc.tmp
2948 # Shell scripts have the potential of removing the output
2949 # We interpret that to mean the file is not to be altered
2951 if test ! -f ${DESTDIR}/fixinc.tmp
2954 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2955 fi # end of selection 'if'
2956 ;; # case end for file name test
2961 # Fix 102: Zzz_Ki_Defs
2963 case "${file}" in .
/sys
/ki_defs.h
)
2964 if ( test -n "`egrep 'Kernel Instrumentation Definitions' ${file}`"
2965 ) > /dev
/null
2>&1 ; then
2968 if [ ! -r ${DESTFILE} ]
2970 else infile
=${DESTFILE} ; fi
2971 ( echo "Removing incorrect fix to <$file>" >&2
2972 rm -f ${DESTDIR}/$file ${DESTDIR}/fixinc.tmp
2973 cat > /dev
/null
) < $infile > ${DESTDIR}/fixinc.tmp
2975 # Shell scripts have the potential of removing the output
2976 # We interpret that to mean the file is not to be altered
2978 if test ! -f ${DESTDIR}/fixinc.tmp
2981 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
2982 fi # end of selection 'if'
2983 ;; # case end for file name test
2988 # Fix 103: Zzz_Bad_Fixes
2990 case "${file}" in .
/sundev
/ipi_error.h
)
2993 if [ ! -r ${DESTFILE} ]
2995 else infile
=${DESTFILE} ; fi
2996 ( echo "Removing incorrect fix to <$file>" >&2
2997 rm -f ${DESTDIR}/$file ${DESTDIR}/fixinc.tmp
2998 cat > /dev
/null
) < $infile > ${DESTDIR}/fixinc.tmp
3000 # Shell scripts have the potential of removing the output
3001 # We interpret that to mean the file is not to be altered
3003 if test ! -f ${DESTDIR}/fixinc.tmp
3006 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
3007 ;; # case end for file name test
3014 case "${file}" in .
/sys
/time.h
)
3015 if ( test -n "`egrep '11.0 and later representation of ki time' ${file}`"
3016 ) > /dev
/null
2>&1 ; then
3019 if [ ! -r ${DESTFILE} ]
3021 else infile
=${DESTFILE} ; fi
3022 ( echo "Removing incorrect fix to <$file>" >&2
3023 rm -f ${DESTDIR}/$file ${DESTDIR}/fixinc.tmp
3024 cat > /dev
/null
) < $infile > ${DESTDIR}/fixinc.tmp
3026 # Shell scripts have the potential of removing the output
3027 # We interpret that to mean the file is not to be altered
3029 if test ! -f ${DESTDIR}/fixinc.tmp
3032 mv -f ${DESTDIR}/fixinc.tmp
${DESTFILE}
3033 fi # end of selection 'if'
3034 ;; # case end for file name test
3036 # IF the output has been removed OR it is unchanged,
3037 # THEN ensure the output is gone
3038 # ELSE look for local directory include syntax
3040 if ( test ! -f ${DESTFILE} || \
3041 cmp ${file} ${DESTFILE} ) > /dev
/null
2>&1
3045 echo "Fixed ${file}:${fixlist}"
3047 # Find any include directives that use "file".
3049 dir
=`echo ${file} | sed -e s';/[^/]*$;;'`
3050 ddir
=${DESTDIR}/$dir
3053 egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${DESTFILE} |
3054 sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`
3056 required
="$required ${SRCDIR} $dir/$include ${ddir}/$include"
3059 done # for file in $files
3063 ## Make sure that any include files referenced using double quotes
3064 ## exist in the fixed directory. This comes last since otherwise
3065 ## we might end up deleting some of these files "because they don't
3066 ## need any change."
3067 set x
`echo $required`
3069 while [ $# != 0 ]; do
3071 while [ $# != 0 ]; do
3072 # $1 is the directory to copy from,
3073 # $2 is the unfixed file,
3074 # $3 is the fixed file name.
3079 if [ -r $2 ] && [ ! -r $3 ]; then
3080 cp $2 $3 >/dev
/null
2>&1 ||
echo "Can't copy $2" >&2
3081 chmod +w
$3 2>/dev
/null
3082 chmod a
+r
$3 2>/dev
/null
3084 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 |
3085 sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`
3087 dir
=`echo $2 | sed -e s'|/[^/]*$||'`
3088 dir2
=`echo $3 | sed -e s'|/[^/]*$||'`
3089 newreq
="$newreq $1 $dir/$include $dir2/$include"
3099 echo 'Cleaning up DONE files.'
3101 find .
-name DONE
-exec rm -f '{}' ';'
3103 echo 'Removing unneeded directories:'
3105 all_dirs
=`find . -type d -print | sort -r`
3106 for file in $all_dirs; do
3107 rmdir $LIB/$file > /dev
/null
2>&1
3110 # # # # # # # # # # # # # # # # # # # # #
3112 # End of for INPUT directories
3116 # # # # # # # # # # # # # # # # # # # # #
3119 rm -f include
/assert.h
3120 cp ${srcdir}/assert.h include
/assert.h ||
exit 1
3121 chmod a
+r include
/assert.h