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@[^/][^/]*@..@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@[^/][^/]*@..@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-zA-Z][a-zA-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/'\''\([cgxtf]\)'\''/\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/ _*host_mips / __host_mips__ /g
306 s/ _*i386 / __i386__ /g
307 s/ is68k / __is68k__ /g
308 s/ m68k / __m68k__ /g
309 s/ mc680\([0-9]\)0 / __mc680\10__ /g
310 s/ _*mips / __mips__ /g
311 s/ news\([0-9]*\) / __news\1__ /g
312 s/ ns32000 / __ns32000__ /g
314 s/ sony_news / __sony_news__ /g
315 s/ sparc / __sparc__ /g
316 s/ sun\([a-z0-9]*\) / __sun\1__ /g
317 s/ unix / __unix__ /g
319 s/ _*MIPSE\([LB]\) / __MIPSE\1__ /g
320 s/ _*R\([34]\)000 / __R\1000__ /g
321 s/ _*SYSTYPE_\([A-Z0-9]*\) / __SYSTYPE_\1__ /g
323 s/ \([a-zA-Z0-9_][a-zA-Z0-9_]*\) /\1/g
325 /^#define.NULL[ ]/ i\
327 ' $2/$file > $2/$file.
328 mv $2/$file.
$2/$file
329 if cmp $file $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 size_t in header files that it comes from.
348 for file in sys
/types.h stdlib.h sys
/stdtypes.h stddef.h memory.h unistd.h
; do
349 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
350 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
351 chmod +w
${LIB}/$file 2>/dev
/null
352 chmod a
+r
${LIB}/$file 2>/dev
/null
355 if [ -r ${LIB}/$file ]; then
356 echo Fixing
$file comment
357 # Get the definition of __SIZE_TYPE__, if any.
358 # (This file must be called something.c).
359 echo "__SIZE_TYPE__" > ${LIB}/types.c
360 foo
=`${GCCCMD} -E -P ${LIB}/types.c`
362 # Default to our preferred type.
363 if [ "$foo" = __SIZE_TYPE__
]; then foo
="unsigned long int"; fi
364 sed -e "s/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/typedef $foo size_t/" ${LIB}/$file > ${LIB}/${file}.
sed
365 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
366 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
372 # Fix one other error in this file: a mismatched quote not inside a C comment.
373 file=sundev
/vuid_event.h
374 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
375 mkdir
${LIB}/sundev
2>/dev
/null
376 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
377 chmod +w
${LIB}/$file 2>/dev
/null
378 chmod a
+r
${LIB}/$file 2>/dev
/null
381 if [ -r ${LIB}/$file ]; then
382 echo Fixing
$file comment
383 sed -e "s/doesn't/does not/" ${LIB}/$file > ${LIB}/${file}.
sed
384 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
385 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
390 # Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
391 file=sunwindow
/win_cursor.h
392 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
393 # mkdir ${LIB}/sunwindow 2>/dev/null
394 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
395 chmod +w
${LIB}/$file 2>/dev
/null
397 if [ -r ${LIB}/$file ]; then
399 sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.
sed
400 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
401 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
405 file=sunwindow
/win_lock.h
406 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
407 # mkdir ${LIB}/sunwindow 2>/dev/null
408 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
409 chmod +w
${LIB}/$file 2>/dev
/null
411 if [ -r ${LIB}/$file ]; then
413 sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.
sed
414 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
415 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
420 # Fix this Sun file to avoid interfering with stddef.h.
422 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
423 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
424 chmod +w
${LIB}/$file 2>/dev
/null
425 chmod a
+r
${LIB}/$file 2>/dev
/null
428 if [ -r ${LIB}/$file ]; then
430 sed -e '/[ ]size_t.*;/i\
432 #define _GCC_SIZE_T' \
435 -e '/[ ]ptrdiff_t.*;/i\
436 #ifndef _GCC_PTRDIFF_T\
437 #define _GCC_PTRDIFF_T' \
438 -e '/[ ]ptrdiff_t.*;/a\
440 -e '/[ ]wchar_t.*;/i\
441 #ifndef _GCC_WCHAR_T\
442 #define _GCC_WCHAR_T' \
443 -e '/[ ]wchar_t.*;/a\
444 #endif' ${LIB}/$file > ${LIB}/${file}.
sed
445 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
446 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
451 # Fix this ARM/RISCiX file to avoid interfering with the use of __wchar_t
454 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
455 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
456 chmod +w
${LIB}/$file 2>/dev
/null
457 chmod a
+r
${LIB}/$file 2>/dev
/null
460 if [ -r ${LIB}/$file ]; then
462 sed -e "s/\(#[ ]*ifndef[ ]*\)__wchar_t/\1_GCC_WCHAR_T/" \
463 -e "s/\(#[ ]*define[ ]*\)__wchar_t/\1_GCC_WCHAR_T/" \
464 ${LIB}/$file > ${LIB}/${file}.
sed
465 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
466 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
471 # Fix this file to avoid interfering with stddef.h, but don't mistakenly
472 # match ssize_t present in AIX for the ps/2, or typedefs which use (but do not
475 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
476 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
477 chmod +w
${LIB}/$file 2>/dev
/null
478 chmod a
+r
${LIB}/$file 2>/dev
/null
481 if [ -r ${LIB}/$file ]; then
483 sed -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/i\
485 #define _GCC_SIZE_T' \
486 -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/a\
487 #endif' ${LIB}/$file > ${LIB}/${file}.
sed
488 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
489 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
494 # Fix HP's use of ../machine/inline.h to refer to
495 # /usr/include/machine/inline.h
497 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
498 cp $file ${LIB}/$file
500 if [ -r ${LIB}/$file ] ; then
502 sed -e 's,"../machine/inline.h",<machine/inline.h>,' \
503 -e 's,"../machine/psl.h",<machine/psl.h>,' \
504 ${LIB}/$file > ${LIB}/${file}.
sed
505 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
506 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
511 # Fix an error in this file: the #if says _cplusplus, not the double
512 # underscore __cplusplus that it should be
514 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
515 mkdir
${LIB}/rpcsvc
2>/dev
/null
516 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
517 chmod +w
${LIB}/$file 2>/dev
/null
518 chmod a
+r
${LIB}/$file 2>/dev
/null
521 if [ -r ${LIB}/$file ]; then
522 echo Fixing
$file, __cplusplus macro
523 sed -e 's/[ ]_cplusplus/ __cplusplus/' ${LIB}/$file > ${LIB}/${file}.
sed
524 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
525 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
530 # Fix an error in this file: a missing semi-colon at the end of the statsswtch
531 # structure definition.
533 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
534 mkdir
${LIB}/rpcsvc
2>/dev
/null
535 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
536 chmod +w
${LIB}/$file 2>/dev
/null
537 chmod a
+r
${LIB}/$file 2>/dev
/null
540 if [ -r ${LIB}/$file ]; then
541 echo Fixing
$file, definition of statsswtch
542 sed -e 's/boottime$/boottime;/' ${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
549 # Fix an error in this file: a missing semi-colon at the end of the nodeent
550 # structure definition.
551 file=netdnet
/dnetdb.h
552 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
553 mkdir
${LIB}/netdnet
2>/dev
/null
554 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
555 chmod +w
${LIB}/$file 2>/dev
/null
556 chmod a
+r
${LIB}/$file 2>/dev
/null
559 if [ -r ${LIB}/$file ]; then
560 echo Fixing
$file, definition of nodeent
561 sed -e 's/char.*na_addr *$/char *na_addr;/' ${LIB}/$file > ${LIB}/${file}.
sed
562 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
563 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
568 # Check for bad #ifdef line (in Ultrix 4.1)
570 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
571 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
572 chmod +w
${LIB}/$file 2>/dev
/null
573 chmod a
+r
${LIB}/$file 2>/dev
/null
576 if [ -r ${LIB}/$file ]; then
577 echo Fixing
$file, bad \
#ifdef line
578 sed -e 's/#ifdef KERNEL/#if defined(KERNEL)/' ${LIB}/$file > ${LIB}/${file}.
sed
579 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
580 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
585 # Check for superfluous `static' (in Ultrix 4.2)
587 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
588 mkdir
${LIB}/machine
2>/dev
/null
589 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
590 chmod +w
${LIB}/$file 2>/dev
/null
591 chmod a
+r
${LIB}/$file 2>/dev
/null
594 if [ -r ${LIB}/$file ]; then
595 echo Fixing
$file, superfluous static
596 sed -e 's/^static struct tlb_pid_state/struct tlb_pid_state/' ${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 # This file has an alternative name, mips/cpu.h. Fix that name, too.
602 if cmp machine
/cpu.h mips
/cpu.h
> /dev
/null
2>&1; then
603 mkdir
${LIB}/mips
2>&-
604 ln ${LIB}/$file ${LIB}/mips
/cpu.h
609 # Incorrect sprintf declaration in X11/Xmu.h
611 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
612 mkdir
${LIB}/X11
2>/dev
/null
613 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
614 chmod +w
${LIB}/$file 2>/dev
/null
615 chmod a
+r
${LIB}/$file 2>/dev
/null
618 if [ -r ${LIB}/$file ]; then
619 echo Fixing
$file sprintf declaration
620 sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
621 extern char * sprintf();\
622 #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.
sed
623 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
624 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
629 # Incorrect sprintf declaration in X11/Xmu/Xmu.h
630 # (It's not clear whether the right file name is this or X11/Xmu.h.)
632 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
633 mkdir
${LIB}/X11
/Xmu
2>/dev
/null
634 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
635 chmod +w
${LIB}/$file 2>/dev
/null
636 chmod a
+r
${LIB}/$file 2>/dev
/null
639 if [ -r ${LIB}/$file ]; then
640 echo Fixing
$file sprintf declaration
641 sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
642 extern char * sprintf();\
643 #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.
sed
644 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
645 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
650 # Check for missing ';' in struct
652 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
653 mkdir
${LIB}/netinet
2>/dev
/null
654 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
655 chmod +w
${LIB}/$file 2>/dev
/null
656 chmod a
+r
${LIB}/$file 2>/dev
/null
659 if [ -r ${LIB}/$file ]; then
661 sed -e '/^struct/,/^};/s/}$/};/' ${LIB}/$file > ${LIB}/${file}.
sed
662 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
663 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
668 # Fix the CAT macro in SunOS memvar.h.
669 file=pixrect
/memvar.h
670 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
671 mkdir
${LIB}/pixrect
2>/dev
/null
672 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
673 chmod +w
${LIB}/$file 2>/dev
/null
674 chmod a
+r
${LIB}/$file 2>/dev
/null
677 if [ -r ${LIB}/$file ]; then
679 sed -e '/^#define.CAT(a,b)/ i\
681 #define CAT(a,b) a##b\
683 /^#define.CAT(a,b)/ a\
685 ' ${LIB}/$file > ${LIB}/${file}.
sed
686 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
687 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
692 # Check for yet more missing ';' in struct (in SunOS 4.0.x)
694 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
695 mkdir
${LIB}/rpcsvc
2>/dev
/null
696 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
697 chmod +w
${LIB}/$file 2>/dev
/null
698 chmod a
+r
${LIB}/$file 2>/dev
/null
701 if [ -r ${LIB}/$file ]; then
703 sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' ${LIB}/$file > ${LIB}/${file}.
sed
704 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
705 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
710 # Fix return type of exit and abort in <stdlib.h> on SunOS 4.1.
711 # Also wrap protection around size_t for m88k-sysv3 systems.
713 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
714 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
715 chmod +w
${LIB}/$file 2>/dev
/null
716 chmod a
+r
${LIB}/$file 2>/dev
/null
719 if [ -r ${LIB}/$file ]; then
721 sed -e 's/int abort/void abort/g' \
722 -e 's/int free/void free/g' \
723 -e 's/char \* calloc/void \* calloc/g' \
724 -e 's/char \* malloc/void \* malloc/g' \
725 -e 's/char \* realloc/void \* realloc/g' \
726 -e 's/int exit/void exit/g' \
727 -e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/i\
729 #define _GCC_SIZE_T' \
730 -e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/a\
732 ${LIB}/$file > ${LIB}/${file}.
sed
733 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
734 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
739 # Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
741 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
742 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
743 chmod +w
${LIB}/$file 2>/dev
/null
744 chmod a
+r
${LIB}/$file 2>/dev
/null
747 if [ -r ${LIB}/$file ]; then
749 sed -e 's/typedef[ ]char \* malloc_t/typedef void \* malloc_t/g' \
750 -e 's/int[ ][ ]*free/void free/g' \
751 ${LIB}/$file > ${LIB}/${file}.
sed
752 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
753 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
758 # Fix bogus #ifdef in <hsfs/hsfs_spec.h> on SunOS 4.1.
759 file=hsfs
/hsfs_spec.h
760 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
761 mkdir
${LIB}/hsfs
2>/dev
/null
762 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
763 chmod +w
${LIB}/$file 2>/dev
/null
764 chmod a
+r
${LIB}/$file 2>/dev
/null
767 if [ -r ${LIB}/$file ]; then
769 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
770 ${LIB}/$file > ${LIB}/${file}.
771 rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
772 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
777 # Fix bogus #ifdef in <hsfs/hsnode.h> on SunOS 4.1.
779 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
780 mkdir
${LIB}/hsfs
2>/dev
/null
781 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
782 chmod +w
${LIB}/$file 2>/dev
/null
783 chmod a
+r
${LIB}/$file 2>/dev
/null
786 if [ -r ${LIB}/$file ]; then
788 sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \
789 ${LIB}/$file > ${LIB}/${file}.
sed
790 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
791 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
796 # Fix bogus #ifdef in <hsfs/iso_spec.h> on SunOS 4.1.
798 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
799 mkdir
${LIB}/hsfs
2>/dev
/null
800 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
801 chmod +w
${LIB}/$file 2>/dev
/null
802 chmod a
+r
${LIB}/$file 2>/dev
/null
805 if [ -r ${LIB}/$file ]; then
807 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
808 ${LIB}/$file > ${LIB}/${file}.
sed
809 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
810 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
815 # Incorrect #include in Sony News-OS 3.2.
816 file=machine
/machparam.h
817 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
818 mkdir
${LIB}/machine
2>/dev
/null
819 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
820 chmod +w
${LIB}/$file 2>/dev
/null
821 chmod a
+r
${LIB}/$file 2>/dev
/null
824 if [ -r ${LIB}/$file ]; then
825 echo Fixing
$file, incorrect \
#include
826 sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \
827 ${LIB}/$file > ${LIB}/${file}.
828 rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
829 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
834 # Multiline comment after typedef on IRIX 4.0.1.
836 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
837 mkdir
${LIB}/sys
2>/dev
/null
838 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
839 chmod +w
${LIB}/$file 2>/dev
/null
840 chmod a
+r
${LIB}/$file 2>/dev
/null
843 if [ -r ${LIB}/$file ]; then
844 echo Fixing
$file, comment
in the middle of \
#ifdef
845 sed -e 's@type of the result@type of the result */@' \
846 -e 's@of the sizeof@/* of the sizeof@' \
847 ${LIB}/$file > ${LIB}/${file}.
sed
848 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
849 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
854 # Turning // comments into /* */ comments trashes this IRIX 4.0.1
855 # header file, which embeds // comments inside multi-line /* */
856 # comments. If this looks like the IRIX header file, we refix it by
857 # just throwing away the // comments.
859 if [ -r ${LIB}/$file ]; then
860 if egrep indigo.esd
${LIB}/$file > /dev
/null
; then
861 echo Fixing
$file, overeager
sed script
863 sed -e 's|//.*$||g' $file > ${LIB}/$file
864 chmod +w
${LIB}/$file 2>/dev
/null
865 chmod a
+r
${LIB}/$file 2>/dev
/null
869 # Some IRIX header files contains the string "//"
870 for file in elf_abi.h elf.h
; do
871 if [ -r ${LIB}/$file ]; then
872 echo Fixing
$file, overeager
sed script
873 sed -e 's|"/\*"\*/|"//"|' ${LIB}/$file > ${LIB}/${file}.
sed
874 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
875 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
881 # IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr in prototype without
882 # previous definition.
884 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
885 mkdir
${LIB}/rpc
2>/dev
/null
886 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
887 chmod +w
${LIB}/$file 2>/dev
/null
888 chmod a
+r
${LIB}/$file 2>/dev
/null
891 if [ -r ${LIB}/$file ]; then
892 echo Fixing
$file, undefined
type
893 sed -e '/authdes_create.*struct sockaddr/i\
895 ${LIB}/$file > ${LIB}/$file.
sed
896 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
897 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
902 # IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s in prototype without previous
905 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
906 mkdir
${LIB}/rpc
2>/dev
/null
907 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
908 chmod +w
${LIB}/$file 2>/dev
/null
909 chmod a
+r
${LIB}/$file 2>/dev
/null
912 if [ -r ${LIB}/$file ]; then
913 echo Fixing
$file, undefined
type
914 sed -e '/xdrstdio_create.*struct __file_s/i\
916 ${LIB}/$file > ${LIB}/$file.
sed
917 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
918 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
923 # Same problem with a file from SunOS 4.1.3 : a header file containing
924 # the string "//" embedded in "/**/"
925 file=sbusdev
/audiovar.h
926 if [ -r ${LIB}/$file ]; then
927 echo Fixing
$file, overeager
sed script
929 sed -e 's|//.*$||g' $file > ${LIB}/$file
930 chmod +w
${LIB}/$file 2>/dev
/null
931 chmod a
+r
${LIB}/$file 2>/dev
/null
934 # Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
935 # declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because
936 # many other systems have similar text but correct versions of the file.
937 # To ensure only Sun's is fixed, we grep for a likely unique string.
939 if [ -r $file ] && egrep '/\* @\(#\)memory\.h 1\.[2-4] 8./../.. SMI; from S5R2 1\.2 \*/' $file > /dev
/null
; then
940 if [ ! -r ${LIB}/$file ]; then
941 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
942 chmod +w
${LIB}/$file 2>/dev
/null
943 chmod a
+r
${LIB}/$file 2>/dev
/null
945 if [ -r ${LIB}/$file ]; then
947 cat > ${LIB}/$file << EOF
948 /* This file was generated by fixincludes */
953 extern void *memccpy();
954 extern void *memchr();
955 extern void *memcpy();
956 extern void *memset();
958 extern char *memccpy();
959 extern char *memchr();
960 extern char *memcpy();
961 extern char *memset();
962 #endif /* __STDC__ */
966 #endif /* __memory_h__ */
971 # parameters not const on DECstation Ultrix V4.0.
973 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
974 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
975 chmod +w
${LIB}/$file 2>/dev
/null
976 chmod a
+r
${LIB}/$file 2>/dev
/null
979 if [ -r ${LIB}/$file ]; then
980 echo Fixing
$file, non-const arg
981 sed -e 's@perror( char \*__s );@perror( const char *__s );@' \
982 -e 's@fputs( char \*__s,@fputs( const char *__s,@' \
983 -e 's@fopen( char \*__filename, char \*__type );@fopen( const char *__filename, const char *__type );@' \
984 -e 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@' \
985 -e 's@fscanf( FILE \*__stream, char \*__format,@fscanf( FILE *__stream, const char *__format,@' \
986 -e 's@scanf( char \*__format,@scanf( const char *__format,@' \
987 -e 's@sscanf( char \*__s, char \*__format,@sscanf( const char *__s, const char *__format,@' \
988 ${LIB}/$file > ${LIB}/${file}.
sed
989 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
990 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
995 # parameters conflict with C++ new on rs/6000
996 for file in stdio.h unistd.h
; do
997 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
998 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
999 chmod +w
${LIB}/$file 2>/dev
/null
1002 if [ -r ${LIB}/$file ]; then
1003 echo Fixing
$file, parameter name conflicts
1004 sed -e 's@rename(const char \*old, const char \*new)@rename(const char *_old, const char *_new)@' \
1005 ${LIB}/$file > ${LIB}/${file}.
sed
1006 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1007 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1013 # function class(double x) conflicts with C++ keyword on rs/6000
1015 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1016 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1017 chmod +w
${LIB}/$file 2>/dev
/null
1018 chmod a
+r
${LIB}/$file 2>/dev
/null
1021 if [ -r ${LIB}/$file ]; then
1022 if grep 'class[(]' ${LIB}/$file >/dev
/null
; then
1024 sed -e '/class[(]/i\
1025 #ifndef __cplusplus' \
1027 #endif' ${LIB}/$file > ${LIB}/${file}.
sed
1028 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1029 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1035 # Wrong fchmod prototype on RS/6000.
1037 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1038 mkdir
${LIB}/sys
2>/dev
/null
1039 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1040 chmod +w
${LIB}/$file 2>/dev
/null
1041 chmod a
+r
${LIB}/$file 2>/dev
/null
1044 if [ -r ${LIB}/$file ]; then
1045 echo Fixing
$file, fchmod prototype
1046 sed -e 's/fchmod(char \*/fchmod(int/' \
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
1054 # There are several name conflicts with C++ reserved words in X11
1055 # header files. These are fixed in some versions, so don't do the
1056 # fixes if we find __cplusplus in the file. These were found on the
1059 # class in X11/ShellP.h
1061 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1062 mkdir
${LIB}/sys
2>/dev
/null
1063 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1064 chmod +w
${LIB}/$file 2>/dev
/null
1065 chmod a
+r
${LIB}/$file 2>/dev
/null
1068 if [ -r ${LIB}/$file ]; then
1069 if grep __cplusplus
${LIB}/$file >/dev
/null
2>/dev
/null
; then
1072 echo Fixing
$file, field class
1073 sed -e '/char [*]class;/i\
1077 -e '/char [*]class;/a\
1078 #endif' ${LIB}/$file > ${LIB}/${file}.
sed
1079 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1081 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1085 # new in Xm/Traversal.h
1087 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1088 mkdir
${LIB}/sys
2>/dev
/null
1089 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1090 chmod +w
${LIB}/$file 2>/dev
/null
1091 chmod a
+r
${LIB}/$file 2>/dev
/null
1094 if [ -r ${LIB}/$file ]; then
1095 if grep __cplusplus
${LIB}/$file >/dev
/null
2>/dev
/null
; then
1098 echo Fixing
$file, field new
1099 sed -e '/Widget old, new;/i\
1103 -e '/Widget old, new;/a\
1104 #endif' ${LIB}/$file > ${LIB}/${file}.
sed
1105 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1107 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1111 # class in Xm/BaseClassI.h
1112 file=Xm
/BaseClassI.h
1113 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1114 mkdir
${LIB}/sys
2>/dev
/null
1115 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1116 chmod +w
${LIB}/$file 2>/dev
/null
1117 chmod a
+r
${LIB}/$file 2>/dev
/null
1120 if [ -r ${LIB}/$file ]; then
1121 if grep __cplusplus
${LIB}/$file >/dev
/null
2>/dev
/null
; then
1124 echo Fixing
$file, prototype parameter name
1125 sed -e 's/ class[)]/ c_class)/g' ${LIB}/$file > ${LIB}/${file}.
sed
1126 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1128 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1134 # NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
1135 # Note that version 3 of the NeXT system has wait.h in a different directory,
1136 # so that this code won't do anything. But wait.h in version 3 has a
1137 # conditional, so it doesn't need this fix. So everything is okay.
1139 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1140 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1141 chmod +w
${LIB}/$file 2>/dev
/null
1144 if [ -r ${LIB}/$file ] \
1145 && grep 'wait[(]union wait' ${LIB}/$file >/dev
/null
; then
1146 echo Fixing
$file, bad
wait formal
1147 sed -e 's@wait(union wait@wait(void@' ${LIB}/$file > ${LIB}/${file}.
sed
1148 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1149 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1154 # Don't use or define the name va_list in stdio.h.
1155 # This is for ANSI and also to interoperate properly with gvarargs.h.
1157 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1158 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1159 chmod +w
${LIB}/$file 2>/dev
/null
1160 chmod a
+r
${LIB}/$file 2>/dev
/null
1163 if [ -r ${LIB}/$file ]; then
1164 echo Fixing
$file, use of va_list
1165 # Arrange for stdio.h to use stdarg.h to define __gnuc_va_list
1166 (echo "#define __need___va_list"
1167 echo "#include <stdarg.h>") > ${LIB}/${file}.
sed
1168 # Use __gnuc_va_list in arg types in place of va_list.
1169 # On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
1170 # trailing parentheses and semicolon save all other systems from this.
1171 # Define __va_list__ (something harmless and unused) instead of va_list.
1172 # Don't claim to have defined va_list.
1173 sed -e 's@ va_list @ __gnuc_va_list @' \
1174 -e 's@ va_list)@ __gnuc_va_list)@' \
1175 -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \
1176 -e 's@ va_list@ __va_list__@' \
1177 -e 's@\*va_list@*__va_list__@' \
1178 -e 's@ __va_list)@ __gnuc_va_list)@' \
1179 -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \
1180 -e 's@VA_LIST@DUMMY_VA_LIST@' \
1181 -e 's@_NEED___Va_LIST@_NEED___VA_LIST@' \
1182 ${LIB}/$file >> ${LIB}/${file}.
sed
1184 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1185 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1190 # Cancel out ansi_compat.h on Ultrix. Replace it with empty file.
1192 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1193 if grep -s ULTRIX
$file; then
1194 echo "/* This file intentionally left blank. */" > $LIB/$file
1198 # parameter to atof not const on DECstation Ultrix V4.0.
1199 # also get rid of bogus inline definitions in HP-UX 8.0
1201 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1202 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1203 chmod +w
${LIB}/$file 2>/dev
/null
1204 chmod a
+r
${LIB}/$file 2>/dev
/null
1207 if [ -r ${LIB}/$file ]; then
1208 echo Fixing
$file, non-const arg
1209 sed -e 's@atof( char \*__nptr );@atof( const char *__nptr );@' \
1210 -e 's@inline int abs(int [a-z][a-z]*) {.*}@@' \
1211 -e 's@inline double abs(double [a-z][a-z]*) {.*}@@' \
1212 -e 's@inline int sqr(int [a-z][a-z]*) {.*}@@' \
1213 -e 's@inline double sqr(double [a-z][a-z]*) {.*}@@' \
1214 ${LIB}/$file > ${LIB}/${file}.
sed
1215 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1216 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1221 # Avoid nested comments on Ultrix 4.3.
1223 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1224 mkdir
${LIB}/rpc
2>/dev
/null
1225 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1226 chmod +w
${LIB}/$file 2>/dev
/null
1227 chmod a
+r
${LIB}/$file 2>/dev
/null
1230 if [ -r ${LIB}/$file ]; then
1231 echo Fixing
$file, nested comment
1232 sed -e 's@^\( \* int protocol; \)/\*@\1*/ /*@' \
1233 ${LIB}/$file > ${LIB}/$file.
sed
1234 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1235 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1240 # This file in RISC/os uses /**/ to concatenate two tokens.
1242 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1243 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1244 chmod +w
${LIB}/$file 2>/dev
/null
1245 chmod a
+r
${LIB}/$file 2>/dev
/null
1247 if [ -r ${LIB}/$file ]; then
1248 sed -e 's|/\*\*/|##|' ${LIB}/$file > ${LIB}/${file}.
sed
1249 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1250 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1256 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1257 mkdir
${LIB}/rpc
2>/dev
/null
1258 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1259 chmod +w
${LIB}/$file 2>/dev
/null
1260 chmod a
+r
${LIB}/$file 2>/dev
/null
1263 if [ -r ${LIB}/$file ]; then
1264 echo Fixing
$file, nested comment
1265 sed -e 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@' \
1266 ${LIB}/$file > ${LIB}/$file.
sed
1267 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1268 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1273 # In limits.h, put #ifndefs around things that are supposed to be defined
1274 # in float.h to avoid redefinition errors if float.h is included first.
1275 # On HP/UX this patch does not work, because on HP/UX limits.h uses
1276 # multi line comments and the inserted #endif winds up inside the
1277 # comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if
1278 # we find a #ifndef FLT_MIN we assume that all the required #ifndefs
1279 # are there, and we do not add them ourselves.
1280 for file in limits.h sys
/limits.h
; do
1281 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1282 mkdir
${LIB}/sys
2>/dev
/null
1283 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1284 chmod +w
${LIB}/$file 2>/dev
/null
1285 chmod a
+r
${LIB}/$file 2>/dev
/null
1288 if [ -r ${LIB}/$file ]; then
1289 if egrep 'ifndef[ ]+FLT_MIN' ${LIB}/$file >/dev
/null
; then
1293 sed -e '/[ ]FLT_MIN[ ]/i\
1295 -e '/[ ]FLT_MIN[ ]/a\
1297 -e '/[ ]FLT_MAX[ ]/i\
1299 -e '/[ ]FLT_MAX[ ]/a\
1301 -e '/[ ]FLT_DIG[ ]/i\
1303 -e '/[ ]FLT_DIG[ ]/a\
1305 -e '/[ ]DBL_MIN[ ]/i\
1307 -e '/[ ]DBL_MIN[ ]/a\
1309 -e '/[ ]DBL_MAX[ ]/i\
1311 -e '/[ ]DBL_MAX[ ]/a\
1313 -e '/[ ]DBL_DIG[ ]/i\
1315 -e '/[ ]DBL_DIG[ ]/a\
1317 ${LIB}/$file > ${LIB}/${file}.
sed
1318 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1320 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1321 echo Deleting
${LIB}/$file\
; no fixes were needed.
1327 # In math.h, put #ifndefs around things that might be defined in a gcc
1328 # specific math-*.h file.
1330 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1331 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1332 chmod +w
${LIB}/$file 2>/dev
/null
1333 chmod a
+r
${LIB}/$file 2>/dev
/null
1336 if [ -r ${LIB}/$file ]; then
1338 sed -e '/define[ ]HUGE_VAL[ ]/i\
1340 -e '/define[ ]HUGE_VAL[ ]/a\
1342 ${LIB}/$file > ${LIB}/${file}.
sed
1343 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1344 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1345 echo Deleting
${LIB}/$file\
; no fixes were needed.
1350 # Remove erroneous parentheses in sym.h on Alpha OSF/1.
1352 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1353 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1354 chmod +w
${LIB}/$file 2>/dev
/null
1355 chmod a
+r
${LIB}/$file 2>/dev
/null
1358 if [ -r ${LIB}/$file ]; then
1360 sed -e 's/#ifndef(__mips64)/#ifndef __mips64/' \
1361 ${LIB}/$file > ${LIB}/${file}.
sed
1362 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1363 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1368 # Fix incorrect S_IF* definitions on m88k-sysv3.
1370 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1371 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1372 chmod +w
${LIB}/$file 2>/dev
/null
1373 chmod a
+r
${LIB}/$file 2>/dev
/null
1376 if [ -r ${LIB}/$file ]; then
1378 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)/' \
1379 -e 's/^\(#define[ ]*S_IS[A-Z]*(m)\)[ ]*(m[ ]*&[ ]*\(0[0-9]*\)[ ]*)/\1 (((m)\&S_IFMT)==\2)/' \
1380 ${LIB}/$file > ${LIB}/${file}.
sed
1381 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1382 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1387 # Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1.
1388 for file in stdio.h stdlib.h
; do
1389 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1390 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1391 chmod +w
${LIB}/$file 2>/dev
/null
1392 chmod a
+r
${LIB}/$file 2>/dev
/null
1395 if [ -r ${LIB}/$file ]; then
1396 echo Fixing
$file, getopt declaration
1397 sed -e 's/getopt(int, char \*\[\],char \*)/getopt(int, char *const[], const char *)/' \
1398 ${LIB}/$file > ${LIB}/${file}.
sed
1399 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1400 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1406 # These two files on SunOS 4 are included by other files
1407 # in the same directory, using "...". So we must make sure they exist
1408 # in the same directory as the other fixed files.
1409 if [ -r ${INPUT}/multimedia
/audio_errno.h
]
1411 ln -s ${INPUT}/multimedia
/audio_errno.h
${LIB}/multimedia
2>/dev
/null
1413 if [ -r ${INPUT}/multimedia
/audio_hdr.h
]
1415 ln -s ${INPUT}/multimedia
/audio_hdr.h
${LIB}/multimedia
2>/dev
/null
1418 # Determine if we're on Interactive Unix 2.2 or later, in which case we
1419 # need to fix some additional files. This is the same test for ISC that
1421 if test -d /etc
/conf
/kconfig.d \
1422 && grep _POSIX_VERSION
/usr
/include
/sys
/unistd.h
>/dev
/null
2>&1; then
1423 echo "Fixing ISC __STDC__ goof in several files..."
1424 for name
in stdio.h math.h ctype.h sys
/limits.h sys
/fcntl.h sys
/dirent.h
; do
1426 if test -r ${LIB}/$name; then
1431 # On Interactive 2.2, certain traditional Unix definitions
1432 # (notably getc and putc in stdio.h) are omitted if __STDC__ is
1433 # defined, not just if _POSIX_SOURCE is defined. This makes it
1434 # impossible to compile any nontrivial program except with -posix.
1436 's/!defined(__STDC__) && !defined(_POSIX_SOURCE)/!defined(_POSIX_SOURCE)/' \
1437 < $file > ${LIB}/$name.
1438 mv ${LIB}/$name.
${LIB}/$name
1441 echo "Fixing ISC fmod declaration"
1442 # This one's already been fixed for other things.
1444 sed 's/fmod(double)/fmod(double, double)/' <$file >$file.
1447 echo "Fixing nested comments in ISC <sys/limits.h>"
1449 sed '/CHILD_MAX/s,/\* Max, Max,' < ${INPUT}/$file >${LIB}/$file.
1450 sed '/OPEN_MAX/s,/\* Max, Max,' < ${LIB}/$file.
>${LIB}/$file
1453 # These files in Sun OS 4.x use /**/ to concatenate tokens.
1454 for file in sparc
/asm_linkage.h sun
3/asm_linkage.h sun3x
/asm_linkage.h \
1455 sun
4/asm_linkage.h sun4c
/asm_linkage.h sun4m
/asm_linkage.h \
1456 sun4c
/debug
/asm_linkage.h sun4m
/debug
/asm_linkage.h
;
1458 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1459 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1460 chmod +w
${LIB}/$file 2>/dev
/null
1461 chmod a
+r
${LIB}/$file 2>/dev
/null
1464 if [ -r ${LIB}/$file ]; then
1465 sed -e 's|/\*\*/|##|g' ${LIB}/$file > ${LIB}/${file}.
sed
1466 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1467 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1473 # These files in ARM/RISCiX use /**/ to concatenate tokens.
1474 for file in arm
/as_support.h
arm
/mc_type.h
arm
/xcb.h dev
/chardefmac.h \
1475 dev
/ps_irq.h dev
/screen.h dev
/scsi.h sys
/tty.h Xm.acorn
/XmP.h
1477 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1478 cp $file ${LIB}/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
1479 chmod +w
${LIB}/$file 2>/dev
/null
1480 chmod a
+r
${LIB}/$file 2>/dev
/null
1483 if [ -r ${LIB}/$file ]; then
1484 sed -e 's|/\*\*/|##|g' ${LIB}/$file > ${LIB}/${file}.
sed
1485 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1486 if cmp $file ${LIB}/$file >/dev
/null
2>&1; then
1492 # This file on SunOS 4 has a very large macro. When the sed loop
1493 # tries pull it in, it overflows the pattern space size of the SunOS
1494 # sed (GNU sed does not have this problem). Since the file does not
1495 # require fixing, we remove it from the fixed directory.
1496 file=sundev
/ipi_error.h
1497 if [ -r ${LIB}/$file ]; then
1498 echo "Removing incorrect fix to SunOS <sundev/ipi_error.h>"
1502 echo 'Removing unneeded directories:'
1504 files
=`find . -type d -print | sort -r`
1505 for file in $files; do
1506 rmdir $LIB/$file > /dev
/null
2>&1
1510 echo 'Making internal symbolic non-directory links'
1512 files
=`find . -type l -print`
1513 for file in $files; do
1514 dest
=`ls -ld $file | sed -n 's/.*-> //p'`
1515 if expr "$dest" : '[^/].*' > /dev
/null
; then
1516 target
=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
1517 if [ -f $target ]; then
1518 ln -s $dest ${LIB}/$file >/dev
/null
2>&1
1524 # Make sure that any include files referenced using double quotes
1525 # exist in the fixed directory. This comes last since otherwise
1526 # we might end up deleting some of these files "because they don't
1528 while [ -n "$required" ]; do
1532 while [ $# != 0 ]; do
1533 # $1 is the directory to copy from, $2 is the unfixed file,
1534 # $3 is the fixed file name.
1537 if [ -r $2 ] && [ ! -r $3 ]; then
1538 cp $2 $3 >/dev
/null
2>&1 ||
echo "Can't copy $2"
1539 chmod +w
$3 2>/dev
/null
1540 chmod a
+r
$3 2>/dev
/null
1542 for include
in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
1543 dir
=`echo $2 | sed -e s'|/[^/]*$||'`
1544 dir2
=`echo $3 | sed -e s'|/[^/]*$||'`
1545 newreq
="$newreq $1 $dir/$include $dir2/$include"
1553 echo 'Cleaning up DONE files.'
1555 find .
-name DONE
-exec rm -f '{}' ';'