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