3 # fixinc.svr4 -- Install modified versions of certain ANSI-incompatible
4 # native System V Release 4 system include files.
6 # Written by Ron Guilmette (rfg@ncd.com).
8 # This file is part of GNU CC.
10 # GNU CC is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2, or (at your option)
15 # GNU CC is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with GNU CC; see the file COPYING. If not, write to
22 # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24 # This script munges the native include files provided with System V
25 # Release 4 systems so as to remove things which are violations of the
26 # ANSI C standard. Once munged, the resulting new system include files
27 # are placed in a directory that GNU C will search *before* searching
28 # the /usr/include directory. This script should work properly for most
29 # System V Release 4 systems. For other types of systems, you should
30 # use the `fixincludes' script instead.
32 # See README-fixinc for more information.
34 # Directory containing the original header files.
35 INPUT
=${2-${INPUT-/usr/include}}
37 # Fail if no arg to specify a directory for the output.
39 then echo fixincludes
: no output directory specified
43 # Directory in which to store the results.
44 LIB
=${1-${LIB-/usr/local/lib/gcc-include}}
46 # Make sure it exists.
47 if [ ! -d $LIB ]; then
56 # This prevents /bin/ex from failing if the current terminal type is
61 echo 'Building fixincludes in ' ${LIB}
63 # Determine whether this filesystem has symbolic links.
64 if ln -s X
$LIB/ShouldNotExist
2>/dev
/null
; then
65 rm -f $LIB/ShouldNotExist
71 echo 'Making directories:'
74 files
=`ls -LR | sed -n s/:$//p`
76 files
=`find . -type d -print | sed '/^.$/d'`
78 for file in $files; do
80 if [ ! -d $LIB/$file ]
85 # treetops gets an alternating list
86 # of old directories to copy
87 # and the new directories to copy to.
88 treetops
="${INPUT} ${LIB}"
91 echo 'Making internal symbolic directory links'
92 for file in $files; do
93 dest
=`ls -ld $file | sed -n 's/.*-> //p'`
96 # In case $dest is relative, get to $file's dir first.
98 cd `echo ./$file | sed -n 's&[^/]*$&&p'`
99 # Check that the target directory exists.
100 # Redirections changed to avoid bug in sh on Ultrix.
101 (cd $dest) > /dev
/null
2>&1
104 # X gets the dir that the link actually leads to.
106 # If link leads back into ${INPUT},
107 # make a similar link here.
108 if expr $x : "${INPUT}/.*" > /dev
/null
; then
109 # Y gets the actual target dir name, relative to ${INPUT}.
110 y
=`echo $x | sed -n "s&${INPUT}/&&p"`
111 echo $file '->' $y ': Making link'
112 rm -fr ${LIB}/$file > /dev
/null
2>&1
113 ln -s ${LIB}/$y ${LIB}/$file > /dev
/null
2>&1
115 # If the link is to outside ${INPUT},
116 # treat this directory as if it actually contained the files.
117 # This line used to have $dest instead of $x.
118 # $dest seemed to be wrong for links found in subdirectories
119 # of ${INPUT}. Does this change break anything?
120 treetops
="$treetops $x ${LIB}/$file"
129 while [ $# != 0 ]; do
130 # $1 is an old directory to copy, and $2 is the new directory to copy to.
131 echo "Finding header files in $1:"
134 files
=`find . -name '*.h' -type f -print`
135 echo 'Checking header files:'
136 for file in $files; do
138 if [ -r $file ]; then
139 cp $file $2/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
142 # The following have been removed from the sed command below
143 # because it is more useful to leave these things in.
144 # The only reason to remove them was for -pedantic,
145 # which isn't much of a reason. -- rms.
148 # The change of u_char, etc, to u_int
149 # applies to bit fields.
151 s%^\([ ]*#[ ]*endif[ ]*\)\([^/ ].*\)$%\1/* \2 */%
152 s%^\([ ]*#[ ]*else[ ]*\)\([^/ ].*\)$%\1/* \2 */%
153 s/#lint(on)/defined(lint)/g
154 s/#lint(off)/!defined(lint)/g
155 s/#machine(\([^)]*\))/defined(__\1__)/g
156 s/#system(\([^)]*\))/defined(__\1__)/g
157 s/#cpu(\([^)]*\))/defined(__\1__)/g
158 /#[a-z]*if.*[ (]m68k/ s/\([^_]\)m68k/\1__m68k__/g
159 /#[a-z]*if.*[ (]__i386\([^_]\)/ s/__i386/__i386__/g
160 /#[a-z]*if.*[ (]i386/ s/\([^_]\)i386/\1__i386__/g
161 /#[a-z]*if.*[ (]sparc/ s/\([^_]\)sparc/\1__sparc__/g
162 /#[a-z]*if.*[ (]mc68000/ s/\([^_]\)mc68000/\1__mc68000__/g
163 /#[a-z]*if.*[ (]vax/ s/\([^_]\)vax/\1__vax__/g
164 /#[a-z]*if.*[ (]sun/ s/\([^_]\)\(sun[a-z0-9]*\)\([^a-z0-9_]\)/\1__\2__\3/g
165 /#[a-z]*if.*[ (]sun/ s/\([^_]\)\(sun[a-z0-9]*\)$/\1__\2__/g
166 /#[a-z]*if.*[ (]ns32000/ s/\([^_]\)ns32000/\1__ns32000__/g
167 /#[a-z]*if.*[ (]pyr/ s/\([^_]\)pyr/\1__pyr__/g
168 /#[a-z]*if.*[ (]is68k/ s/\([^_]\)is68k/\1__is68k__/g
169 s/u_char\([ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[ ]*:[ ]*[0-9][0-9]*\)/u_int\1/
170 s/u_short\([ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[ ]*:[ ]*[0-9][0-9]*\)/u_int\1/
171 s/ushort\([ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[ ]*:[ ]*[0-9][0-9]*\)/u_int\1/
172 s/evcm_t\([ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[ ]*:[ ]*[0-9][0-9]*\)/u_int\1/
173 s/Pbyte\([ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[ ]*:[ ]*SEQSIZ\)/unsigned int\1/
174 s/__STDC__ == 0/!defined (__STRICT_ANSI__)/g
175 s/__STDC__ != 0/defined (__STRICT_ANSI__)/g
176 s/__STDC__ - 0 == 0/!defined (__STRICT_ANSI__)/g
177 ' $2/$file > $2/$file.
sed
178 mv $2/$file.
sed $2/$file
179 if cmp $file $2/$file >/dev
/null
2>&1; then
180 echo Deleting
$2/$file\
; no fixes were needed.
188 # Fix first broken decl of getcwd present on some svr4 systems.
191 base
=`basename $file`
192 if [ -r ${LIB}/$file ]; then
193 file_to_fix
=${LIB}/$file
195 if [ -r ${INPUT}/$file ]; then
196 file_to_fix
=${INPUT}/$file
201 if [ \
! -z "$file_to_fix" ]; then
202 echo Checking
$file_to_fix
203 sed -e 's/getcwd(char \*, int)/getcwd(char *, size_t)/' $file_to_fix > /tmp
/$base
204 if cmp $file_to_fix /tmp
/$base >/dev
/null
2>&1; then \
205 echo No change needed
in $file_to_fix
207 echo Fixed
$file_to_fix
209 cp /tmp
/$base ${LIB}/$file
214 # Fix second broken decl of getcwd present on some svr4 systems. Also
215 # fix the incorrect decl of profil present on some svr4 systems.
218 base
=`basename $file`
219 if [ -r ${LIB}/$file ]; then
220 file_to_fix
=${LIB}/$file
222 if [ -r ${INPUT}/$file ]; then
223 file_to_fix
=${INPUT}/$file
228 if [ \
! -z "$file_to_fix" ]; then
229 echo Checking
$file_to_fix
230 sed -e 's/getcwd(char \*, int)/getcwd(char *, size_t)/' $file_to_fix \
231 |
sed -e 's/profil(unsigned short \*, unsigned int, unsigned int, unsigned int)/profil(unsigned short *, size_t, int, unsigned)/' > /tmp
/$base
232 if cmp $file_to_fix /tmp
/$base >/dev
/null
2>&1; then \
233 echo No change needed
in $file_to_fix
235 echo Fixed
$file_to_fix
237 cp /tmp
/$base ${LIB}/$file
242 # Fix the definition of NULL in <sys/param.h> so that it is conditional
243 # and so that it is correct for both C and C++.
246 base
=`basename $file`
247 if [ -r ${LIB}/$file ]; then
248 file_to_fix
=${LIB}/$file
250 if [ -r ${INPUT}/$file ]; then
251 file_to_fix
=${INPUT}/$file
256 if [ \
! -z "$file_to_fix" ]; then
257 echo Checking
$file_to_fix
258 cp $file_to_fix /tmp
/$base
261 /^#define[ ]*NULL[ ]*0$/c
265 #else /* !defined(__cplusplus) */
266 #define __NULL_TYPE (void *)
267 #endif /* !defined(__cplusplus) */
268 #define NULL (__NULL_TYPE 0)
269 #endif /* !defined(NULL) */
273 if cmp $file_to_fix /tmp
/$base >/dev
/null
2>&1; then \
274 echo No change needed
in $file_to_fix
276 echo Fixed
$file_to_fix
278 cp /tmp
/$base ${LIB}/$file
283 # Likewise fix the definition of NULL in <stdio.h> so that it is conditional
284 # and so that it is correct for both C and C++.
287 base
=`basename $file`
288 if [ -r ${LIB}/$file ]; then
289 file_to_fix
=${LIB}/$file
291 if [ -r ${INPUT}/$file ]; then
292 file_to_fix
=${INPUT}/$file
297 if [ \
! -z "$file_to_fix" ]; then
298 echo Checking
$file_to_fix
299 cp $file_to_fix /tmp
/$base
302 /^#define[ ]*NULL[ ]*0$/c
305 #else /* !defined(__cplusplus) */
306 #define __NULL_TYPE (void *)
307 #endif /* !defined(__cplusplus) */
308 #define NULL (__NULL_TYPE 0)
312 if cmp $file_to_fix /tmp
/$base >/dev
/null
2>&1; then \
313 echo No change needed
in $file_to_fix
315 echo Fixed
$file_to_fix
317 cp /tmp
/$base ${LIB}/$file
322 # Likewise fix the definition of NULL in <dbm.h> so that it is conditional
323 # and so that it is correct for both C and C++.
326 base
=`basename $file`
327 if [ -r ${LIB}/$file ]; then
328 file_to_fix
=${LIB}/$file
330 if [ -r ${INPUT}/$file ]; then
331 file_to_fix
=${INPUT}/$file
336 if [ \
! -z "$file_to_fix" ]; then
337 echo Checking
$file_to_fix
338 cp $file_to_fix /tmp
/$base
341 /^#define[ ]*NULL[ ]*((char \*) 0)$/c
345 #else /* !defined(__cplusplus) */
346 #define __NULL_TYPE (void *)
347 #endif /* !defined(__cplusplus) */
348 #define NULL (__NULL_TYPE 0)
349 #endif /* !defined(NULL) */
353 if cmp $file_to_fix /tmp
/$base >/dev
/null
2>&1; then \
354 echo No change needed
in $file_to_fix
356 echo Fixed
$file_to_fix
358 cp /tmp
/$base ${LIB}/$file
363 # Add some missing declarations to <sys/mman.h>.
366 base
=`basename $file`
367 if [ -r ${LIB}/$file ]; then
368 file_to_fix
=${LIB}/$file
370 if [ -r ${INPUT}/$file ]; then
371 file_to_fix
=${INPUT}/$file
376 if [ \
! -z "$file_to_fix" ]; then
377 echo Checking
$file_to_fix
378 cp $file_to_fix /tmp
/$base
381 /^extern caddr_t mmap();$/c
383 extern caddr_t mmap (caddr_t addr, size_t len, int prot, int flags,
385 #else /* !defined(__STDC__) */
386 extern caddr_t mmap ();
387 #endif /* !defined(__STDC__) */
391 if cmp $file_to_fix /tmp
/$base >/dev
/null
2>&1; then \
392 echo No changed needed
in $file_to_fix
394 echo Fixed
$file_to_fix
396 cp /tmp
/$base ${LIB}/$file
401 # Fix declarations of `ftw' and `nftw' in <ftw.h>.
404 base
=`basename $file`
405 if [ -r ${LIB}/$file ]; then
406 file_to_fix
=${LIB}/$file
408 if [ -r ${INPUT}/$file ]; then
409 file_to_fix
=${INPUT}/$file
414 if [ \
! -z "$file_to_fix" ]; then
415 echo Checking
$file_to_fix
416 cp $file_to_fix /tmp
/$base
419 /^extern int ftw(const/c
420 #if !defined(_STYPES)
425 int ftw(const char *, int (*)(const char *, const struct stat *, int), int);
433 int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *),int, int);
435 /^extern int ftw(),/c
436 #if !defined(_STYPES)
451 if cmp $file_to_fix /tmp
/$base >/dev
/null
2>&1; then \
452 echo No change needed
in $file_to_fix
454 echo Fixed
$file_to_fix
456 cp /tmp
/$base ${LIB}/$file
461 # Add a `static' declaration of `getrnge' into <regexp.h>.
464 base
=`basename $file`
465 if [ -r ${LIB}/$file ]; then
466 file_to_fix
=${LIB}/$file
468 if [ -r ${INPUT}/$file ]; then
469 file_to_fix
=${INPUT}/$file
474 if [ \
! -z "$file_to_fix" ]; then
475 echo Checking
$file_to_fix
476 cp $file_to_fix /tmp
/$base
479 /^static int[ ]*size;/c
482 static int getrnge ();
486 if cmp $file_to_fix /tmp
/$base >/dev
/null
2>&1; then \
487 echo No change needed
in $file_to_fix
489 echo Fixed
$file_to_fix
491 cp /tmp
/$base ${LIB}/$file
496 # Add a #define of _SIGACTION_ into <sys/signal.h>.
499 base
=`basename $file`
500 if [ -r ${LIB}/$file ]; then
501 file_to_fix
=${LIB}/$file
503 if [ -r ${INPUT}/$file ]; then
504 file_to_fix
=${INPUT}/$file
509 if [ \
! -z "$file_to_fix" ]; then
510 echo Checking
$file_to_fix
511 cp $file_to_fix /tmp
/$base
514 /^struct sigaction {/c
520 if cmp $file_to_fix /tmp
/$base >/dev
/null
2>&1; then \
521 echo No change needed
in $file_to_fix
523 echo Fixed
$file_to_fix
525 cp /tmp
/$base ${LIB}/$file
530 # Fix declarations of `makedev', `major', and `minor' in <sys/mkdev.h>.
533 base
=`basename $file`
534 if [ -r ${LIB}/$file ]; then
535 file_to_fix
=${LIB}/$file
537 if [ -r ${INPUT}/$file ]; then
538 file_to_fix
=${INPUT}/$file
543 if [ \
! -z "$file_to_fix" ]; then
544 echo Checking
$file_to_fix
545 cp $file_to_fix /tmp
/$base
548 /^dev_t makedev(const/c
549 static dev_t makedev(const major_t, const minor_t);
552 static dev_t makedev();
554 /^major_t major(const/c
555 static major_t major(const dev_t);
558 static major_t major();
560 /^minor_t minor(const/c
561 static minor_t minor(const dev_t);
564 static minor_t minor();
568 if cmp $file_to_fix /tmp
/$base >/dev
/null
2>&1; then \
569 echo No change needed
in $file_to_fix
571 echo Fixed
$file_to_fix
573 cp /tmp
/$base ${LIB}/$file
578 # Fix reference to NMSZ in <sys/adv.h>.
581 base
=`basename $file`
582 if [ -r ${LIB}/$file ]; then
583 file_to_fix
=${LIB}/$file
585 if [ -r ${INPUT}/$file ]; then
586 file_to_fix
=${INPUT}/$file
591 if [ \
! -z "$file_to_fix" ]; then
592 echo Checking
$file_to_fix
593 sed 's/\[NMSZ\]/\[RFS_NMSZ\]/g' $file_to_fix > /tmp
/$base
594 if cmp $file_to_fix /tmp
/$base >/dev
/null
2>&1; then \
595 echo No change needed
in $file_to_fix
597 echo Fixed
$file_to_fix
599 cp /tmp
/$base ${LIB}/$file
604 # Fix reference to NC_NPI_RAW in <sys/netcspace.h>. Also fix types of
605 # array initializers.
608 base
=`basename $file`
609 if [ -r ${LIB}/$file ]; then
610 file_to_fix
=${LIB}/$file
612 if [ -r ${INPUT}/$file ]; then
613 file_to_fix
=${INPUT}/$file
618 if [ \
! -z "$file_to_fix" ]; then
619 echo Checking
$file_to_fix
620 sed 's/NC_NPI_RAW/NC_TPI_RAW/g' $file_to_fix \
621 |
sed 's/NC_/(unsigned long) NC_/' > /tmp
/$base
622 if cmp $file_to_fix /tmp
/$base >/dev
/null
2>&1; then \
623 echo No change needed
in $file_to_fix
625 echo Fixed
$file_to_fix
627 cp /tmp
/$base ${LIB}/$file
632 # Conditionalize all of <fs/rfs/rf_cache.h> on _KERNEL being defined.
634 file=fs
/rfs
/rf_cache.h
635 base
=`basename $file`
636 if [ -r ${LIB}/$file ]; then
637 file_to_fix
=${LIB}/$file
639 if [ -r ${INPUT}/$file ]; then
640 file_to_fix
=${INPUT}/$file
645 if [ \
! -z "$file_to_fix" ]; then
646 echo Checking
$file_to_fix
647 if grep _KERNEL
$file_to_fix > /dev
/null
; then
648 echo No change needed
in $file_to_fix
650 echo '#ifdef _KERNEL' > /tmp
/$base
651 cat $file_to_fix >> /tmp
/$base
652 echo '#endif /* defined(_KERNEL) */' >> /tmp
/$base
653 echo Fixed
$file_to_fix
655 cp /tmp
/$base ${LIB}/$file
660 # Conditionalize all of <sys/erec.h> on _KERNEL being defined.
663 base
=`basename $file`
664 if [ -r ${LIB}/$file ]; then
665 file_to_fix
=${LIB}/$file
667 if [ -r ${INPUT}/$file ]; then
668 file_to_fix
=${INPUT}/$file
673 if [ \
! -z "$file_to_fix" ]; then
674 echo Checking
$file_to_fix
675 if grep _KERNEL
$file_to_fix > /dev
/null
; then
676 echo No change needed
in $file_to_fix
678 echo '#ifdef _KERNEL' > /tmp
/$base
679 cat $file_to_fix >> /tmp
/$base
680 echo '#endif /* defined(_KERNEL) */' >> /tmp
/$base
681 echo Fixed
$file_to_fix
683 cp /tmp
/$base ${LIB}/$file
688 # Conditionalize all of <sys/err.h> on _KERNEL being defined.
691 base
=`basename $file`
692 if [ -r ${LIB}/$file ]; then
693 file_to_fix
=${LIB}/$file
695 if [ -r ${INPUT}/$file ]; then
696 file_to_fix
=${INPUT}/$file
701 if [ \
! -z "$file_to_fix" ]; then
702 echo Checking
$file_to_fix
703 if grep _KERNEL
$file_to_fix > /dev
/null
; then
704 echo No change needed
in $file_to_fix
706 echo '#ifdef _KERNEL' > /tmp
/$base
707 cat $file_to_fix >> /tmp
/$base
708 echo '#endif /* defined(_KERNEL) */' >> /tmp
/$base
709 echo Fixed
$file_to_fix
711 cp /tmp
/$base ${LIB}/$file
716 # Conditionalize all of <sys/char.h> on _KERNEL being defined.
719 base
=`basename $file`
720 if [ -r ${LIB}/$file ]; then
721 file_to_fix
=${LIB}/$file
723 if [ -r ${INPUT}/$file ]; then
724 file_to_fix
=${INPUT}/$file
729 if [ \
! -z "$file_to_fix" ]; then
730 echo Checking
$file_to_fix
731 if grep _KERNEL
$file_to_fix > /dev
/null
; then
732 echo No change needed
in $file_to_fix
734 echo '#ifdef _KERNEL' > /tmp
/$base
735 cat $file_to_fix >> /tmp
/$base
736 echo '#endif /* defined(_KERNEL) */' >> /tmp
/$base
737 echo Fixed
$file_to_fix
739 cp /tmp
/$base ${LIB}/$file
744 # Conditionalize all of <sys/getpages.h> on _KERNEL being defined.
747 base
=`basename $file`
748 if [ -r ${LIB}/$file ]; then
749 file_to_fix
=${LIB}/$file
751 if [ -r ${INPUT}/$file ]; then
752 file_to_fix
=${INPUT}/$file
757 if [ \
! -z "$file_to_fix" ]; then
758 echo Checking
$file_to_fix
759 if grep _KERNEL
$file_to_fix > /dev
/null
; then
760 echo No change needed
in $file_to_fix
762 echo '#ifdef _KERNEL' > /tmp
/$base
763 cat $file_to_fix >> /tmp
/$base
764 echo '#endif /* defined(_KERNEL) */' >> /tmp
/$base
765 echo Fixed
$file_to_fix
767 cp /tmp
/$base ${LIB}/$file
772 # Conditionalize all of <sys/map.h> on _KERNEL being defined.
775 base
=`basename $file`
776 if [ -r ${LIB}/$file ]; then
777 file_to_fix
=${LIB}/$file
779 if [ -r ${INPUT}/$file ]; then
780 file_to_fix
=${INPUT}/$file
785 if [ \
! -z "$file_to_fix" ]; then
786 echo Checking
$file_to_fix
787 if grep _KERNEL
$file_to_fix > /dev
/null
; then
788 echo No change needed
in $file_to_fix
790 echo '#ifdef _KERNEL' > /tmp
/$base
791 cat $file_to_fix >> /tmp
/$base
792 echo '#endif /* defined(_KERNEL) */' >> /tmp
/$base
793 echo Fixed
$file_to_fix
795 cp /tmp
/$base ${LIB}/$file
800 # Conditionalize all of <sys/cmn_err.h> on _KERNEL being defined.
803 base
=`basename $file`
804 if [ -r ${LIB}/$file ]; then
805 file_to_fix
=${LIB}/$file
807 if [ -r ${INPUT}/$file ]; then
808 file_to_fix
=${INPUT}/$file
813 if [ \
! -z "$file_to_fix" ]; then
814 echo Checking
$file_to_fix
815 if grep _KERNEL
$file_to_fix > /dev
/null
; then
816 echo No change needed
in $file_to_fix
818 echo '#ifdef _KERNEL' > /tmp
/$base
819 cat $file_to_fix >> /tmp
/$base
820 echo '#endif /* defined(_KERNEL) */' >> /tmp
/$base
821 echo Fixed
$file_to_fix
823 cp /tmp
/$base ${LIB}/$file
828 # Conditionalize all of <sys/kdebugger.h> on _KERNEL being defined.
831 base
=`basename $file`
832 if [ -r ${LIB}/$file ]; then
833 file_to_fix
=${LIB}/$file
835 if [ -r ${INPUT}/$file ]; then
836 file_to_fix
=${INPUT}/$file
841 if [ \
! -z "$file_to_fix" ]; then
842 echo Checking
$file_to_fix
843 if grep _KERNEL
$file_to_fix > /dev
/null
; then
844 echo No change needed
in $file_to_fix
846 echo '#ifdef _KERNEL' > /tmp
/$base
847 cat $file_to_fix >> /tmp
/$base
848 echo '#endif /* defined(_KERNEL) */' >> /tmp
/$base
849 echo Fixed
$file_to_fix
851 cp /tmp
/$base ${LIB}/$file
856 # Sony NEWSOS 5.0 does not support the complete ANSI C standard.
858 if [ -x /bin
/sony
]; then
861 # Change <stdio.h> to not define __filbuf, __flsbuf, and __iob
864 base
=`basename $file`
865 if [ -r ${LIB}/$file ]; then
866 file_to_fix
=${LIB}/$file
868 if [ -r ${INPUT}/$file ]; then
869 file_to_fix
=${INPUT}/$file
874 if [ \
! -z "$file_to_fix" ]; then
875 echo Checking
$file_to_fix
876 cp $file_to_fix /tmp
/$base
882 ' /tmp
/$base > /tmp
/$base.
sed
883 mv /tmp
/$base.
sed /tmp
/$base
884 if cmp $file_to_fix /tmp
/$base.
sed >/dev
/null
2>&1; then
885 echo No change needed
in $file_to_fix
887 echo Fixed
$file_to_fix
889 cp /tmp
/$base ${LIB}/$file
894 # Change <ctype.h> to not define __ctype
897 base
=`basename $file`
898 if [ -r ${LIB}/$file ]; then
899 file_to_fix
=${LIB}/$file
901 if [ -r ${INPUT}/$file ]; then
902 file_to_fix
=${INPUT}/$file
907 if [ \
! -z "$file_to_fix" ]; then
908 echo Checking
$file_to_fix
909 cp $file_to_fix /tmp
/$base
913 ' /tmp
/$base > /tmp
/$base.
sed
914 mv /tmp
/$base.
sed /tmp
/$base
915 if cmp $file_to_fix /tmp
/$base.
sed >/dev
/null
2>&1; then
916 echo No change needed
in $file_to_fix
918 echo Fixed
$file_to_fix
920 cp /tmp
/$base ${LIB}/$file
927 echo 'Removing unneeded directories:'
929 files
=`find . -type d -print | sort -r`
930 for file in $files; do
931 rmdir $LIB/$file > /dev
/null
2>&1
935 echo 'Making internal symbolic non-directory links'
937 files
=`find . -type l -print`
938 for file in $files; do
939 dest
=`ls -ld $file | sed -n 's/.*-> //p'`
940 if expr "$dest" : '[^/].*' > /dev
/null
; then
941 target
=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
942 if [ -f $target ]; then
943 ln -s $dest ${LIB}/$file >/dev
/null
2>&1
951 echo 'Replacing <sys/byteorder.h>'
952 rm -f ${LIB}/sys
/byteorder.h
953 cp byteorder.h
${LIB}/sys
/byteorder.h