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 # This prevents /bin/ex from failing if the current terminal type is
17 # Directory in which to store the results.
18 LIB=${1?"fixincludes: output directory not specified"}
20 # Make sure it exists.
21 if [ ! -d $LIB ]; then
28 # Fail if no arg to specify a directory for the output.
30 then echo fixincludes: no output directory specified
34 echo 'Building fixincludes in ' ${LIB}
36 # Determine whether this system has symbolic links.
37 if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
38 rm -f $LIB/ShouldNotExist
44 echo 'Making directories:'
46 # Find all directories and all symlinks that point to directories.
47 # Put the list in $files.
48 # Each time we find a symlink, add it to newdirs
49 # so that we do another find within the dir the link points to.
50 # Note that $files may have duplicates in it;
51 # later parts of this file are supposed to ignore them.
64 # Find all directories under $d, relative to $d, including $d itself.
65 # Get rid of ./ at the end!
66 files="$files `find $d -type d -print | sed '/^.$/d' | sed '/\/\.$/ s|/\.$||'`"
68 newdirs="$newdirs `find $d -type l -exec test -d '{}' \; -print`"
79 for file in $files; do
81 if [ ! -d $LIB/$file ]
86 # treetops gets an alternating list
87 # of old directories to copy
88 # and the new directories to copy to.
89 treetops="${INPUT} ${LIB}"
92 echo 'Making internal symbolic directory links'
93 for file in $files; do
94 dest=`ls -ld $file | sed -n 's/.*-> //p'`
97 # In case $dest is relative, get to $file's dir first.
99 cd `echo ./$file | sed -n 's&[^/]*$&&p'`
100 # Check that the target directory exists.
101 # Redirections changed to avoid bug in sh on Ultrix.
102 (cd $dest) > /dev/null 2>&1
105 # X gets the dir that the link actually leads to.
107 # If link leads back into ${INPUT},
108 # make a similar link here.
109 if expr $x : "${INPUT}/.*" > /dev/null; then
110 # Y gets the actual target dir name, relative to ${INPUT}.
111 y=`echo $x | sed -n "s&${INPUT}/&&p"`
112 echo $file '->' $y ': Making link'
113 rm -fr ${LIB}/$file > /dev/null 2>&1
114 ln -s ${LIB}/$y ${LIB}/$file > /dev/null 2>&1
116 # If the link is to outside ${INPUT},
117 # treat this directory as if it actually contained the files.
118 # This line used to have $dest instead of $x.
119 # $dest seemed to be wrong for links found in subdirectories
120 # of ${INPUT}. Does this change break anything?
121 treetops="$treetops $x ${LIB}/$file"
130 while [ $# != 0 ]; do
131 # $1 is an old directory to copy, and $2 is the new directory to copy to.
132 echo "Finding header files in $1:"
135 files=`find . -name '*.h' -type f -print`
136 echo 'Checking header files:'
137 # Note that BSD43_* are used on recent MIPS systems.
138 for file in $files; do
139 # This call to egrep is essential, since checking a file with egrep
140 # is much faster than actually trying to fix it.
141 # It is also essential that most files *not* match!
142 # Thus, matching every #endif is unacceptable.
143 # But the argument to egrep must be kept small, or many versions of egrep
144 # won't be able to handle it.
145 # rms: I removed `|#[el].*if.*[^/ ]' because it made egrep fail.
146 if egrep '[ _]_IO|CTRL|#define.NULL|#[el]*if.*([0-9]|sparc|vax|sun|pyr)' $file > /dev/null; then
148 if [ -r $file ]; then
149 cp $file $2/$file >/dev/null 2>&1 \
150 || echo "Can't copy $file"
152 # Following two lines removed.
153 # s%^\([ ]*#[ ]*endif[ ]*\)\([^/ ].*\)$%\1/* \2 */%
154 # s%^\([ ]*#[ ]*else[ ]*\)\([^/ ].*\)$%\1/* \2 */%
160 /[ ]_IO[A-Z]*[ ]*(/ s/(\(.\),/('\''\1'\'',/
161 /[ ]BSD43__IO[A-Z]*[ ]*(/ s/(\(.\),/('\''\1'\'',/
162 /#define._IO/ s/'\''x'\''/x/g
163 /#define.BSD43__IO/ s/'\''x'\''/x/g
164 /[^A-Z]CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/
165 /#define.CTRL/ s/'\''c'\''/c/g
166 /#define._CTRL/ s/'\''c'\''/c/g
167 /#define.BSD43_CTRL/ s/'\''c'\''/c/g
168 /#[a-z]*if.*[ (]m68k/ s/\([^_]\)m68k/\1__m68k__/g
169 /#[a-z]*if.*[ (]__i386/ s/__i386/__i386__/g
170 /#[a-z]*if.*[ (]i386/ s/\([^_]\)i386/\1__i386__/g
171 /#[a-z]*if.*[ (]sparc/ s/\([^_]\)sparc/\1__sparc__/g
172 /#[a-z]*if.*[ (]mc68000/ s/\([^_]\)mc68000/\1__mc68000__/g
173 /#[a-z]*if.*[ (]vax/ s/\([^_]\)vax/\1__vax__/g
174 /#[a-z]*if.*[ (]sun/ s/\([^_]\)\(sun[a-z0-9]*\)\([^a-z0-9_]\)/\1__\2__\3/g
175 /#[a-z]*if.*[ (]sun/ s/\([^_]\)\(sun[a-z0-9]*\)$/\1__\2__/g
176 /#[a-z]*if.*[ (]ns32000/ s/\([^_]\)ns32000/\1__ns32000__/g
177 /#[a-z]*if.*[ (]pyr/ s/\([^_]\)pyr/\1__pyr__/g
178 /#[a-z]*if.*[ (]is68k/ s/\([^_]\)is68k/\1__is68k__/g
179 /^#define.NULL[ ]/ i\
181 ' $2/$file > $2/$file.sed
182 mv $2/$file.sed $2/$file
183 if cmp $file $2/$file >/dev/null 2>&1; then
184 echo Deleting $2/$file\; no fixes were needed.
195 # Fix one other error in this file: a mismatched quote not inside a C comment.
196 file=sundev/vuid_event.h
197 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
198 mkdir ${LIB}/sundev 2>/dev/null
199 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
200 chmod +w ${LIB}/$file 2>/dev/null
203 if [ -r ${LIB}/$file ]; then
204 echo Fixing $file comment
205 ex ${LIB}/$file <<EOF
206 g/doesn't/s/doesn't/does not/
209 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
210 echo Deleting ${LIB}/$file\; no fixes were needed.
215 # Fix this Sun file to avoid interfering with stddef.h.
217 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
218 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
219 chmod +w ${LIB}/$file 2>/dev/null
222 if [ -r ${LIB}/$file ]; then
224 ex ${LIB}/$file <<EOF
236 #ifndef _GCC_PTRDIFF_T
237 #define _GCC_PTRDIFF_T
254 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
255 echo Deleting ${LIB}/$file\; no fixes were needed.
260 # Fix this file to avoid interfering with stddef.h.
262 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
263 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
264 chmod +w ${LIB}/$file 2>/dev/null
267 if [ -r ${LIB}/$file ]; then
269 ex ${LIB}/$file <<EOF
281 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
282 echo Deleting ${LIB}/$file\; no fixes were needed.
287 # Fix an error in this file: a missing semi-colon at the end of the statsswtch
288 # structure definition.
290 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
291 mkdir ${LIB}/rpcsvc 2>/dev/null
292 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
293 chmod +w ${LIB}/$file 2>/dev/null
296 if [ -r ${LIB}/$file ]; then
297 echo Fixing $file, definition of statsswtch
298 ex ${LIB}/$file <<EOF
302 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
303 echo Deleting ${LIB}/$file\; no fixes were needed.
308 # Fix an error in this file: a missing semi-colon at the end of the nodeent
309 # structure definition.
310 file=netdnet/dnetdb.h
311 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
312 mkdir ${LIB}/netdnet 2>/dev/null
313 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
314 chmod +w ${LIB}/$file 2>/dev/null
317 if [ -r ${LIB}/$file ]; then
318 echo Fixing $file, definition of nodeent
319 ex ${LIB}/$file <<EOF
320 g/char.*na_addr *$/s//&;/
323 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
324 echo Deleting ${LIB}/$file\; no fixes were needed.
329 # Check for bad #ifdef line (in Ultrix 4.1)
331 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
332 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
333 chmod +w ${LIB}/$file 2>/dev/null
336 if [ -r ${LIB}/$file ]; then
337 echo Fixing $file, bad \#ifdef line
338 ex ${LIB}/$file <<EOF
339 g/^#ifdef KERNEL && !defined/
340 s/#ifdef KERNEL && !defined/#if defined(KERNEL) \&\& !defined/
343 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
344 echo Deleting ${LIB}/$file\; no fixes were needed.
349 # Remove nested comments created by #endifs in a comment (Ultrix 4.1)
350 # Only needed if commenting out junk after #endif.
352 #if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
353 # cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
354 # chmod +w ${LIB}/$file 2>/dev/null
357 #if [ -r ${LIB}/$file ]; then
358 # echo Fixing $file, nested comments
359 # sed -e 's/#endif.*/#endif/' ${LIB}/$file > ${LIB}/${file}.sed
360 # rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
361 # if cmp $file ${LIB}/$file >/dev/null 2>&1; then
362 # echo Deleting ${LIB}/$file\; no fixes were needed.
367 # Check for superfluous `static' (in Ultrix 4.2)
369 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
370 mkdir ${LIB}/machine 2>/dev/null
371 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
372 chmod +w ${LIB}/$file 2>/dev/null
375 if [ -r ${LIB}/$file ]; then
376 echo Fixing $file, superfluous static
377 ex ${LIB}/$file <<EOF
378 g/^static struct tlb_pid_state/
382 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
383 echo Deleting ${LIB}/$file\; no fixes were needed.
386 # This file has an alternative name, mips/cpu.h. Fix that name, too.
387 if cmp machine/cpu.h mips/cpu.h > /dev/null 2>& 1; then
388 mkdir ${LIB}/mips 2>&-
389 ln ${LIB}/$file ${LIB}/mips/cpu.h
394 # Incorrect sprintf declaration in X11/Xmu.h
396 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
397 mkdir ${LIB}/X11 2>/dev/null
398 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
399 chmod +w ${LIB}/$file 2>/dev/null
402 if [ -r ${LIB}/$file ]; then
403 echo Fixing $file sprintf declaration
404 ex ${LIB}/$file <<EOF
405 /^extern char \* sprintf();$/c
407 extern char * sprintf();
408 #endif /* !defined __STDC__ */
412 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
413 echo Deleting ${LIB}/$file\; no fixes were needed.
418 # Check for missing ';' in struct
420 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
421 mkdir ${LIB}/netinet 2>/dev/null
422 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
423 chmod +w ${LIB}/$file 2>/dev/null
426 if [ -r ${LIB}/$file ]; then
428 sed -e '/^struct/,/^};/s/}$/};/' ${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
431 echo Deleting ${LIB}/$file\; no fixes were needed.
436 # Fix the CAT macro in SunOS memvar.h.
437 file=pixrect/memvar.h
438 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
439 mkdir ${LIB}/pixrect 2>/dev/null
440 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
441 chmod +w ${LIB}/$file 2>/dev/null
444 if [ -r ${LIB}/$file ]; then
446 sed -e '/^#define.CAT(a,b)/ i\
448 #define CAT(a,b) a##b\
450 /^#define.CAT(a,b)/ a\
452 ' ${LIB}/$file > ${LIB}/${file}.sed
453 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
454 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
455 echo Deleting ${LIB}/$file\; no fixes were needed.
460 # Check for yet more missing ';' in struct (in SunOS 4.0.x)
462 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
463 mkdir ${LIB}/rpcsvc 2>/dev/null
464 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
465 chmod +w ${LIB}/$file 2>/dev/null
468 if [ -r ${LIB}/$file ]; then
470 sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' ${LIB}/$file > ${LIB}/${file}.sed
471 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
472 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
473 echo Deleting ${LIB}/$file\; no fixes were needed.
478 # Fix return type of exit and abort in <stdlib.h> on SunOS 4.1.
480 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
481 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
482 chmod +w ${LIB}/$file 2>/dev/null
485 if [ -r ${LIB}/$file ]; then
487 sed -e 's/int abort/void abort/g' \
488 -e 's/int free/void free/g' \
489 -e 's/char \* calloc/void \* calloc/g' \
490 -e 's/char \* malloc/void \* malloc/g' \
491 -e 's/char \* realloc/void \* realloc/g' \
492 -e 's/int exit/void exit/g' ${LIB}/$file > ${LIB}/${file}.sed
493 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
494 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
495 echo Deleting ${LIB}/$file\; no fixes were needed.
500 # Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
502 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
503 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
504 chmod +w ${LIB}/$file 2>/dev/null
507 if [ -r ${LIB}/$file ]; then
509 sed -e 's/typedef[ ]char \* malloc_t/typedef void \* malloc_t/g' \
510 -e 's/int[ ][ ]*free/void free/g' \
511 ${LIB}/$file > ${LIB}/${file}.sed
512 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
513 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
514 echo Deleting ${LIB}/$file\; no fixes were needed.
520 # Fix bogus comment in <locale.h> on SunOS 4.1.
522 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
523 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
524 chmod +w ${LIB}/$file 2>/dev/null
527 if [ -r ${LIB}/$file ]; then
529 sed -e 's%#endif / \*%#endif /\* %g' ${LIB}/$file > ${LIB}/${file}.sed
530 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
531 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
532 echo Deleting ${LIB}/$file\; no fixes were needed.
537 # Fix bogus #ifdef in <hsfs/hsfs_spec.h> on SunOS 4.1.
538 file=hsfs/hsfs_spec.h
539 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
540 mkdir ${LIB}/hsfs 2>/dev/null
541 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
542 chmod +w ${LIB}/$file 2>/dev/null
545 if [ -r ${LIB}/$file ]; then
547 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
548 ${LIB}/$file > ${LIB}/${file}.sed
549 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
550 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
551 echo Deleting ${LIB}/$file\; no fixes were needed.
556 # Fix bogus #ifdef in <hsfs/hsnode.h> on SunOS 4.1.
558 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
559 mkdir ${LIB}/hsfs 2>/dev/null
560 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
561 chmod +w ${LIB}/$file 2>/dev/null
564 if [ -r ${LIB}/$file ]; then
566 sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \
567 ${LIB}/$file > ${LIB}/${file}.sed
568 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
569 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
570 echo Deleting ${LIB}/$file\; no fixes were needed.
575 # Fix bogus #ifdef in <hsfs/iso_spec.h> on SunOS 4.1.
577 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
578 mkdir ${LIB}/hsfs 2>/dev/null
579 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
580 chmod +w ${LIB}/$file 2>/dev/null
583 if [ -r ${LIB}/$file ]; then
585 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
586 ${LIB}/$file > ${LIB}/${file}.sed
587 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
588 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
589 echo Deleting ${LIB}/$file\; no fixes were needed.
594 # Incorrect #include in Sony News-OS 3.2.
595 file=machine/machparam.h
596 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
597 mkdir ${LIB}/machine 2>/dev/null
598 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
599 chmod +w ${LIB}/$file 2>/dev/null
602 if [ -r ${LIB}/$file ]; then
603 echo Fixing $file, incorrect \#include
604 sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \
605 ${LIB}/$file > ${LIB}/${file}.sed
606 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
607 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
608 echo Deleting ${LIB}/$file\; no fixes were needed.
613 # Multiline comment after typedef on IRIX 4.0.1.
615 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
616 mkdir ${LIB}/sys 2>/dev/null
617 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
618 chmod +w ${LIB}/$file 2>/dev/null
621 if [ -r ${LIB}/$file ]; then
622 echo Fixing $file, comment in the middle of \#ifdef
623 sed -e 's@type of the result@type of the result */@' \
624 -e 's@of the sizeof@/* of the sizeof@' \
625 ${LIB}/$file > ${LIB}/${file}.sed
626 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
627 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
628 echo Deleting ${LIB}/$file\; no fixes were needed.
633 # Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
634 # declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because
635 # many other systems have similar text but correct versions of the file.
636 # To ensure only Sun's is fixed, we grep for a likely unique string.
638 if egrep '/\* @\(#\)memory.h 1.4 88/08/19 SMI; from S5R2 1.2 \*/' $file > /dev/null; then
639 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
640 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
641 chmod +w ${LIB}/$file 2>/dev/null
643 if [ -r ${LIB}/$file ]; then
645 cat > ${LIB}/$file << EOF
646 /* This file was generated by fixincludes */
651 extern void *memccpy();
652 extern void *memchr();
653 extern void *memcpy();
654 extern void *memset();
656 extern char *memccpy();
657 extern char *memchr();
658 extern char *memcpy();
659 extern char *memset();
660 #endif /* __STDC__ */
669 # parameters not const on DECstation Ultrix V4.0.
671 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
672 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
673 chmod +w ${LIB}/$file 2>/dev/null
676 if [ -r ${LIB}/$file ]; then
677 echo Fixing $file, non-const arg
678 sed -e 's@perror( char \*__s );@perror( const char *__s );@' \
679 -e 's@fputs( char \*__s,@fputs( const char *__s,@' \
680 -e 's@fopen( char \*__filename, char \*__type );@fopen( const char *__filename, const char *__type );@' \
681 -e 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@' \
682 -e 's@fscanf( FILE \*__stream, char \*__format,@fscanf( FILE *__stream, const char *__format,@' \
683 -e 's@scanf( char \*__format,@scanf( const char *__format,@' \
684 -e 's@sscanf( char \*__s, char \*__format,@sscanf( const char *__s, const char *__format,@' \
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
688 echo Deleting ${LIB}/$file\; no fixes were needed.
693 # parameter to atof not const on DECstation Ultrix V4.0.
695 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
696 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
697 chmod +w ${LIB}/$file 2>/dev/null
700 if [ -r ${LIB}/$file ]; then
701 echo Fixing $file, non-const arg
702 sed -e 's@atof( char \*__nptr );@atof( const char *__nptr );@' \
703 ${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
706 echo Deleting ${LIB}/$file\; no fixes were needed.
711 # These two files on SunOS 4 are included by other files
712 # in the same directory, using "...". So we must make sure they exist
713 # in the same directory as the other fixed files.
714 if [ -r ${INPUT}/multimedia/audio_errno.h ]
716 ln -s ${INPUT}/multimedia/audio_errno.h ${LIB}/multimedia 2>/dev/null
718 if [ -r ${INPUT}/multimedia/audio_hdr.h ]
720 ln -s ${INPUT}/multimedia/audio_hdr.h ${LIB}/multimedia 2>/dev/null
723 echo 'Removing unneeded directories:'
725 files=`find . -type d -print | sort -r`
726 for file in $files; do
727 rmdir $LIB/$file > /dev/null 2>&1
731 echo 'Making internal symbolic non-directory links'
733 files=`find . -type l -print`
734 for file in $files; do
735 dest=`ls -ld $file | sed -n 's/.*-> //p'`
736 if expr "$dest" : '[^/].*' > /dev/null; then
737 target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
738 if [ -f $target ]; then
739 ln -s $dest ${LIB}/$file >/dev/null 2>&1