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.
9 GCCCMD
=${4-${GCCCMD-gcc}}
11 # Directory where gcc sources (and sometimes special include files) live.
12 # fixincludes doesn't use this, but fixinc.svr4 does, and I want to make
13 # sure somebody doesn't try to use arg3 for something incompatible. -- gumby
14 SRCDIR
=${3-${SRCDIR-.}}
16 # Directory containing the original header files.
17 # (This was named INCLUDES, but that conflicts with a name in Makefile.in.)
18 INPUT
=${2-${INPUT-/usr/include}}
20 # Directory in which to store the results.
21 LIB
=${1?"fixincludes: output directory not specified"}
23 # Define PWDCMD as a command to use to get the working dir
24 # in the form that we want.
28 # On an Apollo, discard everything before `/usr'.
29 PWDCMD
="eval pwd | sed -e 's,.*/usr/,/usr/,'"
36 # Make sure it exists.
37 if [ ! -d $LIB ]; then
41 # Make LIB absolute only if needed to avoid problems with the amd.
46 cd $LIB; LIB
=`${PWDCMD}`
50 # Make SRCDIR absolute only if needed to avoid problems with the amd.
56 cd $SRCDIR; SRCDIR
=`${PWDCMD}`
60 # Fail if no arg to specify a directory for the output.
62 then echo fixincludes
: no output directory specified
66 echo Building fixed headers
in ${LIB}
68 # Determine whether this system has symbolic links.
69 if ln -s X
$LIB/ShouldNotExist
2>/dev
/null
; then
70 rm -f $LIB/ShouldNotExist
72 elif ln -s X
/tmp
/ShouldNotExist
2>/dev
/null
; then
73 rm -f /tmp
/ShouldNotExist
79 echo Finding directories and links to directories
81 # Find all directories and all symlinks that point to directories.
82 # Put the list in $files.
83 # Each time we find a symlink, add it to newdirs
84 # so that we do another find within the dir the link points to.
85 # Note that $files may have duplicates in it;
86 # later parts of this file are supposed to ignore them.
89 while [ -n "$dirs" ] && [ $levels -gt 0 ]
91 levels
=`expr $levels - 1`
95 echo " Searching $INPUT/$d"
101 # Find all directories under $d, relative to $d, excluding $d itself.
102 files
="$files `find $d -type d -print | \
103 sed -e '/\/\.$/d' -e '/^\.$/d'`"
104 # Find all links to directories.
105 # Using `-exec test -d' in find fails on some systems,
106 # and trying to run test via sh fails on others,
107 # so this is the simplest alternative left.
108 # First find all the links, then test each one.
111 theselinks
=`find $d -type l -print`
112 for d1
in $theselinks --dummy--
114 # If the link points to a directory,
115 # add that dir to $newdirs
118 newdirs
="$newdirs $d1"
123 files
="$files $newdirs"
128 echo "All directories (including links to directories):"
131 for file in $files; do
133 if [ ! -d $LIB/$file ]
134 then mkdir
$LIB/$file
139 # treetops gets an alternating list
140 # of old directories to copy
141 # and the new directories to copy to.
142 treetops
="${INPUT} ${LIB}"
145 echo 'Making symbolic directory links'
146 for file in $files; do
147 dest
=`ls -ld $file | sed -n 's/.*-> //p'`
150 # In case $dest is relative, get to $file's dir first.
152 cd `echo ./$file | sed -n 's&[^/]*$&&p'`
153 # Check that the target directory exists.
154 # Redirections changed to avoid bug in sh on Ultrix.
155 (cd $dest) > /dev
/null
2>&1
158 # X gets the dir that the link actually leads to.
160 # If a link points to ., make a similar link to .
161 if [ $x = $INPUT ]; then
162 echo $file '->' .
': Making link'
163 rm -fr ${LIB}/$file > /dev
/null
2>&1
164 ln -s .
${LIB}/$file > /dev
/null
2>&1
165 # If link leads back into ${INPUT},
166 # make a similar link here.
167 elif expr $x : "${INPUT}/.*" > /dev
/null
; then
168 # Y gets the actual target dir name, relative to ${INPUT}.
169 y
=`echo $x | sed -n "s&${INPUT}/&&p"`
170 # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
172 sed -e 's@^./@@' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
173 echo $file '->' $dots$y ': Making link'
174 rm -fr ${LIB}/$file > /dev
/null
2>&1
175 ln -s $dots$y ${LIB}/$file > /dev
/null
2>&1
177 # If the link is to a dir $target outside ${INPUT},
178 # repoint the link at ${INPUT}/root$target
179 # and process $target into ${INPUT}/root$target
180 # treat this directory as if it actually contained the files.
181 echo $file '->' root
$x ': Making link'
182 if [ -d $LIB/root
$x ]
188 while [ x
$dirname != x
]; do
189 component
=`echo $dirname | sed -e 's|/.*$||'`
190 mkdir
$component >/dev
/null
2>&1
192 dirmade
=$dirmade/$component
193 dirname=`echo $dirname | sed -e 's|[^/]*/||'`
196 # Duplicate directory structure created in ${LIB}/$file in new
198 for file2
in $files; do
201 dupdir
=${LIB}/root
$x/`echo $file2 | sed -n "s|^${file}/||p"`
202 echo "Duplicating ${file}'s ${dupdir}"
213 # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
215 sed -e 's@^./@@' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
216 rm -fr ${LIB}/$file > /dev
/null
2>&1
217 ln -s ${dots}root
$x ${LIB}/$file > /dev
/null
2>&1
218 treetops
="$treetops $x ${LIB}/root$x"
229 while [ $# != 0 ]; do
230 # $1 is an old directory to copy, and $2 is the new directory to copy to.
233 # The same dir can appear more than once in treetops.
234 # There's no need to scan it more than once.
240 echo Fixing directory
$1 into
$2
241 # Check .h files which are symlinks as well as those which are files.
242 # A link to a header file will not be processed by anything but this.
244 files
=`find . -name '*.h' \( -type f -o -type l \) -print`
246 files
=`find . -name '*.h' -type f -print`
248 echo Checking header files
250 # Note that BSD43_* are used on recent MIPS systems.
251 for file in $files; do
252 # This call to egrep is essential, since checking a file with egrep
253 # is much faster than actually trying to fix it.
254 # It is also essential that most files *not* match!
255 # Thus, matching every #endif is unacceptable.
256 # But the argument to egrep must be kept small, or many versions of egrep
257 # won't be able to handle it.
259 # We use the pattern [!-.0-~] instead of [^/ ] to match a noncomment
260 # following #else or #endif because some buggy egreps think [^/] matches
261 # newline, and they thus think `#else ' matches `#e[ndiflse]*[ ]+[^/ ]'.
263 # We use the pattern [^a-zA-Z0-9_][_a-ce-km-z][a-z0-9] to match an identifier
264 # following #if or #elif that is not surrounded by __. The `a-ce-km-z'
265 # in this pattern lacks `d' and `l'; this means we don't worry about
266 # identifiers starting with `d' or `l'. This is OK, since none of the
267 # identifiers below start with `d' or `l'. It also greatly improves
268 # performance, since many files contain lines of the form `#if ... defined ...'
270 if egrep '//|[ _]_IO|CTRL|^#define.NULL|^#e[nl][ds][ief]*[ ]+[!-.0-~]|^#[el]*if.*[^a-zA-Z0-9_][_a-ce-km-z][a-z0-9]' $file >/dev
/null
; then
271 if [ -r $file ]; then
272 cp $file $2/$file >/dev
/null
2>&1 \
273 ||
echo "Can't copy $file"
276 # Here is how the sed commands in braces work.
277 # (It doesn't work to put the comments inside the sed commands.)
278 # Surround each word with spaces, to simplify matching below.
279 # ANSIfy each pre-ANSI machine-dependent symbol
280 # by surrounding it with __ __.
281 # Remove the spaces that we inserted around each word.
286 s%^\([ ]*#[ ]*else\)[ ]*/[^*].*%\1%
287 s%^\([ ]*#[ ]*else\)[ ]*[^/ ].*%\1%
288 s%^\([ ]*#[ ]*endif\)[ ]*/[^*].*%\1%
289 s%^\([ ]*#[ ]*endif\)[ ]*\*[^/].*%\1%
290 s%^\([ ]*#[ ]*endif\)[ ]*[^/* ].*%\1%
291 /\/\/[^*]/ s|//\(.*\)$|/*\1*/|
292 /[ ]_IO[A-Z]*[ ]*(/ s/\(_IO[A-Z]*[ ]*(\)\(.\),/\1'\''\2'\'',/
293 /[ ]BSD43__IO[A-Z]*[ ]*(/ s/(\(.\),/('\''\1'\'',/
294 /#define._IO/ s/'\''\([cgxt]\)'\''/\1/g
295 /#define.BSD43__IO/ s/'\''\([cgx]\)'\''/\1/g
296 /[^A-Z0-9_]CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/
297 /[^A-Z0-9]_CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/
298 /#define[ ]*[ ]CTRL/ s/'\''\([cgx]\)'\''/\1/g
299 /#define[ ]*[ ]_CTRL/ s/'\''\([cgx]\)'\''/\1/g
300 /#define.BSD43_CTRL/ s/'\''\([cgx]\)'\''/\1/g
302 s/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g
304 s/ bsd4\([0-9]\) / __bsd4\1__ /g
305 s/ _*i386 / __i386__ /g
306 s/ is68k / __is68k__ /g
307 s/ m68k / __m68k__ /g
308 s/ mc680\([0-9]\)0 / __mc680\10__ /g
309 s/ news\([0-9]*\) / __news\1__ /g
310 s/ ns32000 / __ns32000__ /g
312 s/ sony_news / __sony_news__ /g
313 s/ sparc / __sparc__ /g
314 s/ sun\([a-z0-9]*\) / __sun\1__ /g
315 s/ unix / __unix__ /g
318 s/ \([a-zA-Z0-9_][a-zA-Z0-9_]*\) /\1/g
320 /^#define.NULL[ ]/ i\
322 ' $2/$file > $2/$file.
323 mv $2/$file.
$2/$file
324 if cmp $file $2/$file >/dev
/null
2>&1; then
328 # Find any include directives that use "file".
329 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $2/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
330 dir
=`echo $file | sed -e s'|/[^/]*$||'`
331 required
="$required $1 $dir/$include $2/$dir/$include"
340 # Make sure that any include files referenced using double quotes
341 # exist in the fixed directory.
344 while [ $# != 0 ]; do
345 # $1 is the directory to copy from, $2 is the unfixed file,
346 # $3 is the fixed file name.
349 if [ -r $2 ] && [ ! -r $3 ]; then
350 cp $2 $3 >/dev
/null
2>&1 ||
echo "Can't copy $2"
351 chmod +w
$3 2>/dev
/null
352 chmod a
+r
$3 2>/dev
/null
360 # Install the proper definition of size_t in header files that it comes from.
361 for file in sys
/types.h stdlib.h sys
/stdtypes.h
; do
362 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
363 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
364 chmod +w
${LIB}/$file 2>/dev
/null
365 chmod a
+r
${LIB}/$file 2>/dev
/null
368 if [ -r ${LIB}/$file ]; then
369 echo Fixing
$file comment
370 # Get the definition of __SIZE_TYPE__, if any.
371 # (This file must be called something.c).
372 echo "__SIZE_TYPE__" > ${LIB}/types.c
373 foo
=`${GCCCMD} -E -P ${LIB}/types.c`
375 # Default to our preferred type.
376 if [ "$foo" = __SIZE_TYPE__
]; then foo
="unsigned long int"; fi
377 sed -e "s/typedef[ a-z_]*[ ]size_t/typedef $foo size_t/" ${LIB}/$file > ${LIB}/${file}.
sed
378 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
379 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
385 # Fix one other error in this file: a mismatched quote not inside a C comment.
386 file=sundev
/vuid_event.h
387 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
388 mkdir
${LIB}/sundev
2>/dev
/null
389 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
390 chmod +w
${LIB}/$file 2>/dev
/null
391 chmod a
+r
${LIB}/$file 2>/dev
/null
394 if [ -r ${LIB}/$file ]; then
395 echo Fixing
$file comment
396 sed -e "s/doesn't/does not/" ${LIB}/$file > ${LIB}/${file}.
sed
397 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
398 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
403 # Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
404 file=sunwindow
/win_cursor.h
405 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
406 # mkdir ${LIB}/sunwindow 2>/dev/null
407 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
408 chmod +w
${LIB}/$file 2>/dev
/null
410 if [ -r ${LIB}/$file ]; then
412 sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.
sed
413 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
414 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
418 file=sunwindow
/win_lock.h
419 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
420 # mkdir ${LIB}/sunwindow 2>/dev/null
421 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
422 chmod +w
${LIB}/$file 2>/dev
/null
424 if [ -r ${LIB}/$file ]; then
426 sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.
sed
427 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
428 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
433 # Fix this Sun file to avoid interfering with stddef.h.
435 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
436 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
437 chmod +w
${LIB}/$file 2>/dev
/null
438 chmod a
+r
${LIB}/$file 2>/dev
/null
441 if [ -r ${LIB}/$file ]; then
443 sed -e '/[ ]size_t.*;/i\
445 #define _GCC_SIZE_T' \
448 -e '/[ ]ptrdiff_t.*;/i\
449 #ifndef _GCC_PTRDIFF_T\
450 #define _GCC_PTRDIFF_T' \
451 -e '/[ ]ptrdiff_t.*;/a\
453 -e '/[ ]wchar_t.*;/i\
454 #ifndef _GCC_WCHAR_T\
455 #define _GCC_WCHAR_T' \
456 -e '/[ ]wchar_t.*;/a\
457 #endif' ${LIB}/$file > ${LIB}/${file}.
sed
458 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
459 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
464 # Fix this ARM/RISCiX file to avoid interfering with the use of __wchar_t
467 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
468 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
469 chmod +w
${LIB}/$file 2>/dev
/null
470 chmod a
+r
${LIB}/$file 2>/dev
/null
473 if [ -r ${LIB}/$file ]; then
475 sed -e "s/\(#[ ]*ifndef[ ]*\)__wchar_t/\1_GCC_WCHAR_T/" \
476 -e "s/\(#[ ]*define[ ]*\)__wchar_t/\1_GCC_WCHAR_T/" \
477 ${LIB}/$file > ${LIB}/${file}.
sed
478 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
479 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
484 # Fix this file to avoid interfering with stddef.h, but don't mistakenly
485 # match e.g. ssize_t present in AIX for the ps/2.
487 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
488 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
489 chmod +w
${LIB}/$file 2>/dev
/null
490 chmod a
+r
${LIB}/$file 2>/dev
/null
493 if [ -r ${LIB}/$file ]; then
495 sed -e '/[ ]size_t.*;/i\
497 #define _GCC_SIZE_T' \
499 #endif' ${LIB}/$file > ${LIB}/${file}.
sed
500 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
501 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
506 # Fix HP's use of ../machine/inline.h to refer to
507 # /usr/include/machine/inline.h
509 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
510 cp $file ${LIB}/$file
512 if [ -r ${LIB}/$file ] ; then
514 sed -e 's,"../machine/inline.h",<machine/inline.h>,' \
515 -e 's,"../machine/psl.h",<machine/psl.h>,' \
516 ${LIB}/$file > ${LIB}/${file}.
sed
517 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
518 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
523 # Fix an error in this file: the #if says _cplusplus, not the double
524 # underscore __cplusplus that it should be
526 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
527 mkdir
${LIB}/rpcsvc
2>/dev
/null
528 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
529 chmod +w
${LIB}/$file 2>/dev
/null
530 chmod a
+r
${LIB}/$file 2>/dev
/null
533 if [ -r ${LIB}/$file ]; then
534 echo Fixing
$file, __cplusplus macro
535 sed -e 's/[ ]_cplusplus/ __cplusplus/' ${LIB}/$file > ${LIB}/${file}.
sed
536 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
537 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
542 # Fix an error in this file: a missing semi-colon at the end of the statsswtch
543 # structure definition.
545 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
546 mkdir
${LIB}/rpcsvc
2>/dev
/null
547 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
548 chmod +w
${LIB}/$file 2>/dev
/null
549 chmod a
+r
${LIB}/$file 2>/dev
/null
552 if [ -r ${LIB}/$file ]; then
553 echo Fixing
$file, definition of statsswtch
554 sed -e 's/boottime$/boottime;/' ${LIB}/$file > ${LIB}/${file}.
sed
555 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
556 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
561 # Fix an error in this file: a missing semi-colon at the end of the nodeent
562 # structure definition.
563 file=netdnet
/dnetdb.h
564 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
565 mkdir
${LIB}/netdnet
2>/dev
/null
566 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
567 chmod +w
${LIB}/$file 2>/dev
/null
568 chmod a
+r
${LIB}/$file 2>/dev
/null
571 if [ -r ${LIB}/$file ]; then
572 echo Fixing
$file, definition of nodeent
573 sed -e 's/char.*na_addr *$/char *na_addr;/' ${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
580 # Check for bad #ifdef line (in Ultrix 4.1)
582 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
583 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
584 chmod +w
${LIB}/$file 2>/dev
/null
585 chmod a
+r
${LIB}/$file 2>/dev
/null
588 if [ -r ${LIB}/$file ]; then
589 echo Fixing
$file, bad \
#ifdef line
590 sed -e 's/#ifdef KERNEL/#if defined(KERNEL)/' ${LIB}/$file > ${LIB}/${file}.
sed
591 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
592 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
597 # Check for superfluous `static' (in Ultrix 4.2)
599 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
600 mkdir
${LIB}/machine
2>/dev
/null
601 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
602 chmod +w
${LIB}/$file 2>/dev
/null
603 chmod a
+r
${LIB}/$file 2>/dev
/null
606 if [ -r ${LIB}/$file ]; then
607 echo Fixing
$file, superfluous static
608 sed -e 's/^static struct tlb_pid_state/struct tlb_pid_state/' ${LIB}/$file > ${LIB}/${file}.
sed
609 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
610 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
613 # This file has an alternative name, mips/cpu.h. Fix that name, too.
614 if cmp machine
/cpu.h mips
/cpu.h
> /dev
/null
2>&1; then
615 mkdir
${LIB}/mips
2>&-
616 ln ${LIB}/$file ${LIB}/mips
/cpu.h
621 # Incorrect sprintf declaration in X11/Xmu.h
623 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
624 mkdir
${LIB}/X11
2>/dev
/null
625 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
626 chmod +w
${LIB}/$file 2>/dev
/null
627 chmod a
+r
${LIB}/$file 2>/dev
/null
630 if [ -r ${LIB}/$file ]; then
631 echo Fixing
$file sprintf declaration
632 sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
633 extern char * sprintf();\
634 #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.
sed
635 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
636 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
641 # Incorrect sprintf declaration in X11/Xmu/Xmu.h
642 # (It's not clear whether the right file name is this or X11/Xmu.h.)
644 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
645 mkdir
${LIB}/X11
/Xmu
2>/dev
/null
646 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
647 chmod +w
${LIB}/$file 2>/dev
/null
648 chmod a
+r
${LIB}/$file 2>/dev
/null
651 if [ -r ${LIB}/$file ]; then
652 echo Fixing
$file sprintf declaration
653 sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
654 extern char * sprintf();\
655 #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.
sed
656 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
657 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
662 # Check for missing ';' in struct
664 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
665 mkdir
${LIB}/netinet
2>/dev
/null
666 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
667 chmod +w
${LIB}/$file 2>/dev
/null
668 chmod a
+r
${LIB}/$file 2>/dev
/null
671 if [ -r ${LIB}/$file ]; then
673 sed -e '/^struct/,/^};/s/}$/};/' ${LIB}/$file > ${LIB}/${file}.
sed
674 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
675 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
680 # Fix the CAT macro in SunOS memvar.h.
681 file=pixrect
/memvar.h
682 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
683 mkdir
${LIB}/pixrect
2>/dev
/null
684 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
685 chmod +w
${LIB}/$file 2>/dev
/null
686 chmod a
+r
${LIB}/$file 2>/dev
/null
689 if [ -r ${LIB}/$file ]; then
691 sed -e '/^#define.CAT(a,b)/ i\
693 #define CAT(a,b) a##b\
695 /^#define.CAT(a,b)/ a\
697 ' ${LIB}/$file > ${LIB}/${file}.
sed
698 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
699 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
704 # Check for yet more missing ';' in struct (in SunOS 4.0.x)
706 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
707 mkdir
${LIB}/rpcsvc
2>/dev
/null
708 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
709 chmod +w
${LIB}/$file 2>/dev
/null
710 chmod a
+r
${LIB}/$file 2>/dev
/null
713 if [ -r ${LIB}/$file ]; then
715 sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' ${LIB}/$file > ${LIB}/${file}.
sed
716 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
717 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
722 # Fix return type of exit and abort in <stdlib.h> on SunOS 4.1.
723 # Also wrap protection around size_t for m88k-sysv3 systems.
725 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
726 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
727 chmod +w
${LIB}/$file 2>/dev
/null
728 chmod a
+r
${LIB}/$file 2>/dev
/null
731 if [ -r ${LIB}/$file ]; then
733 sed -e 's/int abort/void abort/g' \
734 -e 's/int free/void free/g' \
735 -e 's/char \* calloc/void \* calloc/g' \
736 -e 's/char \* malloc/void \* malloc/g' \
737 -e 's/char \* realloc/void \* realloc/g' \
738 -e 's/int exit/void exit/g' \
739 -e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/i\
741 #define _GCC_SIZE_T' \
742 -e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/a\
744 ${LIB}/$file > ${LIB}/${file}.
sed
745 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
746 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
751 # Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
753 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
754 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
755 chmod +w
${LIB}/$file 2>/dev
/null
756 chmod a
+r
${LIB}/$file 2>/dev
/null
759 if [ -r ${LIB}/$file ]; then
761 sed -e 's/typedef[ ]char \* malloc_t/typedef void \* malloc_t/g' \
762 -e 's/int[ ][ ]*free/void free/g' \
763 ${LIB}/$file > ${LIB}/${file}.
sed
764 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
765 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
770 # Fix bogus #ifdef in <hsfs/hsfs_spec.h> on SunOS 4.1.
771 file=hsfs
/hsfs_spec.h
772 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
773 mkdir
${LIB}/hsfs
2>/dev
/null
774 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
775 chmod +w
${LIB}/$file 2>/dev
/null
776 chmod a
+r
${LIB}/$file 2>/dev
/null
779 if [ -r ${LIB}/$file ]; then
781 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
782 ${LIB}/$file > ${LIB}/${file}.
783 rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
784 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
789 # Fix bogus #ifdef in <hsfs/hsnode.h> on SunOS 4.1.
791 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
792 mkdir
${LIB}/hsfs
2>/dev
/null
793 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
794 chmod +w
${LIB}/$file 2>/dev
/null
795 chmod a
+r
${LIB}/$file 2>/dev
/null
798 if [ -r ${LIB}/$file ]; then
800 sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \
801 ${LIB}/$file > ${LIB}/${file}.
sed
802 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
803 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
808 # Fix bogus #ifdef in <hsfs/iso_spec.h> on SunOS 4.1.
810 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
811 mkdir
${LIB}/hsfs
2>/dev
/null
812 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
813 chmod +w
${LIB}/$file 2>/dev
/null
814 chmod a
+r
${LIB}/$file 2>/dev
/null
817 if [ -r ${LIB}/$file ]; then
819 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
820 ${LIB}/$file > ${LIB}/${file}.
sed
821 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
822 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
827 # Incorrect #include in Sony News-OS 3.2.
828 file=machine
/machparam.h
829 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
830 mkdir
${LIB}/machine
2>/dev
/null
831 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
832 chmod +w
${LIB}/$file 2>/dev
/null
833 chmod a
+r
${LIB}/$file 2>/dev
/null
836 if [ -r ${LIB}/$file ]; then
837 echo Fixing
$file, incorrect \
#include
838 sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \
839 ${LIB}/$file > ${LIB}/${file}.
840 rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
841 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
846 # Multiline comment after typedef on IRIX 4.0.1.
848 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
849 mkdir
${LIB}/sys
2>/dev
/null
850 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
851 chmod +w
${LIB}/$file 2>/dev
/null
852 chmod a
+r
${LIB}/$file 2>/dev
/null
855 if [ -r ${LIB}/$file ]; then
856 echo Fixing
$file, comment
in the middle of \
#ifdef
857 sed -e 's@type of the result@type of the result */@' \
858 -e 's@of the sizeof@/* of the sizeof@' \
859 ${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
866 # Turning // comments into /* */ comments trashes this IRIX 4.0.1
867 # header file, which embeds // comments inside multi-line /* */
868 # comments. If this looks like the IRIX header file, we refix it by
869 # just throwing away the // comments.
871 if [ -r ${LIB}/$file ]; then
872 if egrep indigo.esd
${LIB}/$file > /dev
/null
; then
873 echo Fixing
$file, overeager
sed script
875 sed -e 's|//.*$||g' $file > ${LIB}/$file
876 chmod +w
${LIB}/$file 2>/dev
/null
877 chmod a
+r
${LIB}/$file 2>/dev
/null
881 # Another IRIX 4.0.1 header file contains the string "//"
883 if [ -r ${LIB}/$file ]; then
884 echo Fixing
$file, overeager
sed script
885 sed -e 's|"/\*"\*/|"//"|' ${LIB}/$file > ${LIB}/${file}.
sed
886 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
887 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
892 # Same problem with a file from SunOS 4.1.3 : a header file containing
893 # the string "//" embedded in "/**/"
894 file=sbusdev
/audiovar.h
895 if [ -r ${LIB}/$file ]; then
896 echo Fixing
$file, overeager
sed script
898 sed -e 's|//.*$||g' $file > ${LIB}/$file
899 chmod +w
${LIB}/$file 2>/dev
/null
900 chmod a
+r
${LIB}/$file 2>/dev
/null
903 # Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
904 # declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because
905 # many other systems have similar text but correct versions of the file.
906 # To ensure only Sun's is fixed, we grep for a likely unique string.
908 if [ -r $file ] && egrep '/\* @\(#\)memory\.h 1\.[2-4] 8./../.. SMI; from S5R2 1\.2 \*/' $file > /dev
/null
; then
909 if [ ! -r ${LIB}/$file ]; then
910 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
911 chmod +w
${LIB}/$file 2>/dev
/null
912 chmod a
+r
${LIB}/$file 2>/dev
/null
914 if [ -r ${LIB}/$file ]; then
916 cat > ${LIB}/$file << EOF
917 /* This file was generated by fixincludes */
922 extern void *memccpy();
923 extern void *memchr();
924 extern void *memcpy();
925 extern void *memset();
927 extern char *memccpy();
928 extern char *memchr();
929 extern char *memcpy();
930 extern char *memset();
931 #endif /* __STDC__ */
935 #endif /* __memory_h__ */
940 # parameters not const on DECstation Ultrix V4.0.
942 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
943 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
944 chmod +w
${LIB}/$file 2>/dev
/null
945 chmod a
+r
${LIB}/$file 2>/dev
/null
948 if [ -r ${LIB}/$file ]; then
949 echo Fixing
$file, non-const arg
950 sed -e 's@perror( char \*__s );@perror( const char *__s );@' \
951 -e 's@fputs( char \*__s,@fputs( const char *__s,@' \
952 -e 's@fopen( char \*__filename, char \*__type );@fopen( const char *__filename, const char *__type );@' \
953 -e 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@' \
954 -e 's@fscanf( FILE \*__stream, char \*__format,@fscanf( FILE *__stream, const char *__format,@' \
955 -e 's@scanf( char \*__format,@scanf( const char *__format,@' \
956 -e 's@sscanf( char \*__s, char \*__format,@sscanf( const char *__s, const char *__format,@' \
957 ${LIB}/$file > ${LIB}/${file}.
sed
958 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
959 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
964 # parameters conflict with C++ new on rs/6000
965 for file in stdio.h unistd.h
; do
966 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
967 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
968 chmod +w
${LIB}/$file 2>/dev
/null
971 if [ -r ${LIB}/$file ]; then
972 echo Fixing
$file, parameter name conflicts
973 sed -e 's@rename(const char \*old, const char \*new)@rename(const char *_old, const char *_new)@' \
974 ${LIB}/$file > ${LIB}/${file}.
sed
975 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
976 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
982 # function class(double x) conflicts with C++ keyword on rs/6000
984 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
985 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
986 chmod +w
${LIB}/$file 2>/dev
/null
987 chmod a
+r
${LIB}/$file 2>/dev
/null
990 if [ -r ${LIB}/$file ]; then
991 if grep 'class[(]' ${LIB}/$file >/dev
/null
; then
994 #ifndef __cplusplus' \
996 #endif' ${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
1004 # NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
1005 # Note that version 3 of the NeXT system has wait.h in a different directory,
1006 # so that this code won't do anything. But wait.h in version 3 has a
1007 # conditional, so it doesn't need this fix. So everything is okay.
1009 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1010 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1011 chmod +w
${LIB}/$file 2>/dev
/null
1014 if [ -r ${LIB}/$file ] \
1015 && grep 'wait[(]union wait' ${LIB}/$file >/dev
/null
; then
1016 echo Fixing
$file, bad
wait formal
1017 sed -e 's@wait(union wait@wait(void@' ${LIB}/$file > ${LIB}/${file}.
sed
1018 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1019 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1024 # Don't use or define the name va_list in stdio.h.
1025 # This is for ANSI and also to interoperate properly with gvarargs.h.
1027 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1028 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1029 chmod +w
${LIB}/$file 2>/dev
/null
1030 chmod a
+r
${LIB}/$file 2>/dev
/null
1033 if [ -r ${LIB}/$file ]; then
1034 echo Fixing
$file, use of va_list
1035 # Arrange for stdio.h to use stdarg.h to define __gnuc_va_list
1036 (echo "#define __need___va_list"
1037 echo "#include <stdarg.h>") > ${LIB}/${file}.
sed
1038 # Use __gnuc_va_list in arg types in place of va_list.
1039 # On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
1040 # trailing parentheses and semicolon save all other systems from this.
1041 # Define __va_list__ (something harmless and unused) instead of va_list.
1042 # Don't claim to have defined va_list.
1043 sed -e 's@ va_list @ __gnuc_va_list @' \
1044 -e 's@ va_list)@ __gnuc_va_list)@' \
1045 -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \
1046 -e 's@ va_list@ __va_list__@' \
1047 -e 's@\*va_list@*__va_list__@' \
1048 -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \
1049 -e 's@VA_LIST@DUMMY_VA_LIST@' \
1050 -e 's@_NEED___Va_LIST@_NEED___VA_LIST@' \
1051 ${LIB}/$file >> ${LIB}/${file}.
sed
1053 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1054 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1059 # Cancel out ansi_compat.h on Ultrix. Replace it with empty file.
1061 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1062 if grep -s ULTRIX
$file; then
1063 echo "/* This file intentionally left blank. */" > $LIB/$file
1067 # parameter to atof not const on DECstation Ultrix V4.0.
1068 # also get rid of bogus inline definitions in HP-UX 8.0
1070 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1071 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1072 chmod +w
${LIB}/$file 2>/dev
/null
1073 chmod a
+r
${LIB}/$file 2>/dev
/null
1076 if [ -r ${LIB}/$file ]; then
1077 echo Fixing
$file, non-const arg
1078 sed -e 's@atof( char \*__nptr );@atof( const char *__nptr );@' \
1079 -e 's@inline int abs(int d) { return (d>0)?d:-d; }@@' \
1080 -e 's@inline double abs(double d) { return fabs(d); }@@' \
1081 ${LIB}/$file > ${LIB}/${file}.
sed
1082 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1083 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1088 # In limits.h, put #ifndefs around things that are supposed to be defined
1089 # in float.h to avoid redefinition errors if float.h is included first.
1090 # On HP/UX this patch does not work, because on HP/UX limits.h uses
1091 # multi line comments and the inserted #endif winds up inside the
1092 # comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if
1093 # we find a #ifndef FLT_MIN we assume that all the required #ifndefs
1094 # are there, and we do not add them ourselves.
1096 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1097 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1098 chmod +w
${LIB}/$file 2>/dev
/null
1099 chmod a
+r
${LIB}/$file 2>/dev
/null
1102 if [ -r ${LIB}/$file ]; then
1103 if egrep 'ifndef[ ]+FLT_MIN' ${LIB}/$file >/dev
/null
; then
1107 sed -e '/[ ]FLT_MIN[ ]/i\
1109 -e '/[ ]FLT_MIN[ ]/a\
1111 -e '/[ ]FLT_MAX[ ]/i\
1113 -e '/[ ]FLT_MAX[ ]/a\
1115 -e '/[ ]FLT_DIG[ ]/i\
1117 -e '/[ ]FLT_DIG[ ]/a\
1119 -e '/[ ]DBL_MIN[ ]/i\
1121 -e '/[ ]DBL_MIN[ ]/a\
1123 -e '/[ ]DBL_MAX[ ]/i\
1125 -e '/[ ]DBL_MAX[ ]/a\
1127 -e '/[ ]DBL_DIG[ ]/i\
1129 -e '/[ ]DBL_DIG[ ]/a\
1131 ${LIB}/$file > ${LIB}/${file}.
sed
1132 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1134 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1135 echo Deleting
${LIB}/$file\
; no fixes were needed.
1140 # In math.h, put #ifndefs around things that might be defined in a gcc
1141 # specific math-*.h file.
1143 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1144 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1145 chmod +w
${LIB}/$file 2>/dev
/null
1146 chmod a
+r
${LIB}/$file 2>/dev
/null
1149 if [ -r ${LIB}/$file ]; then
1151 sed -e '/define[ ]HUGE_VAL[ ]/i\
1153 -e '/define[ ]HUGE_VAL[ ]/a\
1155 ${LIB}/$file > ${LIB}/${file}.
sed
1156 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1157 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1158 echo Deleting
${LIB}/$file\
; no fixes were needed.
1163 # Remove erroneous parentheses in sym.h on Alpha OSF/1.
1165 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1166 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1167 chmod +w
${LIB}/$file 2>/dev
/null
1168 chmod a
+r
${LIB}/$file 2>/dev
/null
1171 if [ -r ${LIB}/$file ]; then
1173 sed -e 's/#ifndef(__mips64)/#ifndef __mips64/' \
1174 ${LIB}/$file > ${LIB}/${file}.
sed
1175 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1176 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1181 # Fix incorrect S_IF* definitions on m88k-sysv3.
1183 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1184 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1185 chmod +w
${LIB}/$file 2>/dev
/null
1186 chmod a
+r
${LIB}/$file 2>/dev
/null
1189 if [ -r ${LIB}/$file ]; then
1191 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)/' \
1192 -e 's/^\(#define[ ]*S_IS[A-Z]*(m)\)[ ]*(m[ ]*&[ ]*\(0[0-9]*\)[ ]*)/\1 (((m)\&S_IFMT)==\2)/' \
1193 ${LIB}/$file > ${LIB}/${file}.
sed
1194 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1195 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1200 # These two files on SunOS 4 are included by other files
1201 # in the same directory, using "...". So we must make sure they exist
1202 # in the same directory as the other fixed files.
1203 if [ -r ${INPUT}/multimedia
/audio_errno.h
]
1205 ln -s ${INPUT}/multimedia
/audio_errno.h
${LIB}/multimedia
2>/dev
/null
1207 if [ -r ${INPUT}/multimedia
/audio_hdr.h
]
1209 ln -s ${INPUT}/multimedia
/audio_hdr.h
${LIB}/multimedia
2>/dev
/null
1212 # Determine if we're on Interactive Unix 2.2 or later, in which case we
1213 # need to fix some additional files. This is the same test for ISC that
1215 if test -d /etc
/conf
/kconfig.d \
1216 && grep _POSIX_VERSION
/usr
/include
/sys
/unistd.h
>/dev
/null
2>&1; then
1217 echo "Fixing ISC __STDC__ goof in several files..."
1218 for name
in stdio.h math.h ctype.h sys
/limits.h sys
/fcntl.h sys
/dirent.h
; do
1220 if test -r ${LIB}/$name; then
1225 # On Interactive 2.2, certain traditional Unix definitions
1226 # (notably getc and putc in stdio.h) are omitted if __STDC__ is
1227 # defined, not just if _POSIX_SOURCE is defined. This makes it
1228 # impossible to compile any nontrivial program except with -posix.
1230 's/!defined(__STDC__) && !defined(_POSIX_SOURCE)/!defined(_POSIX_SOURCE)/' \
1231 < $file > ${LIB}/$name.
1232 mv ${LIB}/$name.
${LIB}/$name
1235 echo "Fixing ISC fmod declaration"
1236 # This one's already been fixed for other things.
1238 sed 's/fmod(double)/fmod(double, double)/' <$file >$file.
1241 echo "Fixing nested comments in ISC <sys/limits.h>"
1243 sed '/CHILD_MAX/s,/\* Max, Max,' < ${INPUT}/$file >${LIB}/$file.
1244 sed '/OPEN_MAX/s,/\* Max, Max,' < ${LIB}/$file.
>${LIB}/$file
1247 # These files in Sun OS 4.x use /**/ to concatenate tokens.
1248 for file in sparc
/asm_linkage.h sun
3/asm_linkage.h sun3x
/asm_linkage.h \
1249 sun
4/asm_linkage.h sun4c
/asm_linkage.h sun4m
/asm_linkage.h \
1250 sun4c
/debug
/asm_linkage.h sun4m
/debug
/asm_linkage.h
;
1252 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1253 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1254 chmod +w
${LIB}/$file 2>/dev
/null
1255 chmod a
+r
${LIB}/$file 2>/dev
/null
1258 if [ -r ${LIB}/$file ]; then
1259 sed -e 's|/\*\*/|##|g' ${LIB}/$file > ${LIB}/${file}.
sed
1260 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1261 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1267 # These files in ARM/RISCiX use /**/ to concatenate tokens.
1268 for file in arm
/as_support.h
arm
/mc_type.h
arm
/xcb.h dev
/chardefmac.h \
1269 dev
/ps_irq.h dev
/screen.h dev
/scsi.h sys
/tty.h \
1270 X11
/extensions
/multibufst.h X11
/Xmd.h X11
/Xlibinit.h \
1273 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1274 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1275 chmod +w
${LIB}/$file 2>/dev
/null
1276 chmod a
+r
${LIB}/$file 2>/dev
/null
1279 if [ -r ${LIB}/$file ]; then
1280 sed -e 's|/\*\*/|##|g' ${LIB}/$file > ${LIB}/${file}.
sed
1281 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1282 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1288 echo 'Removing unneeded directories:'
1290 files
=`find . -type d -print | sort -r`
1291 for file in $files; do
1292 rmdir $LIB/$file > /dev
/null
2>&1
1296 echo 'Making internal symbolic non-directory links'
1298 files
=`find . -type l -print`
1299 for file in $files; do
1300 dest
=`ls -ld $file | sed -n 's/.*-> //p'`
1301 if expr "$dest" : '[^/].*' > /dev
/null
; then
1302 target
=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
1303 if [ -f $target ]; then
1304 ln -s $dest ${LIB}/$file >/dev
/null
2>&1
1310 echo 'Cleaning up DONE files.'
1312 find .
-name DONE
-exec rm -f '{}' ';'