2 # Install modified versions of certain ANSI-incompatible system header files
3 # which are fixed to work correctly with ANSI C
4 # and placed in a directory that GNU C will search.
6 # See README-fixinc for more information.
8 # Directory containing the original header files.
9 # (This was named INCLUDES, but that conflicts with a name in Makefile.in.)
10 INPUT
=${2-${INPUT-/usr/include}}
12 # Directory in which to store the results.
13 LIB
=${1?"fixincludes: output directory not specified"}
15 # Define PWDCMD as a command to use to get the working dir
16 # in the form that we want.
20 # On an Apollo, discard everything before `/usr'.
21 PWDCMD
="eval pwd | sed -e 's,.*/usr/,/usr/,'"
28 # Make sure it exists.
29 if [ ! -d $LIB ]; then
33 # Make LIB absolute only if needed to avoid problems with the amd.
38 cd $LIB; LIB
=`${PWDCMD}`
42 # Fail if no arg to specify a directory for the output.
44 then echo fixincludes
: no output directory specified
48 echo Building fixed headers
in ${LIB}
50 # Determine whether this system has symbolic links.
51 if ln -s X
$LIB/ShouldNotExist
2>/dev
/null
; then
52 rm -f $LIB/ShouldNotExist
54 elif ln -s X
/tmp
/ShouldNotExist
2>/dev
/null
; then
55 rm -f /tmp
/ShouldNotExist
61 echo Finding directories and links to directories
63 # Find all directories and all symlinks that point to directories.
64 # Put the list in $files.
65 # Each time we find a symlink, add it to newdirs
66 # so that we do another find within the dir the link points to.
67 # Note that $files may have duplicates in it;
68 # later parts of this file are supposed to ignore them.
71 while [ -n "$dirs" ] && [ $levels -gt 0 ]
73 levels
=`expr $levels - 1`
77 echo " Searching $INPUT/$d"
83 # Find all directories under $d, relative to $d, excluding $d itself.
84 files
="$files `find $d -type d -print | \
85 sed -e '/\/\.$/d' -e '/^\.$/d'`"
86 # Find all links to directories.
87 # Using `-exec test -d' in find fails on some systems,
88 # and trying to run test via sh fails on others,
89 # so this is the simplest alternative left.
90 # First find all the links, then test each one.
93 theselinks
=`find $d -type l -print`
94 for d1
in $theselinks --dummy--
96 # If the link points to a directory,
97 # add that dir to $newdirs
101 if [ "`ls -ld $d1 | sed -n 's/.*-> //p'`" != "." ]
103 newdirs
="$newdirs $d1"
113 echo "All directories (including links to directories):"
116 for file in $files; do
118 if [ ! -d $LIB/$file ]
119 then mkdir
$LIB/$file
124 # treetops gets an alternating list
125 # of old directories to copy
126 # and the new directories to copy to.
127 treetops
="${INPUT} ${LIB}"
130 echo 'Making symbolic directory links'
131 for file in $files; do
132 dest
=`ls -ld $file | sed -n 's/.*-> //p'`
135 # In case $dest is relative, get to $file's dir first.
137 cd `echo ./$file | sed -n 's&[^/]*$&&p'`
138 # Check that the target directory exists.
139 # Redirections changed to avoid bug in sh on Ultrix.
140 (cd $dest) > /dev
/null
2>&1
143 # X gets the dir that the link actually leads to.
145 # Canonicalize ${INPUT} now to minimize the time an
146 # automounter has to change the result of ${PWDCMD}.
147 cinput
=`cd ${INPUT}; ${PWDCMD}`
148 # If a link points to ., make a similar link to .
149 if [ $x = ${cinput} ]; then
150 echo $file '->' .
': Making link'
151 rm -fr ${LIB}/$file > /dev
/null
2>&1
152 ln -s .
${LIB}/$file > /dev
/null
2>&1
153 # If link leads back into ${INPUT},
154 # make a similar link here.
155 elif expr $x : "${cinput}/.*" > /dev
/null
; then
156 # Y gets the actual target dir name, relative to ${INPUT}.
157 y
=`echo $x | sed -n "s&${cinput}/&&p"`
158 # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
160 sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
161 echo $file '->' $dots$y ': Making link'
162 rm -fr ${LIB}/$file > /dev
/null
2>&1
163 ln -s $dots$y ${LIB}/$file > /dev
/null
2>&1
165 # If the link is to a dir $target outside ${INPUT},
166 # repoint the link at ${INPUT}/root$target
167 # and process $target into ${INPUT}/root$target
168 # treat this directory as if it actually contained the files.
169 echo $file '->' root
$x ': Making link'
170 if [ -d $LIB/root
$x ]
176 while [ x
$dirname != x
]; do
177 component
=`echo $dirname | sed -e 's|/.*$||'`
178 mkdir
$component >/dev
/null
2>&1
180 dirmade
=$dirmade/$component
181 dirname=`echo $dirname | sed -e 's|[^/]*/||'`
184 # Duplicate directory structure created in ${LIB}/$file in new
186 for file2
in $files; do
189 dupdir
=${LIB}/root
$x/`echo $file2 | sed -n "s|^${file}/||p"`
190 echo "Duplicating ${file}'s ${dupdir}"
201 # Get the path from ${LIB} to $file, accounting for symlinks.
202 parent
=`echo "$file" | sed -e 's@/[^/]*$@@'`
203 libabs
=`cd ${LIB}; ${PWDCMD}`
204 file2
=`cd ${LIB}; cd $parent; ${PWDCMD} | sed -e "s@^${libabs}@@"`
205 # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
206 dots
=`echo "$file2" | sed -e 's@/[^/]*@../@g'`
207 rm -fr ${LIB}/$file > /dev
/null
2>&1
208 ln -s ${dots}root
$x ${LIB}/$file > /dev
/null
2>&1
209 treetops
="$treetops $x ${LIB}/root$x"
220 while [ $# != 0 ]; do
221 # $1 is an old directory to copy, and $2 is the new directory to copy to.
224 # The same dir can appear more than once in treetops.
225 # There's no need to scan it more than once.
231 echo Fixing directory
$1 into
$2
232 # Check .h files which are symlinks as well as those which are files.
233 # A link to a header file will not be processed by anything but this.
235 files
=`find . -name '*.h' \( -type f -o -type l \) -print`
237 files
=`find . -name '*.h' -type f -print`
239 echo Checking header files
241 # Note that BSD43_* are used on recent MIPS systems.
242 for file in $files; do
243 # This call to egrep is essential, since checking a file with egrep
244 # is much faster than actually trying to fix it.
245 # It is also essential that most files *not* match!
246 # Thus, matching every #endif is unacceptable.
247 # But the argument to egrep must be kept small, or many versions of egrep
248 # won't be able to handle it.
250 # We use the pattern [!-.0-~] instead of [^/ ] to match a noncomment
251 # following #else or #endif because some buggy egreps think [^/] matches
252 # newline, and they thus think `#else ' matches `#e[ndiflse]*[ ]+[^/ ]'.
254 # We use the pattern [^a-zA-Z0-9_][_a-ce-km-z][a-z0-9] to match an identifier
255 # following #if or #elif that is not surrounded by __. The `a-ce-km-z'
256 # in this pattern lacks `d' and `l'; this means we don't worry about
257 # identifiers starting with `d' or `l'. This is OK, since none of the
258 # identifiers below start with `d' or `l'. It also greatly improves
259 # performance, since many files contain lines of the form `#if ... defined ...'
261 if egrep '//|[ _]_IO|CTRL|^#define.NULL|^#e[nl][ds][ief]*[ ]+[!-.0-~]|^#[el]*if.*[^a-zA-Z0-9_][_a-ce-km-zA-Z][a-zA-Z0-9]' $file >/dev
/null
; then
262 if [ -r $file ]; then
263 cp $file $2/$file >/dev
/null
2>&1 \
264 ||
echo "Can't copy $file"
267 # Here is how the sed commands in braces work.
268 # (It doesn't work to put the comments inside the sed commands.)
269 # Surround each word with spaces, to simplify matching below.
270 # ANSIfy each pre-ANSI machine-dependent symbol
271 # by surrounding it with __ __.
272 # Remove the spaces that we inserted around each word.
277 s%^\([ ]*#[ ]*else\)[ ]*/[^*].*%\1%
278 s%^\([ ]*#[ ]*else\)[ ]*[^/ ].*%\1%
279 s%^\([ ]*#[ ]*endif\)[ ]*/[^*].*%\1%
280 s%^\([ ]*#[ ]*endif\)[ ]*\*[^/].*%\1%
281 s%^\([ ]*#[ ]*endif\)[ ]*[^/* ].*%\1%
282 /\/\/[^*]/ s|//\(.*\)$|/*\1*/|
283 /[ ]_IO[A-Z]*[ ]*(/ s/\(_IO[A-Z]*[ ]*(\)\(.\),/\1'\''\2'\'',/
284 /[ ]BSD43__IO[A-Z]*[ ]*(/ s/(\(.\),/('\''\1'\'',/
285 /#define._IO/ s/'\''\([cgxtf]\)'\''/\1/g
286 /#define.BSD43__IO/ s/'\''\([cgx]\)'\''/\1/g
287 /[^A-Z0-9_]CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/
288 /[^A-Z0-9]_CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/
289 /#define[ ]*[ ]CTRL/ s/'\''\([cgx]\)'\''/\1/g
290 /#define[ ]*[ ]_CTRL/ s/'\''\([cgx]\)'\''/\1/g
291 /#define.BSD43_CTRL/ s/'\''\([cgx]\)'\''/\1/g
293 s/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g
295 s/ bsd4\([0-9]\) / __bsd4\1__ /g
296 s/ _*host_mips / __host_mips__ /g
297 s/ _*i386 / __i386__ /g
299 s/ is68k / __is68k__ /g
300 s/ m68k / __m68k__ /g
301 s/ mc680\([0-9]\)0 / __mc680\10__ /g
302 s/ m88k / __m88k__ /g
303 s/ _*mips / __mips__ /g
304 s/ news\([0-9]*\) / __news\1__ /g
305 s/ ns32000 / __ns32000__ /g
306 s/ pdp11 / __pdp11__ /g
309 s/ sony_news / __sony_news__ /g
310 s/ sparc / __sparc__ /g
311 s/ sun\([a-z0-9]*\) / __sun\1__ /g
312 s/ tahoe / __tahoe__ /g
313 s/ tower\([_0-9]*\) / __tower\1__ /g
314 s/ u370 / __u370__ /g
315 s/ u3b\([0-9]*\) / __u3b\1__ /g
316 s/ unix / __unix__ /g
318 s/ _*MIPSE\([LB]\) / __MIPSE\1__ /g
319 s/ _*\([Rr][34]\)000 / __\1000__ /g
320 s/ _*SYSTYPE_\([A-Z0-9]*\) / __SYSTYPE_\1__ /g
322 s/ \([a-zA-Z0-9_][a-zA-Z0-9_]*\) /\1/g
324 /^#define.NULL[ ]/ i\
326 ' $2/$file > $2/$file.
327 mv $2/$file.
$2/$file
328 if cmp $file $2/$file >/dev
/null
2>&1 \
329 ||
egrep 'This file is part of the GNU C Library' $2/$file >/dev
/null
2>&1; then
333 # Find any include directives that use "file".
334 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $2/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
335 dir
=`echo $file | sed -e s'|/[^/]*$||'`
336 required
="$required $1 $dir/$include $2/$dir/$include"
347 # Install the proper definition of the three standard types in header files
348 # that they come from.
349 for file in sys
/types.h stdlib.h sys
/stdtypes.h stddef.h memory.h unistd.h
; do
350 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
351 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
352 chmod +w
${LIB}/$file 2>/dev
/null
353 chmod a
+r
${LIB}/$file 2>/dev
/null
356 if [ -r ${LIB}/$file ]; then
357 echo Fixing size_t
, ptrdiff_t and wchar_t
in $file
359 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/i\
360 #ifndef __SIZE_TYPE__\
361 #define __SIZE_TYPE__ long unsigned int\
364 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/typedef __SIZE_TYPE__ size_t/' \
365 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/i\
366 #ifndef __PTRDIFF_TYPE__\
367 #define __PTRDIFF_TYPE__ long int\
370 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/typedef __PTRDIFF_TYPE__ ptrdiff_t/' \
371 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/i\
372 #ifndef __WCHAR_TYPE__\
373 #define __WCHAR_TYPE__ int\
377 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/a\
380 -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/typedef __WCHAR_TYPE__ wchar_t/' \
381 ${LIB}/$file > ${LIB}/${file}.
sed
382 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
383 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
386 # Find any include directives that use "file".
387 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
388 dir
=`echo $file | sed -e s'|/[^/]*$||'`
389 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
395 # Fix one other error in this file: a mismatched quote not inside a C comment.
396 file=sundev
/vuid_event.h
397 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
398 mkdir
${LIB}/sundev
2>/dev
/null
399 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
400 chmod +w
${LIB}/$file 2>/dev
/null
401 chmod a
+r
${LIB}/$file 2>/dev
/null
404 if [ -r ${LIB}/$file ]; then
405 echo Fixing
$file comment
406 sed -e "s/doesn't/does not/" ${LIB}/$file > ${LIB}/${file}.
sed
407 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
408 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
411 # Find any include directives that use "file".
412 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
413 dir
=`echo $file | sed -e s'|/[^/]*$||'`
414 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
419 # Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
420 file=sunwindow
/win_cursor.h
421 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
422 # mkdir ${LIB}/sunwindow 2>/dev/null
423 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
424 chmod +w
${LIB}/$file 2>/dev
/null
426 if [ -r ${LIB}/$file ]; then
428 sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.
sed
429 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
430 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
433 # Find any include directives that use "file".
434 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
435 dir
=`echo $file | sed -e s'|/[^/]*$||'`
436 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
440 file=sunwindow
/win_lock.h
441 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
442 # mkdir ${LIB}/sunwindow 2>/dev/null
443 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
444 chmod +w
${LIB}/$file 2>/dev
/null
446 if [ -r ${LIB}/$file ]; then
448 sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.
sed
449 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
450 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
453 # Find any include directives that use "file".
454 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
455 dir
=`echo $file | sed -e s'|/[^/]*$||'`
456 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
461 # Fix this Sun file to avoid interfering with stddef.h.
463 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
464 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
465 chmod +w
${LIB}/$file 2>/dev
/null
466 chmod a
+r
${LIB}/$file 2>/dev
/null
469 if [ -r ${LIB}/$file ]; then
471 sed -e '/[ ]size_t.*;/i\
478 -e '/[ ]ptrdiff_t.*;/i\
479 #ifndef _GCC_PTRDIFF_T\
480 #define _GCC_PTRDIFF_T
482 -e '/[ ]ptrdiff_t.*;/a\
485 -e '/[ ]wchar_t.*;/i\
486 #ifndef _GCC_WCHAR_T\
489 -e '/[ ]wchar_t.*;/a\
491 ' ${LIB}/$file > ${LIB}/${file}.
sed
492 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
493 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
496 # Find any include directives that use "file".
497 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
498 dir
=`echo $file | sed -e s'|/[^/]*$||'`
499 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
504 # Fix this ARM/RISCiX file to avoid interfering with the use of __wchar_t
507 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
508 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
509 chmod +w
${LIB}/$file 2>/dev
/null
510 chmod a
+r
${LIB}/$file 2>/dev
/null
513 if [ -r ${LIB}/$file ]; then
515 sed -e "s/\(#[ ]*ifndef[ ]*\)__wchar_t/\1_GCC_WCHAR_T/" \
516 -e "s/\(#[ ]*define[ ]*\)__wchar_t/\1_GCC_WCHAR_T/" \
517 ${LIB}/$file > ${LIB}/${file}.
sed
518 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
519 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
522 # Find any include directives that use "file".
523 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
524 dir
=`echo $file | sed -e s'|/[^/]*$||'`
525 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
530 # Fix this ARM/RISCiX file where ___type is a Compiler hint that is specific to
531 # the Norcroft compiler.
533 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
534 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
535 chmod +w
${LIB}/$file 2>/dev
/null
536 chmod a
+r
${LIB}/$file 2>/dev
/null
539 if [ -r ${LIB}/$file ]; then
541 sed -e "s/___type p_type/p_type/" \
542 ${LIB}/$file > ${LIB}/${file}.
sed
543 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
544 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
547 # Find any include directives that use "file".
548 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
549 dir
=`echo $file | sed -e s'|/[^/]*$||'`
550 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
555 # Fix this file to avoid interfering with stddef.h, but don't mistakenly
556 # match ssize_t present in AIX for the ps/2, or typedefs which use (but do not
559 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
560 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
561 chmod +w
${LIB}/$file 2>/dev
/null
562 chmod a
+r
${LIB}/$file 2>/dev
/null
565 if [ -r ${LIB}/$file ]; then
567 sed -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/i\
571 -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/a\
573 ' ${LIB}/$file > ${LIB}/${file}.
sed
574 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
575 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
578 # Find any include directives that use "file".
579 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
580 dir
=`echo $file | sed -e s'|/[^/]*$||'`
581 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
586 # Fix HP's use of ../machine/inline.h to refer to
587 # /usr/include/machine/inline.h
589 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
590 cp $file ${LIB}/$file
592 if [ -r ${LIB}/$file ] ; then
594 sed -e 's,"../machine/inline.h",<machine/inline.h>,' \
595 -e 's,"../machine/psl.h",<machine/psl.h>,' \
596 ${LIB}/$file > ${LIB}/${file}.
sed
597 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
598 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
601 # Find any include directives that use "file".
602 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
603 dir
=`echo $file | sed -e s'|/[^/]*$||'`
604 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
609 # Fix an error in this file: the #if says _cplusplus, not the double
610 # underscore __cplusplus that it should be
612 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
613 mkdir
${LIB}/rpcsvc
2>/dev
/null
614 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
615 chmod +w
${LIB}/$file 2>/dev
/null
616 chmod a
+r
${LIB}/$file 2>/dev
/null
619 if [ -r ${LIB}/$file ]; then
620 echo Fixing
$file, __cplusplus macro
621 sed -e 's/[ ]_cplusplus/ __cplusplus/' ${LIB}/$file > ${LIB}/${file}.
sed
622 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
623 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
626 # Find any include directives that use "file".
627 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
628 dir
=`echo $file | sed -e s'|/[^/]*$||'`
629 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
634 # Fix an error in this file: a missing semi-colon at the end of the statsswtch
635 # structure definition.
637 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
638 mkdir
${LIB}/rpcsvc
2>/dev
/null
639 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
640 chmod +w
${LIB}/$file 2>/dev
/null
641 chmod a
+r
${LIB}/$file 2>/dev
/null
644 if [ -r ${LIB}/$file ]; then
645 echo Fixing
$file, definition of statsswtch
646 sed -e 's/boottime$/boottime;/' ${LIB}/$file > ${LIB}/${file}.
sed
647 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
648 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
651 # Find any include directives that use "file".
652 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
653 dir
=`echo $file | sed -e s'|/[^/]*$||'`
654 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
659 # Fix an error in this file: a missing semi-colon at the end of the nodeent
660 # structure definition.
661 file=netdnet
/dnetdb.h
662 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
663 mkdir
${LIB}/netdnet
2>/dev
/null
664 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
665 chmod +w
${LIB}/$file 2>/dev
/null
666 chmod a
+r
${LIB}/$file 2>/dev
/null
669 if [ -r ${LIB}/$file ]; then
670 echo Fixing
$file, definition of nodeent
671 sed -e 's/char.*na_addr *$/char *na_addr;/' ${LIB}/$file > ${LIB}/${file}.
sed
672 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
673 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
676 # Find any include directives that use "file".
677 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
678 dir
=`echo $file | sed -e s'|/[^/]*$||'`
679 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
684 # Check for bad #ifdef line (in Ultrix 4.1)
686 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
687 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
688 chmod +w
${LIB}/$file 2>/dev
/null
689 chmod a
+r
${LIB}/$file 2>/dev
/null
692 if [ -r ${LIB}/$file ]; then
693 echo Fixing
$file, bad \
#ifdef line
694 sed -e 's/#ifdef KERNEL/#if defined(KERNEL)/' ${LIB}/$file > ${LIB}/${file}.
sed
695 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
696 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
699 # Find any include directives that use "file".
700 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
701 dir
=`echo $file | sed -e s'|/[^/]*$||'`
702 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
707 # Check for superfluous `static' (in Ultrix 4.2)
708 # On Ultrix 4.3, includes of other files (r3_cpu.h,r4_cpu.h) is broken.
710 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
711 mkdir
${LIB}/machine
2>/dev
/null
712 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
713 chmod +w
${LIB}/$file 2>/dev
/null
714 chmod a
+r
${LIB}/$file 2>/dev
/null
717 if [ -r ${LIB}/$file ]; then
718 echo Fixing
$file, superfluous static and broken includes of other files.
719 sed -e 's/^static struct tlb_pid_state/struct tlb_pid_state/' \
720 -e 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/' \
721 -e 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/' \
722 ${LIB}/$file > ${LIB}/${file}.
sed
723 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
724 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
727 # Find any include directives that use "file".
728 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
729 dir
=`echo $file | sed -e s'|/[^/]*$||'`
730 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
732 # This file has an alternative name, mips/cpu.h. Fix that name, too.
733 if cmp machine
/cpu.h mips
/cpu.h
> /dev
/null
2>&1; then
734 mkdir
${LIB}/mips
2>&-
735 # Don't remove the file first, they may be the same file!
736 ln ${LIB}/$file ${LIB}/mips
/cpu.h
> /dev
/null
2>&1
741 # Incorrect sprintf declaration in X11/Xmu.h
743 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
744 mkdir
${LIB}/X11
2>/dev
/null
745 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
746 chmod +w
${LIB}/$file 2>/dev
/null
747 chmod a
+r
${LIB}/$file 2>/dev
/null
750 if [ -r ${LIB}/$file ]; then
751 echo Fixing
$file sprintf declaration
752 sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
753 extern char * sprintf();\
754 #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.
sed
755 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
756 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
759 # Find any include directives that use "file".
760 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
761 dir
=`echo $file | sed -e s'|/[^/]*$||'`
762 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
767 # Incorrect sprintf declaration in X11/Xmu/Xmu.h
768 # (It's not clear whether the right file name is this or X11/Xmu.h.)
770 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
771 mkdir
${LIB}/X11
/Xmu
2>/dev
/null
772 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
773 chmod +w
${LIB}/$file 2>/dev
/null
774 chmod a
+r
${LIB}/$file 2>/dev
/null
777 if [ -r ${LIB}/$file ]; then
778 echo Fixing
$file sprintf declaration
779 sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
780 extern char * sprintf();\
781 #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.
sed
782 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
783 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
786 # Find any include directives that use "file".
787 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
788 dir
=`echo $file | sed -e s'|/[^/]*$||'`
789 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
794 # Check for missing ';' in struct
796 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
797 mkdir
${LIB}/netinet
2>/dev
/null
798 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
799 chmod +w
${LIB}/$file 2>/dev
/null
800 chmod a
+r
${LIB}/$file 2>/dev
/null
803 if [ -r ${LIB}/$file ]; then
805 sed -e '/^struct/,/^};/s/}$/};/' ${LIB}/$file > ${LIB}/${file}.
sed
806 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
807 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
810 # Find any include directives that use "file".
811 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
812 dir
=`echo $file | sed -e s'|/[^/]*$||'`
813 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
818 # Fix the CAT macro in SunOS memvar.h.
819 file=pixrect
/memvar.h
820 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
821 mkdir
${LIB}/pixrect
2>/dev
/null
822 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
823 chmod +w
${LIB}/$file 2>/dev
/null
824 chmod a
+r
${LIB}/$file 2>/dev
/null
827 if [ -r ${LIB}/$file ]; then
829 sed -e '/^#define.CAT(a,b)/ i\
831 #define CAT(a,b) a##b\
833 /^#define.CAT(a,b)/ a\
835 ' ${LIB}/$file > ${LIB}/${file}.
sed
836 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
837 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
840 # Find any include directives that use "file".
841 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
842 dir
=`echo $file | sed -e s'|/[^/]*$||'`
843 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
848 # Check for yet more missing ';' in struct (in SunOS 4.0.x)
850 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
851 mkdir
${LIB}/rpcsvc
2>/dev
/null
852 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
853 chmod +w
${LIB}/$file 2>/dev
/null
854 chmod a
+r
${LIB}/$file 2>/dev
/null
857 if [ -r ${LIB}/$file ]; then
859 sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' ${LIB}/$file > ${LIB}/${file}.
sed
860 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
861 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
864 # Find any include directives that use "file".
865 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
866 dir
=`echo $file | sed -e s'|/[^/]*$||'`
867 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
872 # Fix return type of exit and abort in <stdlib.h> on SunOS 4.1.
873 # Also wrap protection around size_t for m88k-sysv3 systems.
875 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
876 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
877 chmod +w
${LIB}/$file 2>/dev
/null
878 chmod a
+r
${LIB}/$file 2>/dev
/null
881 if [ -r ${LIB}/$file ]; then
883 sed -e 's/int abort/void abort/g' \
884 -e 's/int free/void free/g' \
885 -e 's/char \* calloc/void \* calloc/g' \
886 -e 's/char \* malloc/void \* malloc/g' \
887 -e 's/char \* realloc/void \* realloc/g' \
888 -e 's/int exit/void exit/g' \
889 -e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/i\
893 -e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/a\
896 ${LIB}/$file > ${LIB}/${file}.
sed
897 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
898 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
901 # Find any include directives that use "file".
902 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
903 dir
=`echo $file | sed -e s'|/[^/]*$||'`
904 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
909 # Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
911 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
912 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
913 chmod +w
${LIB}/$file 2>/dev
/null
914 chmod a
+r
${LIB}/$file 2>/dev
/null
917 if [ -r ${LIB}/$file ]; then
919 sed -e 's/typedef[ ]char \* malloc_t/typedef void \* malloc_t/g' \
920 -e 's/int[ ][ ]*free/void free/g' \
921 ${LIB}/$file > ${LIB}/${file}.
sed
922 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
923 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
926 # Find any include directives that use "file".
927 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
928 dir
=`echo $file | sed -e s'|/[^/]*$||'`
929 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
934 # Fix bogus #ifdef in <hsfs/hsfs_spec.h> on SunOS 4.1.
935 file=hsfs
/hsfs_spec.h
936 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
937 mkdir
${LIB}/hsfs
2>/dev
/null
938 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
939 chmod +w
${LIB}/$file 2>/dev
/null
940 chmod a
+r
${LIB}/$file 2>/dev
/null
943 if [ -r ${LIB}/$file ]; then
945 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
946 ${LIB}/$file > ${LIB}/${file}.
947 rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
948 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
951 # Find any include directives that use "file".
952 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
953 dir
=`echo $file | sed -e s'|/[^/]*$||'`
954 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
959 # Fix bogus #ifdef in <hsfs/hsnode.h> on SunOS 4.1.
961 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
962 mkdir
${LIB}/hsfs
2>/dev
/null
963 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
964 chmod +w
${LIB}/$file 2>/dev
/null
965 chmod a
+r
${LIB}/$file 2>/dev
/null
968 if [ -r ${LIB}/$file ]; then
970 sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \
971 ${LIB}/$file > ${LIB}/${file}.
sed
972 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
973 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
976 # Find any include directives that use "file".
977 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
978 dir
=`echo $file | sed -e s'|/[^/]*$||'`
979 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
984 # Fix bogus #ifdef in <hsfs/iso_spec.h> on SunOS 4.1.
986 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
987 mkdir
${LIB}/hsfs
2>/dev
/null
988 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
989 chmod +w
${LIB}/$file 2>/dev
/null
990 chmod a
+r
${LIB}/$file 2>/dev
/null
993 if [ -r ${LIB}/$file ]; then
995 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
996 ${LIB}/$file > ${LIB}/${file}.
sed
997 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
998 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1001 # Find any include directives that use "file".
1002 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1003 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1004 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1009 # Incorrect #include in Sony News-OS 3.2.
1010 file=machine
/machparam.h
1011 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1012 mkdir
${LIB}/machine
2>/dev
/null
1013 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1014 chmod +w
${LIB}/$file 2>/dev
/null
1015 chmod a
+r
${LIB}/$file 2>/dev
/null
1018 if [ -r ${LIB}/$file ]; then
1019 echo Fixing
$file, incorrect \
#include
1020 sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \
1021 ${LIB}/$file > ${LIB}/${file}.
1022 rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
1023 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1026 # Find any include directives that use "file".
1027 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1028 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1029 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1034 # Multiline comment after typedef on IRIX 4.0.1.
1036 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1037 mkdir
${LIB}/sys
2>/dev
/null
1038 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1039 chmod +w
${LIB}/$file 2>/dev
/null
1040 chmod a
+r
${LIB}/$file 2>/dev
/null
1043 if [ -r ${LIB}/$file ]; then
1044 echo Fixing
$file, comment
in the middle of \
#ifdef
1045 sed -e 's@type of the result@type of the result */@' \
1046 -e 's@of the sizeof@/* of the sizeof@' \
1047 ${LIB}/$file > ${LIB}/${file}.
sed
1048 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1049 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1052 # Find any include directives that use "file".
1053 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1054 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1055 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1060 # Turning // comments into /* */ comments trashes this IRIX 4.0.1
1061 # header file, which embeds // comments inside multi-line /* */
1062 # comments. If this looks like the IRIX header file, we refix it by
1063 # just throwing away the // comments.
1065 if [ -r ${LIB}/$file ]; then
1066 if egrep indigo.esd
${LIB}/$file > /dev
/null
; then
1067 echo Fixing
$file, overeager
sed script
1069 sed -e 's|//.*$||g' $file > ${LIB}/$file
1070 chmod +w
${LIB}/$file 2>/dev
/null
1071 chmod a
+r
${LIB}/$file 2>/dev
/null
1075 # Some IRIX header files contains the string "//"
1076 for file in elf_abi.h elf.h
; do
1077 if [ -r ${LIB}/$file ]; then
1078 echo Fixing
$file, overeager
sed script
1079 sed -e 's|"/\*"\*/|"//"|' ${LIB}/$file > ${LIB}/${file}.
sed
1080 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1081 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1084 # Find any include directives that use "file".
1085 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1086 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1087 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1093 # IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr in prototype without
1094 # previous definition.
1096 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1097 mkdir
${LIB}/rpc
2>/dev
/null
1098 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1099 chmod +w
${LIB}/$file 2>/dev
/null
1100 chmod a
+r
${LIB}/$file 2>/dev
/null
1103 if [ -r ${LIB}/$file ]; then
1104 echo Fixing
$file, undefined
type
1105 sed -e '/authdes_create.*struct sockaddr/i\
1108 ${LIB}/$file > ${LIB}/$file.
sed
1109 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1110 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1113 # Find any include directives that use "file".
1114 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1115 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1116 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1121 # IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s in prototype without previous
1124 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1125 mkdir
${LIB}/rpc
2>/dev
/null
1126 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1127 chmod +w
${LIB}/$file 2>/dev
/null
1128 chmod a
+r
${LIB}/$file 2>/dev
/null
1131 if [ -r ${LIB}/$file ]; then
1132 echo Fixing
$file, undefined
type
1133 sed -e '/xdrstdio_create.*struct __file_s/i\
1136 ${LIB}/$file > ${LIB}/$file.
sed
1137 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1138 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1141 # Find any include directives that use "file".
1142 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1143 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1144 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1149 # Same problem with a file from SunOS 4.1.3 : a header file containing
1150 # the string "//" embedded in "/**/"
1151 file=sbusdev
/audiovar.h
1152 if [ -r ${LIB}/$file ]; then
1153 echo Fixing
$file, overeager
sed script
1155 sed -e 's|//.*$||g' $file > ${LIB}/$file
1156 chmod +w
${LIB}/$file 2>/dev
/null
1157 chmod a
+r
${LIB}/$file 2>/dev
/null
1160 # Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
1161 # declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because
1162 # many other systems have similar text but correct versions of the file.
1163 # To ensure only Sun's is fixed, we grep for a likely unique string.
1165 if [ -r $file ] && egrep '/\* @\(#\)memory\.h 1\.[2-4] 8./../.. SMI; from S5R2 1\.2 \*/' $file > /dev
/null
; then
1166 if [ ! -r ${LIB}/$file ]; then
1167 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1168 chmod +w
${LIB}/$file 2>/dev
/null
1169 chmod a
+r
${LIB}/$file 2>/dev
/null
1171 if [ -r ${LIB}/$file ]; then
1172 echo Replacing
$file
1173 cat > ${LIB}/$file << EOF
1174 /* This file was generated by fixincludes */
1175 #ifndef __memory_h__
1176 #define __memory_h__
1179 extern void *memccpy();
1180 extern void *memchr();
1181 extern void *memcpy();
1182 extern void *memset();
1184 extern char *memccpy();
1185 extern char *memchr();
1186 extern char *memcpy();
1187 extern char *memset();
1188 #endif /* __STDC__ */
1190 extern int memcmp();
1192 #endif /* __memory_h__ */
1197 # parameters not const on DECstation Ultrix V4.0 and OSF/1.
1199 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1200 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1201 chmod +w
${LIB}/$file 2>/dev
/null
1202 chmod a
+r
${LIB}/$file 2>/dev
/null
1205 if [ -r ${LIB}/$file ]; then
1206 echo Fixing
$file, non-const arg
1207 sed -e 's@perror( char \*__s );@perror( const char *__s );@' \
1208 -e 's@fputs( char \*__s,@fputs( const char *__s,@' \
1209 -e 's@fopen( char \*__filename, char \*__type );@fopen( const char *__filename, const char *__type );@' \
1210 -e 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@' \
1211 -e 's@fscanf( FILE \*__stream, char \*__format,@fscanf( FILE *__stream, const char *__format,@' \
1212 -e 's@scanf( char \*__format,@scanf( const char *__format,@' \
1213 -e 's@sscanf( char \*__s, char \*__format,@sscanf( const char *__s, const char *__format,@' \
1214 -e 's@popen(char \*, char \*);@popen(const char *, const char *);@' \
1215 -e 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@' \
1216 ${LIB}/$file > ${LIB}/${file}.
sed
1217 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1218 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1221 # Find any include directives that use "file".
1222 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1223 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1224 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1229 # parameters conflict with C++ new on rs/6000
1230 for file in stdio.h unistd.h
; do
1231 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1232 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1233 chmod +w
${LIB}/$file 2>/dev
/null
1236 if [ -r ${LIB}/$file ]; then
1237 echo Fixing
$file, parameter name conflicts
1238 sed -e 's@rename(const char \*old, const char \*new)@rename(const char *_old, const char *_new)@' \
1239 ${LIB}/$file > ${LIB}/${file}.
sed
1240 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1241 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1244 # Find any include directives that use "file".
1245 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1246 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1247 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1253 # function class(double x) conflicts with C++ keyword on rs/6000
1255 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1256 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1257 chmod +w
${LIB}/$file 2>/dev
/null
1258 chmod a
+r
${LIB}/$file 2>/dev
/null
1261 if [ -r ${LIB}/$file ]; then
1262 if grep 'class[(]' ${LIB}/$file >/dev
/null
; then
1264 sed -e '/class[(]/i\
1269 ' ${LIB}/$file > ${LIB}/${file}.
sed
1270 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1271 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1274 # Find any include directives that use "file".
1275 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1276 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1277 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1283 # Wrong fchmod prototype on RS/6000.
1285 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1286 mkdir
${LIB}/sys
2>/dev
/null
1287 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1288 chmod +w
${LIB}/$file 2>/dev
/null
1289 chmod a
+r
${LIB}/$file 2>/dev
/null
1292 if [ -r ${LIB}/$file ]; then
1293 echo Fixing
$file, fchmod prototype
1294 sed -e 's/fchmod(char \*/fchmod(int/' \
1295 ${LIB}/$file > ${LIB}/$file.
sed
1296 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1297 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1300 # Find any include directives that use "file".
1301 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1302 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1303 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1308 # There are several name conflicts with C++ reserved words in X11
1309 # header files. These are fixed in some versions, so don't do the
1310 # fixes if we find __cplusplus in the file. These were found on the
1313 # class in X11/ShellP.h
1315 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1316 mkdir
${LIB}/sys
2>/dev
/null
1317 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1318 chmod +w
${LIB}/$file 2>/dev
/null
1319 chmod a
+r
${LIB}/$file 2>/dev
/null
1322 if [ -r ${LIB}/$file ]; then
1323 if grep __cplusplus
${LIB}/$file >/dev
/null
2>/dev
/null
; then
1326 echo Fixing
$file, field class
1327 sed -e '/char [*]class;/i\
1332 -e '/char [*]class;/a\
1334 ' ${LIB}/$file > ${LIB}/${file}.
sed
1335 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1337 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1340 # Find any include directives that use "file".
1341 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1342 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1343 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1347 # new in Xm/Traversal.h
1349 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1350 mkdir
${LIB}/sys
2>/dev
/null
1351 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1352 chmod +w
${LIB}/$file 2>/dev
/null
1353 chmod a
+r
${LIB}/$file 2>/dev
/null
1356 if [ -r ${LIB}/$file ]; then
1357 if grep __cplusplus
${LIB}/$file >/dev
/null
2>/dev
/null
; then
1360 echo Fixing
$file, uses of new
1361 sed -e '/Widget old, new;/i\
1366 -e '/Widget old, new;/a\
1369 -e 's/Widget new,/Widget c_new,/g' ${LIB}/$file > ${LIB}/${file}.
sed
1370 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1372 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1375 # Find any include directives that use "file".
1376 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1377 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1378 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1382 # class in Xm/BaseClassI.h
1383 file=Xm
/BaseClassI.h
1384 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1385 mkdir
${LIB}/sys
2>/dev
/null
1386 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1387 chmod +w
${LIB}/$file 2>/dev
/null
1388 chmod a
+r
${LIB}/$file 2>/dev
/null
1391 if [ -r ${LIB}/$file ]; then
1392 if grep __cplusplus
${LIB}/$file >/dev
/null
2>/dev
/null
; then
1395 echo Fixing
$file, prototype parameter name
1396 sed -e 's/ class[)]/ c_class)/g' ${LIB}/$file > ${LIB}/${file}.
sed
1397 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1399 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1402 # Find any include directives that use "file".
1403 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1404 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1405 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1410 # NeXT 3.2 adds const prefix to some math functions. These conflict
1411 # with the built-in functions.
1413 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1414 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1415 chmod +w
${LIB}/$file 2>/dev
/null
1417 if [ -r ${LIB}/$file ]; then
1419 sed -e '/^extern.*double.*__const__.*cos(/s/__const__//' \
1420 -e '/^extern.*double.*__const__.*sin(/s/__const__//' ${LIB}/$file > ${LIB}/${file}.
sed
1421 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1422 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1425 # Find any include directives that use "file".
1426 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1427 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1428 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1433 # NeXT 3.2 uses the word "template" as a parameter for some
1434 # functions. GCC reports an invalid use of a reserved key word
1435 # with the built-in functions. NeXT 3.2 includes the keyword
1436 # volatile in the prototype for abort(). This conflicts with
1437 # the built-in definition.
1439 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1440 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1441 chmod +w
${LIB}/$file 2>/dev
/null
1443 if [ -r ${LIB}/$file ]; then
1445 sed -e '/\(.*template\)/s/template//' \
1446 -e '/extern.*volatile.*void.*abort/s/volatile//' ${LIB}/$file > ${LIB}/${file}.
sed
1447 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1448 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1451 # Find any include directives that use "file".
1452 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1453 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1454 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1459 # NeXT 3.2 includes the keyword volatile in the abort() and
1460 # exit() function prototypes. That conflicts with the
1461 # built-in functions.
1463 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1464 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1465 chmod +w
${LIB}/$file 2>/dev
/null
1467 if [ -r ${LIB}/$file ]; then
1469 sed -e '/extern.*volatile.*void.*exit/s/volatile//' \
1470 -e '/extern.*volatile.*void.*abort/s/volatile//' ${LIB}/$file > ${LIB}/${file}.
sed
1471 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1472 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1475 # Find any include directives that use "file".
1476 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1477 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1478 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1483 # NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
1484 # Note that version 3 of the NeXT system has wait.h in a different directory,
1485 # so that this code won't do anything. But wait.h in version 3 has a
1486 # conditional, so it doesn't need this fix. So everything is okay.
1488 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1489 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1490 chmod +w
${LIB}/$file 2>/dev
/null
1493 if [ -r ${LIB}/$file ] \
1494 && grep 'wait[(]union wait' ${LIB}/$file >/dev
/null
; then
1495 echo Fixing
$file, bad
wait formal
1496 sed -e 's@wait(union wait@wait(void@' ${LIB}/$file > ${LIB}/${file}.
sed
1497 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1498 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1501 # Find any include directives that use "file".
1502 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1503 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1504 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1509 # Don't use or define the name va_list in stdio.h.
1510 # This is for ANSI and also to interoperate properly with gcc's varargs.h.
1512 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1513 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1514 chmod +w
${LIB}/$file 2>/dev
/null
1515 chmod a
+r
${LIB}/$file 2>/dev
/null
1518 if [ -r ${LIB}/$file ]; then
1519 echo Fixing
$file, use of va_list
1520 # Arrange for stdio.h to use stdarg.h to define __gnuc_va_list
1521 if egrep "__need___va_list" ${LIB}/$file >/dev
/null
2>&1; then
1522 touch ${LIB}/${file}.
sed
1524 (echo "#define __need___va_list"
1525 echo "#include <stdarg.h>") > ${LIB}/${file}.
sed
1527 # Use __gnuc_va_list in arg types in place of va_list.
1528 # On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
1529 # trailing parentheses and semicolon save all other systems from this.
1530 # Define __va_list__ (something harmless and unused) instead of va_list.
1531 # Don't claim to have defined va_list.
1532 sed -e 's@ va_list @ __gnuc_va_list @' \
1533 -e 's@ va_list)@ __gnuc_va_list)@' \
1534 -e 's@ _BSD_VA_LIST_));@ __gnuc_va_list));@' \
1535 -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \
1536 -e 's@ va_list@ __va_list__@' \
1537 -e 's@\*va_list@*__va_list__@' \
1538 -e 's@ __va_list)@ __gnuc_va_list)@' \
1539 -e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \
1540 -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \
1541 -e 's@VA_LIST@DUMMY_VA_LIST@' \
1542 -e 's@_Va_LIST@_VA_LIST@' \
1543 ${LIB}/$file >> ${LIB}/${file}.
sed
1545 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1546 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1549 # Find any include directives that use "file".
1550 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1551 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1552 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1557 # Cancel out ansi_compat.h on Ultrix. Replace it with empty file.
1559 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1560 if grep -s ULTRIX
$file; then
1561 echo "/* This file intentionally left blank. */" > $LIB/$file
1565 # parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R.
1566 # also get rid of bogus inline definitions in HP-UX 8.0
1568 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1569 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1570 chmod +w
${LIB}/$file 2>/dev
/null
1571 chmod a
+r
${LIB}/$file 2>/dev
/null
1574 if [ -r ${LIB}/$file ]; then
1575 echo Fixing
$file, non-const arg
1576 sed -e 's@atof(\([ ]*char[ ]*\*[^)]*\))@atof(const \1)@' \
1577 -e 's@inline int abs(int [a-z][a-z]*) {.*}@extern "C" int abs(int);@' \
1578 -e 's@inline double abs(double [a-z][a-z]*) {.*}@@' \
1579 -e 's@inline int sqr(int [a-z][a-z]*) {.*}@@' \
1580 -e 's@inline double sqr(double [a-z][a-z]*) {.*}@@' \
1581 ${LIB}/$file > ${LIB}/${file}.
sed
1582 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1583 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1586 # Find any include directives that use "file".
1587 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1588 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1589 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1594 # fix bogus recursive stdlib.h in NEWS-OS 4.0C
1596 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1597 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1598 chmod +w
${LIB}/$file 2>/dev
/null
1599 chmod a
+r
${LIB}/$file 2>/dev
/null
1602 if [ -r ${LIB}/$file ]; then
1603 echo Fixing
$file, recursive inclusion
1604 sed -e '/^#include <stdlib.h>/i\
1607 -e '/^#include <stdlib.h>/a\
1610 ${LIB}/$file > ${LIB}/${file}.
sed
1611 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1612 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1615 # Find any include directives that use "file".
1616 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1617 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1618 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1623 # Avoid nested comments on Ultrix 4.3.
1625 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1626 mkdir
${LIB}/rpc
2>/dev
/null
1627 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1628 chmod +w
${LIB}/$file 2>/dev
/null
1629 chmod a
+r
${LIB}/$file 2>/dev
/null
1632 if [ -r ${LIB}/$file ]; then
1633 echo Fixing
$file, nested comment
1634 sed -e 's@^\( \* int protocol; \)/\*@\1*/ /*@' \
1635 ${LIB}/$file > ${LIB}/$file.
sed
1636 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1637 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1640 # Find any include directives that use "file".
1641 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1642 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1643 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1648 # This file in RISC/os uses /**/ to concatenate two tokens.
1650 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1651 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1652 chmod +w
${LIB}/$file 2>/dev
/null
1653 chmod a
+r
${LIB}/$file 2>/dev
/null
1655 if [ -r ${LIB}/$file ]; then
1656 sed -e 's|/\*\*/|##|' ${LIB}/$file > ${LIB}/${file}.
sed
1657 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1658 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1661 # Find any include directives that use "file".
1662 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1663 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1664 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1670 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1671 mkdir
${LIB}/rpc
2>/dev
/null
1672 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1673 chmod +w
${LIB}/$file 2>/dev
/null
1674 chmod a
+r
${LIB}/$file 2>/dev
/null
1677 if [ -r ${LIB}/$file ]; then
1678 echo Fixing
$file, nested comment
1679 sed -e 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@' \
1680 ${LIB}/$file > ${LIB}/$file.
sed
1681 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1682 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1685 # Find any include directives that use "file".
1686 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1687 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1688 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1693 # In limits.h, put #ifndefs around things that are supposed to be defined
1694 # in float.h to avoid redefinition errors if float.h is included first.
1695 # On HP/UX this patch does not work, because on HP/UX limits.h uses
1696 # multi line comments and the inserted #endif winds up inside the
1697 # comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if
1698 # we find a #ifndef FLT_MIN we assume that all the required #ifndefs
1699 # are there, and we do not add them ourselves.
1700 for file in limits.h sys
/limits.h
; do
1701 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1702 mkdir
${LIB}/sys
2>/dev
/null
1703 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1704 chmod +w
${LIB}/$file 2>/dev
/null
1705 chmod a
+r
${LIB}/$file 2>/dev
/null
1708 if [ -r ${LIB}/$file ]; then
1709 if egrep 'ifndef[ ]+FLT_MIN' ${LIB}/$file >/dev
/null
; then
1713 sed -e '/[ ]FLT_MIN[ ]/i\
1716 -e '/[ ]FLT_MIN[ ]/a\
1719 -e '/[ ]FLT_MAX[ ]/i\
1722 -e '/[ ]FLT_MAX[ ]/a\
1725 -e '/[ ]FLT_DIG[ ]/i\
1728 -e '/[ ]FLT_DIG[ ]/a\
1731 -e '/[ ]DBL_MIN[ ]/i\
1734 -e '/[ ]DBL_MIN[ ]/a\
1737 -e '/[ ]DBL_MAX[ ]/i\
1740 -e '/[ ]DBL_MAX[ ]/a\
1743 -e '/[ ]DBL_DIG[ ]/i\
1746 -e '/[ ]DBL_DIG[ ]/a\
1749 ${LIB}/$file > ${LIB}/${file}.
sed
1750 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1752 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1753 echo Deleting
${LIB}/$file\
; no fixes were needed.
1756 # Find any include directives that use "file".
1757 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1758 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1759 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1765 # In math.h, put #ifndefs around things that might be defined in a gcc
1766 # specific math-*.h file.
1768 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1769 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1770 chmod +w
${LIB}/$file 2>/dev
/null
1771 chmod a
+r
${LIB}/$file 2>/dev
/null
1774 if [ -r ${LIB}/$file ]; then
1776 sed -e '/define[ ]HUGE_VAL[ ]/i\
1779 -e '/define[ ]HUGE_VAL[ ]/a\
1782 ${LIB}/$file > ${LIB}/${file}.
sed
1783 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1785 # In addition, copy the definition of DBL_MAX from float.h
1786 # if math.h requires one. The Lynx math.h requires it.
1787 if egrep '#define[ ]*HUGE_VAL[ ]+DBL_MAX' $file >/dev
/null
2>&1; then
1788 if egrep '#define[ ]+DBL_MAX[ ]+' $file >/dev
/null
2>&1; then
1791 dbl_max_def
=`egrep 'define[ ]+DBL_MAX[ ]+.*' float.h 2>/dev/null`
1792 if [ "$dbl_max_def" != "" ]; then
1793 dbl_max_def
=`echo $dbl_max_def | sed 's/.*define[ ]*DBL_MAX[ ]*//'`
1794 sed -e "/define[ ]HUGE_VAL[ ]DBL_MAX/s/DBL_MAX/$dbl_max_def/" \
1795 ${LIB}/$file > ${LIB}/${file}.
sed
1796 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1801 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1802 echo Deleting
${LIB}/$file\
; no fixes were needed.
1805 # Find any include directives that use "file".
1806 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1807 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1808 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1813 # Remove erroneous parentheses in sym.h on Alpha OSF/1.
1815 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1816 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1817 chmod +w
${LIB}/$file 2>/dev
/null
1818 chmod a
+r
${LIB}/$file 2>/dev
/null
1821 if [ -r ${LIB}/$file ]; then
1823 sed -e 's/#ifndef(__mips64)/#ifndef __mips64/' \
1824 ${LIB}/$file > ${LIB}/${file}.
sed
1825 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1826 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1829 # Find any include directives that use "file".
1830 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1831 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1832 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1837 # Correct the return type for strlen in string.h on Lynx.
1838 # Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
1839 # Add missing const for strdup on OSF/1 V3.0.
1841 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1842 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1843 chmod +w
${LIB}/$file 2>/dev
/null
1844 chmod a
+r
${LIB}/$file 2>/dev
/null
1847 if [ -r ${LIB}/$file ]; then
1849 sed -e 's/extern[ ]*int[ ]*strlen();/extern unsigned int strlen();/' \
1850 -e 's/extern[ ]*int[ ]*ffs[ ]*(long);/extern int ffs(int);/' \
1851 -e 's/strdup(char \*s1);/strdup(const char *s1);/' \
1852 ${LIB}/$file > ${LIB}/${file}.
sed
1853 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1854 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1857 # Find any include directives that use "file".
1858 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1859 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1860 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1865 # Correct the return type for strlen in strings.h in SunOS 4.
1867 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1868 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1869 chmod +w
${LIB}/$file 2>/dev
/null
1870 chmod a
+r
${LIB}/$file 2>/dev
/null
1873 if [ -r ${LIB}/$file ]; then
1875 sed -e 's/int[ ]*strlen();/__SIZE_TYPE__ strlen();/' \
1876 ${LIB}/$file > ${LIB}/${file}.
sed
1877 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1878 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1881 # Find any include directives that use "file".
1882 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1883 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1884 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1889 # Delete the '#define void int' line from curses.h on Lynx
1891 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1892 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1893 chmod +w
${LIB}/$file 2>/dev
/null
1894 chmod a
+r
${LIB}/$file 2>/dev
/null
1897 if [ -r ${LIB}/$file ]; then
1899 sed -e '/#[ ]*define[ ][ ]*void[ ]int/d' \
1900 ${LIB}/$file > ${LIB}/${file}.
sed
1901 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1902 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1905 # Find any include directives that use "file".
1906 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1907 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1908 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1913 # Fix `typedef struct term;' on hppa1.1-hp-hpux9.
1915 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1916 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1917 chmod +w
${LIB}/$file 2>/dev
/null
1918 chmod a
+r
${LIB}/$file 2>/dev
/null
1921 if [ -r ${LIB}/$file ]; then
1923 sed -e 's/^[ ]*typedef[ ][ ]*\(struct[ ][ ]*term[ ]*;[ ]*\)$/\1/' \
1924 ${LIB}/$file > ${LIB}/${file}.
sed
1925 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1926 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1929 # Find any include directives that use "file".
1930 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1931 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1932 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1937 # For C++, avoid any typedef or macro definition of bool, and use the
1938 # built in type instead.
1939 for files
in curses.h
; do
1940 if [ -r $file ] && egrep bool
$file >/dev
/null
2>&1; then
1941 if [ ! -r ${LIB}/$file ]; then
1942 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1943 chmod +w
${LIB}/$file 2>/dev
/null
1944 chmod a
+r
${LIB}/$file 2>/dev
/null
1948 sed -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/i\
1949 #ifndef __cplusplus'\
1950 -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/a\
1952 -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;[ ]*$/i\
1953 #ifndef __cplusplus'\
1954 -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;[ ]*$/a\
1956 ${LIB}/$file > ${LIB}/${file}.
sed
1957 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1958 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1961 # Find any include directives that use "file".
1962 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1963 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1964 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1970 # Fix incorrect S_IF* definitions on m88k-sysv3.
1972 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1973 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1974 chmod +w
${LIB}/$file 2>/dev
/null
1975 chmod a
+r
${LIB}/$file 2>/dev
/null
1978 if [ -r ${LIB}/$file ]; then
1980 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)/' \
1981 -e 's/^\(#define[ ]*S_IS[A-Z]*(m)\)[ ]*(m[ ]*&[ ]*\(0[0-9]*\)[ ]*)/\1 (((m)\&S_IFMT)==\2)/' \
1982 ${LIB}/$file > ${LIB}/${file}.
sed
1983 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1984 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1987 # Find any include directives that use "file".
1988 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1989 dir
=`echo $file | sed -e s'|/[^/]*$||'`
1990 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
1995 # Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
1996 for file in stdio.h stdlib.h
; do
1997 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1998 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1999 chmod +w
${LIB}/$file 2>/dev
/null
2000 chmod a
+r
${LIB}/$file 2>/dev
/null
2003 if [ -r ${LIB}/$file ]; then
2004 echo Fixing
$file, getopt declaration
2005 sed -e 's/getopt(int, char \*\[\],[ ]*char \*)/getopt(int, char *const[], const char *)/' \
2006 ${LIB}/$file > ${LIB}/${file}.
sed
2007 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2008 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2011 # Find any include directives that use "file".
2012 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2013 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2014 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2020 # Determine if we're on Interactive Unix 2.2 or later, in which case we
2021 # need to fix some additional files. This is the same test for ISC that
2023 if test -d /etc
/conf
/kconfig.d \
2024 && grep _POSIX_VERSION
/usr
/include
/sys
/unistd.h
>/dev
/null
2>&1; then
2025 echo "Fixing ISC __STDC__ goof in several files..."
2026 for name
in stdio.h math.h ctype.h sys
/limits.h sys
/fcntl.h sys
/dirent.h
; do
2028 if test -r ${LIB}/$name; then
2033 # On Interactive 2.2, certain traditional Unix definitions
2034 # (notably getc and putc in stdio.h) are omitted if __STDC__ is
2035 # defined, not just if _POSIX_SOURCE is defined. This makes it
2036 # impossible to compile any nontrivial program except with -posix.
2038 's/!defined(__STDC__) && !defined(_POSIX_SOURCE)/!defined(_POSIX_SOURCE)/' \
2039 < $file > ${LIB}/$name.
2040 mv ${LIB}/$name.
${LIB}/$name
2043 echo "Fixing ISC fmod declaration"
2044 # This one's already been fixed for other things.
2046 sed 's/fmod(double)/fmod(double, double)/' <$file >$file.
2049 echo "Fixing nested comments in ISC <sys/limits.h>"
2051 sed '/CHILD_MAX/s,/\* Max, Max,' < ${INPUT}/$file >${LIB}/$file.
2052 sed '/OPEN_MAX/s,/\* Max, Max,' < ${LIB}/$file.
>${LIB}/$file
2055 # These files in Sun OS 4.x use /**/ to concatenate tokens.
2056 for file in sparc
/asm_linkage.h sun
3/asm_linkage.h sun3x
/asm_linkage.h \
2057 sun
4/asm_linkage.h sun4c
/asm_linkage.h sun4m
/asm_linkage.h \
2058 sun4c
/debug
/asm_linkage.h sun4m
/debug
/asm_linkage.h
;
2060 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2061 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2062 chmod +w
${LIB}/$file 2>/dev
/null
2063 chmod a
+r
${LIB}/$file 2>/dev
/null
2066 if [ -r ${LIB}/$file ]; then
2067 sed -e 's|/\*\*/|##|g' ${LIB}/$file > ${LIB}/${file}.
sed
2068 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2069 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2072 # Find any include directives that use "file".
2073 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2074 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2075 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2081 # These files in ARM/RISCiX use /**/ to concatenate tokens.
2082 for file in arm
/as_support.h
arm
/mc_type.h
arm
/xcb.h dev
/chardefmac.h \
2083 dev
/ps_irq.h dev
/screen.h dev
/scsi.h sys
/tty.h Xm.acorn
/XmP.h
2085 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2086 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2087 chmod +w
${LIB}/$file 2>/dev
/null
2088 chmod a
+r
${LIB}/$file 2>/dev
/null
2091 if [ -r ${LIB}/$file ]; then
2092 sed -e 's|/\*\*/|##|g' ${LIB}/$file > ${LIB}/${file}.
sed
2093 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2094 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2097 # Find any include directives that use "file".
2098 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2099 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2100 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2106 # math.h on SunOS 4 puts the declaration of matherr before the definition
2107 # of struct exception, so the prototype (added by fixproto) causes havoc.
2109 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2110 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2111 chmod +w
${LIB}/$file 2>/dev
/null
2112 chmod a
+r
${LIB}/$file 2>/dev
/null
2115 if [ -r ${LIB}/$file ]; then
2116 echo Fixing
$file, matherr declaration
2117 sed -e '/^struct exception/,$b' \
2121 ${LIB}/$file > ${LIB}/${file}.
sed
2122 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2123 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2126 # Find any include directives that use "file".
2127 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2128 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2129 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2134 # assert.h on HP/UX is not C++ ready, even though NO_IMPLICIT_EXTERN_C
2135 # is defined on HP/UX.
2137 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2138 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2139 chmod +w
${LIB}/$file 2>/dev
/null
2140 chmod a
+r
${LIB}/$file 2>/dev
/null
2143 if [ -r ${LIB}/$file ]; then
2144 if egrep '"C"' ${LIB}/$file >/dev
/null
2>&1 \
2145 ||
egrep '__BEGIN_DECLS' ${LIB}/$file >/dev
/null
2>&1; then
2149 echo '#ifdef __cplusplus
2151 #endif' > ${LIB}/${file}.
sed
2152 cat ${LIB}/${file} >> ${LIB}/${file}.
sed
2153 echo '#ifdef __cplusplus
2155 #endif' >> ${LIB}/${file}.
sed
2156 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2157 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2160 # Find any include directives that use "file".
2161 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2162 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2163 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2169 # check for broken assert.h that needs stdio.h or stdlib.h
2171 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2172 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2173 chmod +w
${LIB}/$file 2>/dev
/null
2174 chmod a
+r
${LIB}/$file 2>/dev
/null
2177 if [ -r ${LIB}/$file ]; then
2178 if grep 'stderr' ${LIB}/$file >/dev
/null
2>/dev
/null
; then
2179 if grep 'include.*stdio.h' ${LIB}/$file >/dev
/null
2>/dev
/null
; then
2182 echo "Fixing $file (needs stdio.h)"
2183 echo '#ifdef __cplusplus
2185 #endif' >>${LIB}/$file
2188 if grep 'exit *(' ${LIB}/$file >/dev
/null
2>/dev
/null ||
2189 grep 'abort *(' ${LIB}/$file >/dev
/null
2>/dev
/null
; then
2190 if grep 'include.*stdlib.h' ${LIB}/$file >/dev
/null
2>/dev
/null
; then
2193 echo "Fixing $file (needs stdlib.h)"
2194 echo '#ifdef __cplusplus
2196 #endif' >>${LIB}/$file
2199 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2202 # Find any include directives that use "file".
2203 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2204 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2205 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2210 # Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
2212 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2213 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2214 chmod +w
${LIB}/$file 2>/dev
/null
2215 chmod a
+r
${LIB}/$file 2>/dev
/null
2218 if [ -r ${LIB}/$file ]; then
2219 echo Fixing
$file, sbrk declaration
2220 sed -e 's/char\([ ]*\*[ ]*sbrk[ ]*(\)/void\1/' \
2221 ${LIB}/$file > ${LIB}/${file}.
sed
2222 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2223 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2226 # Find any include directives that use "file".
2227 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2228 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2229 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2234 # This file on SunOS 4 has a very large macro. When the sed loop
2235 # tries pull it in, it overflows the pattern space size of the SunOS
2236 # sed (GNU sed does not have this problem). Since the file does not
2237 # require fixing, we remove it from the fixed directory.
2238 file=sundev
/ipi_error.h
2239 if [ -r ${LIB}/$file ]; then
2240 echo "Removing incorrect fix to SunOS <sundev/ipi_error.h>"
2244 # Put cpp wrappers around these include files to avoid redeclaration
2245 # errors during multiple inclusion on m88k-tektronix-sysv3.
2246 for file in time.h sys
/time.h
; do
2247 if egrep '#ifndef' $file >/dev
/null
2>&1; then
2250 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2251 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2252 chmod +w
${LIB}/$file 2>/dev
/null
2254 if [ -r ${LIB}/$file ]; then
2255 echo Fixing
$file, to protect against multiple inclusion.
2256 cpp_wrapper
=`echo $file | sed -e 's,\.,_,g' -e 's,/,_,g'`
2257 (echo "#ifndef __GCC_GOT_${cpp_wrapper}_"
2258 echo "#define __GCC_GOT_${cpp_wrapper}_"
2260 echo '#endif /* !_GCC_GOT_'${cpp_wrapper}_' */') > ${LIB}/${file}.new
2261 rm -f ${LIB}/$file; mv ${LIB}/${file}.new ${LIB}/$file
2266 # Fix fcntl prototype in fcntl.h on LynxOS.
2268 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2269 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2270 chmod +w
${LIB}/$file 2>/dev
/null
2271 chmod a
+r
${LIB}/$file 2>/dev
/null
2274 if [ -r ${LIB}/$file ]; then
2275 echo Fixing
$file, fcntl declaration
2276 sed -e 's/\(fcntl.*(int, int, \)int)/\1...)/' \
2277 ${LIB}/$file > ${LIB}/${file}.
sed
2278 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2279 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2282 # Find any include directives that use "file".
2283 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2284 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2285 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2290 # Fix definitions of macros used by va-i960.h in VxWorks header file.
2291 file=arch
/i960
/archI960.h
2292 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2293 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2294 chmod +w
${LIB}/$file 2>/dev
/null
2295 chmod a
+r
${LIB}/$file 2>/dev
/null
2298 if [ -r ${LIB}/$file ]; then
2300 sed -e 's/__vsiz/__vxvsiz/' -e 's/__vali/__vxvali/' \
2301 -e s
'/__vpad/__vxvpad/' -e 's/__alignof__/__vxalignof__/' \
2302 ${LIB}/$file > ${LIB}/${file}.
sed
2303 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2304 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2307 # Find any include directives that use "file".
2308 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2309 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2310 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2315 # Make VxWorks header which is almost gcc ready fully gcc ready.
2316 file=types
/vxTypesBase.h
2317 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2318 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2319 chmod +w
${LIB}/$file 2>/dev
/null
2320 chmod a
+r
${LIB}/$file 2>/dev
/null
2323 if [ -r ${LIB}/$file ]; then
2325 sed -e 's/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/#if 1/' \
2327 #ifndef _GCC_SIZE_T\
2333 -e '/[ ]ptrdiff_t/i\
2334 #ifndef _GCC_PTRDIFF_T\
2335 #define _GCC_PTRDIFF_T
2337 -e '/[ ]ptrdiff_t/a\
2341 #ifndef _GCC_WCHAR_T\
2342 #define _GCC_WCHAR_T
2347 ${LIB}/$file > ${LIB}/${file}.
sed
2348 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2349 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2352 # Find any include directives that use "file".
2353 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2354 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2355 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2360 # Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
2362 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2363 mkdir
${LIB}/sys
2>/dev
/null
2364 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2365 chmod +w
${LIB}/$file 2>/dev
/null
2366 chmod a
+r
${LIB}/$file 2>/dev
/null
2369 if [ -r ${LIB}/$file ]; then
2370 if egrep '#include' ${LIB}/$file >/dev
/null
2>&1; then
2373 if egrep 'ULONG' ${LIB}/$file >/dev
/null
2>&1 \
2374 && [ -r types
/vxTypesOld.h
]; then
2376 sed -e '/#define[ ][ ]*__INCstath/a\
2377 #include <types/vxTypesOld.h>
2379 ${LIB}/$file > ${LIB}/${file}.
sed
2380 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2383 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2386 # Find any include directives that use "file".
2387 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2388 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2389 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2394 # Fix VxWorks <time.h> to not require including <vxTypes.h>.
2396 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2397 mkdir
${LIB}/sys
2>/dev
/null
2398 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
2399 chmod +w
${LIB}/$file 2>/dev
/null
2400 chmod a
+r
${LIB}/$file 2>/dev
/null
2403 if [ -r ${LIB}/$file ]; then
2404 if egrep 'uint_t[ ][ ]*_clocks_per_sec' ${LIB}/$file >/dev
/null
2>&1; then
2406 sed -e 's/uint_t/unsigned int/' ${LIB}/$file > ${LIB}/${file}.
sed
2407 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
2409 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
2412 # Find any include directives that use "file".
2413 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2414 dir
=`echo $file | sed -e s'|/[^/]*$||'`
2415 required
="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
2421 # This loop does not appear to do anything, because it uses file
2422 # rather than $file when setting target. It also appears to be
2423 # unnecessary, since the main loop processes symbolic links.
2425 # echo 'Making internal symbolic non-directory links'
2427 # files=`find . -type l -print`
2428 # for file in $files; do
2429 # dest=`ls -ld $file | sed -n 's/.*-> //p'`
2430 # if expr "$dest" : '[^/].*' > /dev/null; then
2431 # target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
2432 # if [ -f $target ]; then
2433 # ln -s $dest ${LIB}/$file >/dev/null 2>&1
2439 # Make sure that any include files referenced using double quotes
2440 # exist in the fixed directory. This comes last since otherwise
2441 # we might end up deleting some of these files "because they don't
2445 while [ $# != 0 ]; do
2447 while [ $# != 0 ]; do
2448 # $1 is the directory to copy from, $2 is the unfixed file,
2449 # $3 is the fixed file name.
2452 if [ -r $2 ] && [ ! -r $3 ]; then
2453 cp $2 $3 >/dev
/null
2>&1 ||
echo "Can't copy $2"
2454 chmod +w
$3 2>/dev
/null
2455 chmod a
+r
$3 2>/dev
/null
2457 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2458 dir
=`echo $2 | sed -e s'|/[^/]*$||'`
2459 dir2
=`echo $3 | sed -e s'|/[^/]*$||'`
2460 newreq
="$newreq $1 $dir/$include $dir2/$include"
2469 echo 'Cleaning up DONE files.'
2471 find .
-name DONE
-exec rm -f '{}' ';'
2473 echo 'Removing unneeded directories:'
2475 files
=`find . -type d -print | sort -r`
2476 for file in $files; do
2477 rmdir $LIB/$file > /dev
/null
2>&1