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-${LIB-/usr/local/lib/gcc-include}}
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 files=` find . -type d -print | sed '/^.$/d'
48 $LINKS && find . -type l -exec test -d '{}' \; -print`
49 for file in $files; do
51 if [ ! -d $LIB/$file ]
56 # treetops gets an alternating list
57 # of old directories to copy
58 # and the new directories to copy to.
59 treetops="${INPUT} ${LIB}"
62 echo 'Making internal symbolic directory links'
63 for file in $files; do
64 dest=`ls -ld $file | sed -n 's/.*-> //p'`
67 # In case $dest is relative, get to $file's dir first.
69 cd `echo ./$file | sed -n 's&[^/]*$&&p'`
70 # Check that the target directory exists.
71 # Redirections changed to avoid bug in sh on Ultrix.
72 (cd $dest) > /dev/null 2>&1
75 # X gets the dir that the link actually leads to.
77 # If link leads back into ${INPUT},
78 # make a similar link here.
79 if expr $x : "${INPUT}/.*" > /dev/null; then
80 # Y gets the actual target dir name, relative to ${INPUT}.
81 y=`echo $x | sed -n "s&${INPUT}/&&p"`
82 echo $file '->' $y ': Making link'
83 rm -fr ${LIB}/$file > /dev/null 2>&1
84 ln -s ${LIB}/$y ${LIB}/$file > /dev/null 2>&1
86 # If the link is to outside ${INPUT},
87 # treat this directory as if it actually contained the files.
88 # This line used to have $dest instead of $x.
89 # $dest seemed to be wrong for links found in subdirectories
90 # of ${INPUT}. Does this change break anything?
91 treetops="$treetops $x ${LIB}/$file"
100 while [ $# != 0 ]; do
101 # $1 is an old directory to copy, and $2 is the new directory to copy to.
102 echo "Finding header files in $1:"
105 files=`find . -name '*.h' -type f -print`
106 echo 'Checking header files:'
107 # Note that BSD43_* are used on recent MIPS systems.
108 for file in $files; do
109 # This call to egrep is essential, since checking a file with egrep
110 # is much faster than actually trying to fix it.
111 # It is also essential that most files *not* match!
112 # Thus, matching every #endif is unacceptable.
113 # But the argument to egrep must be kept small, or many versions of egrep
114 # won't be able to handle it.
115 # rms: I removed `|#[el].*if.*[^/ ]' because it made egrep fail.
116 if egrep '[ _]_IO|CTRL|#define.NULL|#[el]*if.*([0-9]|sparc|vax|sun|pyr)' $file > /dev/null; then
118 if [ -r $file ]; then
119 cp $file $2/$file >/dev/null 2>&1 \
120 || echo "Can't copy $file"
122 # Following two lines removed.
123 # s%^\([ ]*#[ ]*endif[ ]*\)\([^/ ].*\)$%\1/* \2 */%
124 # s%^\([ ]*#[ ]*else[ ]*\)\([^/ ].*\)$%\1/* \2 */%
130 /[ ]_IO[A-Z]*[ ]*(/ s/(\(.\),/('\''\1'\'',/
131 /[ ]BSD43__IO[A-Z]*[ ]*(/ s/(\(.\),/('\''\1'\'',/
132 /#define._IO/ s/'\''x'\''/x/g
133 /#define.BSD43__IO/ s/'\''x'\''/x/g
134 /[^A-Z]CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/
135 /#define.CTRL/ s/'\''c'\''/c/g
136 /#define._CTRL/ s/'\''c'\''/c/g
137 /#define.BSD43_CTRL/ s/'\''c'\''/c/g
138 /#[a-z]*if.*[ (]m68k/ s/\([^_]\)m68k/\1__m68k__/g
139 /#[a-z]*if.*[ (]__i386/ s/__i386/__i386__/g
140 /#[a-z]*if.*[ (]i386/ s/\([^_]\)i386/\1__i386__/g
141 /#[a-z]*if.*[ (]sparc/ s/\([^_]\)sparc/\1__sparc__/g
142 /#[a-z]*if.*[ (]mc68000/ s/\([^_]\)mc68000/\1__mc68000__/g
143 /#[a-z]*if.*[ (]vax/ s/\([^_]\)vax/\1__vax__/g
144 /#[a-z]*if.*[ (]sun/ s/\([^_]\)\(sun[a-z0-9]*\)\([^a-z0-9_]\)/\1__\2__\3/g
145 /#[a-z]*if.*[ (]sun/ s/\([^_]\)\(sun[a-z0-9]*\)$/\1__\2__/g
146 /#[a-z]*if.*[ (]ns32000/ s/\([^_]\)ns32000/\1__ns32000__/g
147 /#[a-z]*if.*[ (]pyr/ s/\([^_]\)pyr/\1__pyr__/g
148 /#[a-z]*if.*[ (]is68k/ s/\([^_]\)is68k/\1__is68k__/g
149 /^#define.NULL[ ]/ i\
151 ' $2/$file > $2/$file.sed
152 mv $2/$file.sed $2/$file
153 if cmp $file $2/$file >/dev/null 2>&1; then
154 echo Deleting $2/$file\; no fixes were needed.
165 # Fix one other error in this file: a mismatched quote not inside a C comment.
166 file=sundev/vuid_event.h
167 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
168 mkdir ${LIB}/sundev 2>/dev/null
169 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
170 chmod +w ${LIB}/$file 2>/dev/null
173 if [ -r ${LIB}/$file ]; then
174 echo Fixing $file comment
175 ex ${LIB}/$file <<EOF
176 g/doesn't/s/doesn't/does not/
179 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
180 echo Deleting ${LIB}/$file\; no fixes were needed.
185 # Fix this Sun file to avoid interfering with stddef.h.
187 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
188 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
189 chmod +w ${LIB}/$file 2>/dev/null
192 if [ -r ${LIB}/$file ]; then
194 ex ${LIB}/$file <<EOF
206 #ifndef _GCC_PTRDIFF_T
207 #define _GCC_PTRDIFF_T
224 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
225 echo Deleting ${LIB}/$file\; no fixes were needed.
230 # Fix this file to avoid interfering with stddef.h.
232 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
233 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
234 chmod +w ${LIB}/$file 2>/dev/null
237 if [ -r ${LIB}/$file ]; then
239 ex ${LIB}/$file <<EOF
251 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
252 echo Deleting ${LIB}/$file\; no fixes were needed.
257 # Fix an error in this file: a missing semi-colon at the end of the statsswtch
258 # structure definition.
260 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
261 mkdir ${LIB}/rpcsvc 2>/dev/null
262 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
263 chmod +w ${LIB}/$file 2>/dev/null
266 if [ -r ${LIB}/$file ]; then
267 echo Fixing $file, definition of statsswtch
268 ex ${LIB}/$file <<EOF
272 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
273 echo Deleting ${LIB}/$file\; no fixes were needed.
278 # Fix an error in this file: a missing semi-colon at the end of the nodeent
279 # structure definition.
280 file=netdnet/dnetdb.h
281 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
282 mkdir ${LIB}/netdnet 2>/dev/null
283 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
284 chmod +w ${LIB}/$file 2>/dev/null
287 if [ -r ${LIB}/$file ]; then
288 echo Fixing $file, definition of nodeent
289 ex ${LIB}/$file <<EOF
290 g/char.*na_addr *$/s//&;/
293 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
294 echo Deleting ${LIB}/$file\; no fixes were needed.
299 # Check for bad #ifdef line (in Ultrix 4.1)
301 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
302 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
303 chmod +w ${LIB}/$file 2>/dev/null
306 if [ -r ${LIB}/$file ]; then
307 echo Fixing $file, bad \#ifdef line
308 ex ${LIB}/$file <<EOF
309 g/^#ifdef KERNEL && !defined/
310 s/#ifdef KERNEL && !defined/#if defined(KERNEL) \&\& !defined/
313 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
314 echo Deleting ${LIB}/$file\; no fixes were needed.
319 # Remove nested comments created by #endifs in a comment (Ultrix 4.1)
320 # Only needed if commenting out junk after #endif.
322 #if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
323 # cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
324 # chmod +w ${LIB}/$file 2>/dev/null
327 #if [ -r ${LIB}/$file ]; then
328 # echo Fixing $file, nested comments
329 # sed -e 's/#endif.*/#endif/' ${LIB}/$file > ${LIB}/${file}.sed
330 # rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
331 # if cmp $file ${LIB}/$file >/dev/null 2>&1; then
332 # echo Deleting ${LIB}/$file\; no fixes were needed.
337 # Check for superfluous `static' (in Ultrix 4.2)
339 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
340 mkdir ${LIB}/machine 2>/dev/null
341 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
342 chmod +w ${LIB}/$file 2>/dev/null
345 if [ -r ${LIB}/$file ]; then
346 echo Fixing $file, superfluous static
347 ex ${LIB}/$file <<EOF
348 g/^static struct tlb_pid_state/
352 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
353 echo Deleting ${LIB}/$file\; no fixes were needed.
356 # This file has an alternative name, mips/cpu.h. Fix that name, too.
357 if cmp machine/cpu.h mips/cpu.h > /dev/null 2>& 1; then
358 mkdir ${LIB}/mips 2>&-
359 ln ${LIB}/$file ${LIB}/mips/cpu.h
364 # Incorrect sprintf declaration in X11/Xmu.h
366 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
367 mkdir ${LIB}/X11 2>/dev/null
368 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
369 chmod +w ${LIB}/$file 2>/dev/null
372 if [ -r ${LIB}/$file ]; then
373 echo Fixing $file sprintf declaration
374 ex ${LIB}/$file <<EOF
375 /^extern char \* sprintf();$/c
377 extern char * sprintf();
378 #endif /* !defined __STDC__ */
382 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
383 echo Deleting ${LIB}/$file\; no fixes were needed.
388 # Check for missing ';' in struct
390 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
391 mkdir ${LIB}/netinet 2>/dev/null
392 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
393 chmod +w ${LIB}/$file 2>/dev/null
396 if [ -r ${LIB}/$file ]; then
398 sed -e '/^struct/,/^};/s/}$/};/' ${LIB}/$file > ${LIB}/${file}.sed
399 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
400 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
401 echo Deleting ${LIB}/$file\; no fixes were needed.
406 # Fix the CAT macro in SunOS memvar.h.
407 file=pixrect/memvar.h
408 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
409 mkdir ${LIB}/pixrect 2>/dev/null
410 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
411 chmod +w ${LIB}/$file 2>/dev/null
414 if [ -r ${LIB}/$file ]; then
416 sed -e '/^#define.CAT(a,b)/ i\
418 #define CAT(a,b) a##b\
420 /^#define.CAT(a,b)/ a\
422 ' ${LIB}/$file > ${LIB}/${file}.sed
423 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
424 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
425 echo Deleting ${LIB}/$file\; no fixes were needed.
430 # Check for yet more missing ';' in struct (in SunOS 4.0.x)
432 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
433 mkdir ${LIB}/rpcsvc 2>/dev/null
434 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
435 chmod +w ${LIB}/$file 2>/dev/null
438 if [ -r ${LIB}/$file ]; then
440 sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' ${LIB}/$file > ${LIB}/${file}.sed
441 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
442 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
443 echo Deleting ${LIB}/$file\; no fixes were needed.
448 # Fix return type of exit and abort in <stdlib.h> on SunOS 4.1.
450 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
451 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
452 chmod +w ${LIB}/$file 2>/dev/null
455 if [ -r ${LIB}/$file ]; then
457 sed -e 's/int abort/void abort/g' \
458 -e 's/int free/void free/g' \
459 -e 's/char \* calloc/void \* calloc/g' \
460 -e 's/char \* malloc/void \* malloc/g' \
461 -e 's/char \* realloc/void \* realloc/g' \
462 -e 's/int exit/void exit/g' ${LIB}/$file > ${LIB}/${file}.sed
463 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
464 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
465 echo Deleting ${LIB}/$file\; no fixes were needed.
470 # Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
472 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
473 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
474 chmod +w ${LIB}/$file 2>/dev/null
477 if [ -r ${LIB}/$file ]; then
479 sed -e 's/typedef[ ]char \* malloc_t/typedef void \* malloc_t/g' \
480 -e 's/int[ ][ ]*free/void free/g' \
481 ${LIB}/$file > ${LIB}/${file}.sed
482 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
483 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
484 echo Deleting ${LIB}/$file\; no fixes were needed.
490 # Fix bogus comment in <locale.h> on SunOS 4.1.
492 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
493 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
494 chmod +w ${LIB}/$file 2>/dev/null
497 if [ -r ${LIB}/$file ]; then
499 sed -e 's%#endif / \*%#endif /\* %g' ${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
502 echo Deleting ${LIB}/$file\; no fixes were needed.
507 # Fix bogus #ifdef in <hsfs/hsfs_spec.h> on SunOS 4.1.
508 file=hsfs/hsfs_spec.h
509 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
510 mkdir ${LIB}/hsfs 2>/dev/null
511 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
512 chmod +w ${LIB}/$file 2>/dev/null
515 if [ -r ${LIB}/$file ]; then
517 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
518 ${LIB}/$file > ${LIB}/${file}.sed
519 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
520 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
521 echo Deleting ${LIB}/$file\; no fixes were needed.
526 # Fix bogus #ifdef in <hsfs/hsnode.h> on SunOS 4.1.
528 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
529 mkdir ${LIB}/hsfs 2>/dev/null
530 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
531 chmod +w ${LIB}/$file 2>/dev/null
534 if [ -r ${LIB}/$file ]; then
536 sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \
537 ${LIB}/$file > ${LIB}/${file}.sed
538 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
539 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
540 echo Deleting ${LIB}/$file\; no fixes were needed.
545 # Fix bogus #ifdef in <hsfs/iso_spec.h> on SunOS 4.1.
547 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
548 mkdir ${LIB}/hsfs 2>/dev/null
549 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
550 chmod +w ${LIB}/$file 2>/dev/null
553 if [ -r ${LIB}/$file ]; then
555 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
556 ${LIB}/$file > ${LIB}/${file}.sed
557 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
558 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
559 echo Deleting ${LIB}/$file\; no fixes were needed.
564 # Incorrect #include in Sony News-OS 3.2.
565 file=machine/machparam.h
566 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
567 mkdir ${LIB}/machine 2>/dev/null
568 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
569 chmod +w ${LIB}/$file 2>/dev/null
572 if [ -r ${LIB}/$file ]; then
573 echo Fixing $file, incorrect \#include
574 sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \
575 ${LIB}/$file > ${LIB}/${file}.sed
576 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
577 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
578 echo Deleting ${LIB}/$file\; no fixes were needed.
583 # Multiline comment after typedef on IRIX 4.0.1.
585 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
586 mkdir ${LIB}/sys 2>/dev/null
587 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
588 chmod +w ${LIB}/$file 2>/dev/null
591 if [ -r ${LIB}/$file ]; then
592 echo Fixing $file, comment in the middle of \#ifdef
593 sed -e 's@type of the result@type of the result */@' \
594 -e 's@of the sizeof@/* of the sizeof@' \
595 ${LIB}/$file > ${LIB}/${file}.sed
596 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
597 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
598 echo Deleting ${LIB}/$file\; no fixes were needed.
603 # Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
604 # declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because
605 # many other systems have similar text but correct versions of the file.
606 # To ensure only Sun's is fixed, we grep for a likely unique string.
608 if egrep '/\* @\(#\)memory.h 1.4 88/08/19 SMI; from S5R2 1.2 \*/' $file > /dev/null; then
609 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
610 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
611 chmod +w ${LIB}/$file 2>/dev/null
613 if [ -r ${LIB}/$file ]; then
615 cat > ${LIB}/$file << EOF
616 /* This file was generated by fixincludes */
621 extern void *memccpy();
622 extern void *memchr();
623 extern void *memcpy();
624 extern void *memset();
626 extern char *memccpy();
627 extern char *memchr();
628 extern char *memcpy();
629 extern char *memset();
630 #endif /* __STDC__ */
639 # parameters not const on DECstation Ultrix V4.0.
641 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
642 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
643 chmod +w ${LIB}/$file 2>/dev/null
646 if [ -r ${LIB}/$file ]; then
647 echo Fixing $file, non-const arg
648 sed -e 's@perror( char \*__s );@perror( const char *__s );@' \
649 -e 's@fputs( char \*__s,@fputs( const char *__s,@' \
650 -e 's@fopen( char \*__filename, char \*__type );@fopen( const char *__filename, const char *__type );@' \
651 -e 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@' \
652 -e 's@fscanf( FILE \*__stream, char \*__format,@fscanf( FILE *__stream, const char *__format,@' \
653 -e 's@scanf( char \*__format,@scanf( const char *__format,@' \
654 -e 's@sscanf( char \*__s, char \*__format,@sscanf( const char *__s, const char *__format,@' \
655 ${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
658 echo Deleting ${LIB}/$file\; no fixes were needed.
663 # parameter to atof not const on DECstation Ultrix V4.0.
665 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
666 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
667 chmod +w ${LIB}/$file 2>/dev/null
670 if [ -r ${LIB}/$file ]; then
671 echo Fixing $file, non-const arg
672 sed -e 's@atof( char \*__nptr );@atof( const char *__nptr );@' \
673 ${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
676 echo Deleting ${LIB}/$file\; no fixes were needed.
681 # These two files on SunOS 4 are included by other files
682 # in the same directory, using "...". So we must make sure they exist
683 # in the same directory as the fixed other files.
684 if [ -r ${LIB}/multimedia/audio_errno.h ]
686 ln -s ${LIB}/multimedia/audio_errno.h multimedia 2>/dev/null
688 if [ -r ${LIB}/multimedia/audio_hdr.h ]
690 ln -s ${LIB}/multimedia/audio_hdr.h multimedia 2>/dev/null
693 echo 'Removing unneeded directories:'
695 files=`find . -type d -print | sort -r`
696 for file in $files; do
697 rmdir $LIB/$file > /dev/null 2>&1
701 echo 'Making internal symbolic non-directory links'
703 files=`find . -type l -print`
704 for file in $files; do
705 dest=`ls -ld $file | sed -n 's/.*-> //p'`
706 if expr "$dest" : '[^/].*' > /dev/null; then
707 target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
708 if [ -f $target ]; then
709 ln -s $dest ${LIB}/$file >/dev/null 2>&1