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