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