|
|
1.1 root 1: #! /bin/sh
2: # This is a modified version of fixincludes that fixes
3: # a bug encountered on AIX for the PS/2.
4: # This version might be better on all systems, but at this moment
5: # (making 2.4.1) I don't want to risk that change. -- rms.
6:
7: # Install modified versions of certain ANSI-incompatible system header files
8: # which are fixed to work correctly with ANSI C
9: # and placed in a directory that GNU C will search.
10:
11: # See README-fixinc for more information.
12:
13: # Directory where gcc sources (and sometimes special include files) live.
14: # fixincludes doesn't use this, but fixinc.svr4 does, and I want to make
15: # sure somebody doesn't try to use arg3 for something incompatible. -- gumby
16: SRCDIR=${3-${SRCDIR-.}}
17:
18: # Directory containing the original header files.
19: # (This was named INCLUDES, but that conflicts with a name in Makefile.in.)
20: INPUT=${2-${INPUT-/usr/include}}
21:
22: # Directory in which to store the results.
23: LIB=${1?"fixincludes: output directory not specified"}
24:
25: # Define PWDCMD as a command to use to get the working dir
26: # in the form that we want.
27: PWDCMD=pwd
28: case "`pwd`" in
29: //*)
30: # On an Apollo, discard everything before `/usr'.
31: PWDCMD="eval pwd | sed -e 's,.*/usr/,/usr/,'"
32: ;;
33: esac
34:
35: # Original directory.
36: ORIGDIR=`${PWDCMD}`
37:
38: # Make sure it exists.
39: if [ ! -d $LIB ]; then
40: mkdir $LIB || exit 1
41: fi
42:
43: # Make LIB absolute only if needed to avoid problems with the amd.
44: case $LIB in
45: /*)
46: ;;
47: *)
48: cd $LIB; LIB=`${PWDCMD}`
49: ;;
50: esac
51:
52: # Make SRCDIR absolute only if needed to avoid problems with the amd.
53: cd $ORIGDIR
54: case $SRCDIR in
55: /*)
56: ;;
57: *)
58: cd $SRCDIR; SRCDIR=`${PWDCMD}`
59: ;;
60: esac
61:
62: # Fail if no arg to specify a directory for the output.
63: if [ x$1 = x ]
64: then echo fixincludes: no output directory specified
65: exit 1
66: fi
67:
68: echo Building fixed headers in ${LIB}
69:
70: # Determine whether this system has symbolic links.
71: if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
72: rm -f $LIB/ShouldNotExist
73: LINKS=true
74: else
75: LINKS=false
76: fi
77:
78: echo Finding directories and links to directories
79: cd ${INPUT}
80: # Find all directories and all symlinks that point to directories.
81: # Put the list in $files.
82: # Each time we find a symlink, add it to newdirs
83: # so that we do another find within the dir the link points to.
84: # Note that $files may have duplicates in it;
85: # later parts of this file are supposed to ignore them.
86: dirs="."
87: levels=2
88: while [ -n "$dirs" ] && [ $levels -gt 0 ]
89: do
90: levels=`expr $levels - 1`
91: newdirs=
92: for d in $dirs
93: do
94: echo " Searching $INPUT/$d"
95: if [ "$d" != . ]
96: then
97: d=$d/.
98: fi
99:
100: # Find all directories under $d, relative to $d, excluding $d itself.
101: files="$files `find $d -type d -print | \
102: sed -e '/\/\.$/d' -e '/^\.$/d'`"
103: # Find all links to directories.
104: # Using `-exec test -d' in find fails on some systems,
105: # and trying to run test via sh fails on others,
106: # so this is the simplest alternative left.
107: # First find all the links, then test each one.
108: theselinks=
109: $LINKS && \
110: theselinks=`find $d -type l -print`
111: for d1 in $theselinks --dummy--
112: do
113: # If the link points to a directory,
114: # add that dir to $newdirs
115: if [ -d $d1 ]
116: then
117: newdirs="$newdirs $d1"
118: fi
119: done
120: done
121:
122: files="$files $newdirs"
123: dirs="$newdirs"
124: done
125:
126: dirs=
127: echo "All directories (including links to directories):"
128: echo $files
129:
130: for file in $files; do
131: rm -rf $LIB/$file
132: if [ ! -d $LIB/$file ]
133: then mkdir $LIB/$file
134: fi
135: done
136: mkdir $LIB/root
137:
138: # treetops gets an alternating list
139: # of old directories to copy
140: # and the new directories to copy to.
141: treetops="${INPUT} ${LIB}"
142:
143: if $LINKS; then
144: echo 'Making symbolic directory links'
145: for file in $files; do
146: dest=`ls -ld $file | sed -n 's/.*-> //p'`
147: if [ "$dest" ]; then
148: cwd=`${PWDCMD}`
149: # In case $dest is relative, get to $file's dir first.
150: cd ${INPUT}
151: cd `echo ./$file | sed -n 's&[^/]*$&&p'`
152: # Check that the target directory exists.
153: # Redirections changed to avoid bug in sh on Ultrix.
154: (cd $dest) > /dev/null 2>&1
155: if [ $? = 0 ]; then
156: cd $dest
157: # X gets the dir that the link actually leads to.
158: x=`${PWDCMD}`
159: # If a link points to ., make a similar link to .
160: if [ $x = $INPUT ]; then
161: echo $file '->' . ': Making link'
162: rm -fr ${LIB}/$file > /dev/null 2>&1
163: ln -s . ${LIB}/$file > /dev/null 2>&1
164: # If link leads back into ${INPUT},
165: # make a similar link here.
166: elif expr $x : "${INPUT}/.*" > /dev/null; then
167: # Y gets the actual target dir name, relative to ${INPUT}.
168: y=`echo $x | sed -n "s&${INPUT}/&&p"`
169: echo $file '->' $y ': Making link'
170: rm -fr ${LIB}/$file > /dev/null 2>&1
171: ln -s ${LIB}/$y ${LIB}/$file > /dev/null 2>&1
172: else
173: # If the link is to a dir $target outside ${INPUT},
174: # repoint the link at ${INPUT}/root$target
175: # and process $target into ${INPUT}/root$target
176: # treat this directory as if it actually contained the files.
177: echo $file '->' root$x ': Making link'
178: if [ -d $LIB/root$x ]
179: then true
180: else
181: dirname=root$x/
182: dirmade=.
183: cd $LIB
184: while [ x$dirname != x ]; do
185: component=`echo $dirname | sed -e 's|/.*$||'`
186: mkdir $component >/dev/null 2>&1
187: cd $component
188: dirmade=$dirmade/$component
189: dirname=`echo $dirname | sed -e 's|[^/]*/||'`
190: done
191: fi
192: # Duplicate directory structure created in ${LIB}/$file in new
193: # root area.
194: for file2 in $files; do
195: case $file2 in
196: $file/./*)
197: dupdir=${LIB}/root$x/`echo $file2 | sed -n "s|^${file}/||p"`
198: echo "Duplicating ${file}'s ${dupdir}"
199: if [ -d ${dupdir} ]
200: then true
201: else
202: mkdir ${dupdir}
203: fi
204: ;;
205: *)
206: ;;
207: esac
208: done
209: rm -fr ${LIB}/$file > /dev/null 2>&1
210: ln -s ${LIB}/root$x ${LIB}/$file > /dev/null 2>&1
211: treetops="$treetops $x ${LIB}/root$x"
212: fi
213: fi
214: cd $cwd
215: fi
216: done
217: fi
218:
219: set x $treetops
220: shift
221: while [ $# != 0 ]; do
222: # $1 is an old directory to copy, and $2 is the new directory to copy to.
223: cd ${INPUT}
224: cd $1
225: # The same dir can appear more than once in treetops.
226: # There's no need to scan it more than once.
227: if [ -f $2/DONE ]
228: then
229: files=
230: else
231: touch $2/DONE
232: echo Fixing directory $1 into $2
233: # Check .h files which are symlinks as well as those which are files.
234: # A link to a header file will not be processed by anything but this.
235: if $LINKS; then
236: files=`find . -name '*.h' \( -type f -o -type l \) -print`
237: else
238: files=`find . -name '*.h' -type f -print`
239: fi
240: echo Checking header files
241: fi
242: # Note that BSD43_* are used on recent MIPS systems.
243: for file in $files; do
244: # This call to egrep is essential, since checking a file with egrep
245: # is much faster than actually trying to fix it.
246: # It is also essential that most files *not* match!
247: # Thus, matching every #endif is unacceptable.
248: # But the argument to egrep must be kept small, or many versions of egrep
249: # won't be able to handle it.
250: #
251: # We use the pattern [!-.0-~] instead of [^/ ] to match a noncomment
252: # following #else or #endif because some buggy egreps think [^/] matches
253: # newline, and they thus think `#else ' matches `#e[ndiflse]*[ ]+[^/ ]'.
254: #
255: # We use the pattern [^a-zA-Z0-9_][_a-ce-km-z][a-z0-9] to match an identifier
256: # following #if or #elif that is not surrounded by __. The `a-ce-km-z'
257: # in this pattern lacks `d' and `l'; this means we don't worry about
258: # identifiers starting with `d' or `l'. This is OK, since none of the
259: # identifiers below start with `d' or `l'. It also greatly improves
260: # performance, since many files contain lines of the form `#if ... defined ...'
261: # or `#if lint'.
262: if egrep '//|[ _]_IO|CTRL|^#define.NULL|^#e[nl][ds][ief]*[ ]+[!-.0-~]|^#[el]*if.*[^a-zA-Z0-9_][_a-ce-km-z][a-z0-9]' $file >/dev/null; then
263: if [ -r $file ]; then
264: cp $file $2/$file >/dev/null 2>&1 \
265: || echo "Can't copy $file"
266: chmod +w $2/$file
267: chmod a+r $2/$file
268: # Here is how the sed commands in braces work.
269: # (It doesn't work to put the comments inside the sed commands.)
270: # Surround each word with spaces, to simplify matching below.
271: # ANSIfy each pre-ANSI machine-dependent symbol
272: # by surrounding it with __ __.
273: # Remove the spaces that we inserted around each word.
274: sed -e '
275: :loop
276: /\\$/ N
277: /\\$/ b loop
278: s%^\([ ]*#[ ]*endif[ ]*\)\([^/ ].*\)$%\1/* \2 */%
279: s%^\([ ]*#[ ]*else[ ]*\)\([^/ ].*\)$%\1/* \2 */%
280: /\/\/[^*]/ s|//\(.*\)$|/*\1*/|
281: /[ ]_IO[A-Z]*[ ]*(/ s/\(_IO[A-Z]*[ ]*(\)\(.\),/\1'\''\2'\'',/
282: /[ ]BSD43__IO[A-Z]*[ ]*(/ s/(\(.\),/('\''\1'\'',/
283: /#define._IO/ s/'\''\([cgx]\)'\''/\1/g
284: /#define.BSD43__IO/ s/'\''\([cgx]\)'\''/\1/g
285: /[^A-Z0-9_]CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/
286: /[^A-Z0-9]_CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/
287: /#define.CTRL/ s/'\''\([cgx]\)'\''/\1/g
288: /#define._CTRL/ s/'\''\([cgx]\)'\''/\1/g
289: /#define.BSD43_CTRL/ s/'\''\([cgx]\)'\''/\1/g
290: /#[el]*if/{
291: s/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g
292:
293: s/ bsd4\([0-9]\) / __bsd4\1__ /g
294: s/ _*i386 / __i386__ /g
295: s/ is68k / __is68k__ /g
296: s/ m68k / __m68k__ /g
297: s/ mc680\([0-9]\)0 / __mc680\10__ /g
298: s/ news\([0-9]*\) / __news\1__ /g
299: s/ ns32000 / __ns32000__ /g
300: s/ pyr / __pyr__ /g
301: s/ sony_news / __sony_news__ /g
302: s/ sparc / __sparc__ /g
303: s/ sun\([a-z0-9]*\) / __sun\1__ /g
304: s/ unix / __unix__ /g
305: s/ vax / __vax__ /g
306:
307: s/ \([a-zA-Z0-9_][a-zA-Z0-9_]*\) /\1/g
308: }
309: /^#define.NULL[ ]/ i\
310: #undef NULL
311: ' $2/$file > $2/$file.
312: mv $2/$file. $2/$file
313: if cmp $file $2/$file >/dev/null 2>&1; then
314: rm $2/$file
315: else
316: echo Fixed $file
317: fi
318: fi
319: fi
320: done
321: shift; shift
322: done
323:
324: cd ${INPUT}
325:
326: # Install the proper definition of size_t in header files that it comes from.
327: for file in sys/types.h sys/stdtypes.h;
328: do
329: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
330: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
331: chmod +w ${LIB}/$file 2>/dev/null
332: chmod a+r ${LIB}/$file 2>/dev/null
333: fi
334:
335: if [ -r ${LIB}/$file ]; then
336: echo Fixing $file comment
337: # Extract the definition of SIZE_TYPE, if any.
338: # (This file must be called something.c).
339: echo "#include \"tm.h\"
340: gobblegobble SIZE_TYPE" > ${LIB}/types.c
341: foo=`cd ${LIB}; cc -E -I${ORIGDIR} -I${SRCDIR} -I${SRCDIR}/config types.c | grep gobblegobble | sed -e "s/gobblegobble[ ]*//"`
342: rm -f ${LIB}/types.c
343: # Default to our preferred type.
344: if [ "$foo" = SIZE_TYPE ]; then foo="unsigned long int"; else foo=`echo $foo | sed -e 's/^.*"\(.*\)".*$/\1/'`; fi
345: sed -e "s/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/typedef $foo size_t/" ${LIB}/$file > ${LIB}/${file}.sed
346: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
347: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
348: rm ${LIB}/$file
349: fi
350: fi
351: done
352:
353: # Fix one other error in this file: a mismatched quote not inside a C comment.
354: file=sundev/vuid_event.h
355: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
356: mkdir ${LIB}/sundev 2>/dev/null
357: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
358: chmod +w ${LIB}/$file 2>/dev/null
359: chmod a+r ${LIB}/$file 2>/dev/null
360: fi
361:
362: if [ -r ${LIB}/$file ]; then
363: echo Fixing $file comment
364: sed -e "s/doesn't/does not/" ${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
367: rm ${LIB}/$file
368: fi
369: fi
370:
371: # Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
372: file=sunwindow/win_cursor.h
373: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
374: # mkdir ${LIB}/sunwindow 2>/dev/null
375: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
376: chmod +w ${LIB}/$file 2>/dev/null
377: fi
378: if [ -r ${LIB}/$file ]; then
379: echo Fixing $file
380: sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.sed
381: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
382: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
383: rm ${LIB}/$file
384: fi
385: fi
386: file=sunwindow/win_lock.h
387: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
388: # mkdir ${LIB}/sunwindow 2>/dev/null
389: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
390: chmod +w ${LIB}/$file 2>/dev/null
391: fi
392: if [ -r ${LIB}/$file ]; then
393: echo Fixing $file
394: sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.sed
395: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
396: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
397: rm ${LIB}/$file
398: fi
399: fi
400:
401: # Fix this Sun file to avoid interfering with stddef.h.
402: file=sys/stdtypes.h
403: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
404: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
405: chmod +w ${LIB}/$file 2>/dev/null
406: chmod a+r ${LIB}/$file 2>/dev/null
407: fi
408:
409: if [ -r ${LIB}/$file ]; then
410: echo Fixing $file
411: sed -e '/size_t.*;/i\
412: #ifndef _GCC_SIZE_T\
413: #define _GCC_SIZE_T' \
414: -e '/size_t.*;/a\
415: #endif' \
416: -e '/ptrdiff_t.*;/i\
417: #ifndef _GCC_PTRDIFF_T\
418: #define _GCC_PTRDIFF_T' \
419: -e '/ptrdiff_t.*;/a\
420: #endif' \
421: -e '/wchar_t.*;/i\
422: #ifndef _GCC_WCHAR_T\
423: #define _GCC_WCHAR_T' \
424: -e '/wchar_t.*;/a\
425: #endif' ${LIB}/$file > ${LIB}/${file}.sed
426: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
427: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
428: rm ${LIB}/$file
429: fi
430: fi
431:
432: # Fix this file to avoid interfering with stddef.h, but don't mistakenly
433: # match e.g. ssize_t present in AIX for the ps/2.
434: file=sys/types.h
435: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
436: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
437: chmod +w ${LIB}/$file 2>/dev/null
438: chmod a+r ${LIB}/$file 2>/dev/null
439: fi
440:
441: if [ -r ${LIB}/$file ]; then
442: echo Fixing $file
443: sed -e '/[ ]size_t;/i\
444: #ifndef _GCC_SIZE_T\
445: #define _GCC_SIZE_T' \
446: -e '/[ ]size_t;/a\
447: #endif' ${LIB}/$file > ${LIB}/${file}.sed
448: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
449: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
450: rm ${LIB}/$file
451: fi
452: fi
453:
454: # Fix an error in this file: the #if says _cplusplus, not the double
455: # underscore __cplusplus that it should be
456: file=tinfo.h
457: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
458: mkdir ${LIB}/rpcsvc 2>/dev/null
459: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
460: chmod +w ${LIB}/$file 2>/dev/null
461: chmod a+r ${LIB}/$file 2>/dev/null
462: fi
463:
464: if [ -r ${LIB}/$file ]; then
465: echo Fixing $file, __cplusplus macro
466: sed -e 's/[ ]_cplusplus/ __cplusplus/' ${LIB}/$file > ${LIB}/${file}.sed
467: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
468: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
469: rm ${LIB}/$file
470: fi
471: fi
472:
473: # Fix an error in this file: a missing semi-colon at the end of the statsswtch
474: # structure definition.
475: file=rpcsvc/rstat.h
476: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
477: mkdir ${LIB}/rpcsvc 2>/dev/null
478: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
479: chmod +w ${LIB}/$file 2>/dev/null
480: chmod a+r ${LIB}/$file 2>/dev/null
481: fi
482:
483: if [ -r ${LIB}/$file ]; then
484: echo Fixing $file, definition of statsswtch
485: sed -e 's/boottime$/boottime;/' ${LIB}/$file > ${LIB}/${file}.sed
486: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
487: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
488: rm ${LIB}/$file
489: fi
490: fi
491:
492: # Fix an error in this file: a missing semi-colon at the end of the nodeent
493: # structure definition.
494: file=netdnet/dnetdb.h
495: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
496: mkdir ${LIB}/netdnet 2>/dev/null
497: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
498: chmod +w ${LIB}/$file 2>/dev/null
499: chmod a+r ${LIB}/$file 2>/dev/null
500: fi
501:
502: if [ -r ${LIB}/$file ]; then
503: echo Fixing $file, definition of nodeent
504: sed -e 's/char.*na_addr *$/char *na_addr;/' ${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
507: rm ${LIB}/$file
508: fi
509: fi
510:
511: # Check for bad #ifdef line (in Ultrix 4.1)
512: file=sys/file.h
513: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
514: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
515: chmod +w ${LIB}/$file 2>/dev/null
516: chmod a+r ${LIB}/$file 2>/dev/null
517: fi
518:
519: if [ -r ${LIB}/$file ]; then
520: echo Fixing $file, bad \#ifdef line
521: sed -e 's/#ifdef KERNEL/#if defined(KERNEL)/' ${LIB}/$file > ${LIB}/${file}.sed
522: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
523: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
524: rm ${LIB}/$file
525: fi
526: fi
527:
528: # Remove nested comments created by #endifs in a comment (Ultrix 4.1)
529: # Only needed if commenting out junk after #endif.
530: file=signal.h
531: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
532: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
533: chmod +w ${LIB}/$file 2>/dev/null
534: chmod a+r ${LIB}/$file 2>/dev/null
535: fi
536:
537: if [ -r ${LIB}/$file ]; then
538: echo Fixing $file, nested comments
539: sed -e 's/#endif.*/#endif/' ${LIB}/$file > ${LIB}/${file}.sed
540: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
541: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
542: rm -f ${LIB}/$file
543: fi
544: fi
545:
546: # Check for superfluous `static' (in Ultrix 4.2)
547: file=machine/cpu.h
548: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
549: mkdir ${LIB}/machine 2>/dev/null
550: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
551: chmod +w ${LIB}/$file 2>/dev/null
552: chmod a+r ${LIB}/$file 2>/dev/null
553: fi
554:
555: if [ -r ${LIB}/$file ]; then
556: echo Fixing $file, superfluous static
557: sed -e 's/^static struct tlb_pid_state/struct tlb_pid_state/' ${LIB}/$file > ${LIB}/${file}.sed
558: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
559: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
560: rm ${LIB}/$file
561: else
562: # This file has an alternative name, mips/cpu.h. Fix that name, too.
563: if cmp machine/cpu.h mips/cpu.h > /dev/null 2>& 1; then
564: mkdir ${LIB}/mips 2>&-
565: ln ${LIB}/$file ${LIB}/mips/cpu.h
566: fi
567: fi
568: fi
569:
570: # Incorrect sprintf declaration in X11/Xmu.h
571: file=X11/Xmu.h
572: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
573: mkdir ${LIB}/X11 2>/dev/null
574: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
575: chmod +w ${LIB}/$file 2>/dev/null
576: chmod a+r ${LIB}/$file 2>/dev/null
577: fi
578:
579: if [ -r ${LIB}/$file ]; then
580: echo Fixing $file sprintf declaration
581: sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
582: extern char * sprintf();\
583: #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.sed
584: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
585: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
586: rm ${LIB}/$file
587: fi
588: fi
589:
590: # Incorrect sprintf declaration in X11/Xmu/Xmu.h
591: # (It's not clear whether the right file name is this or X11/Xmu.h.)
592: file=X11/Xmu/Xmu.h
593: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
594: mkdir ${LIB}/X11/Xmu 2>/dev/null
595: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
596: chmod +w ${LIB}/$file 2>/dev/null
597: chmod a+r ${LIB}/$file 2>/dev/null
598: fi
599:
600: if [ -r ${LIB}/$file ]; then
601: echo Fixing $file sprintf declaration
602: sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
603: extern char * sprintf();\
604: #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.sed
605: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
606: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
607: rm ${LIB}/$file
608: fi
609: fi
610:
611: # Check for missing ';' in struct
612: file=netinet/ip.h
613: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
614: mkdir ${LIB}/netinet 2>/dev/null
615: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
616: chmod +w ${LIB}/$file 2>/dev/null
617: chmod a+r ${LIB}/$file 2>/dev/null
618: fi
619:
620: if [ -r ${LIB}/$file ]; then
621: echo Fixing $file
622: sed -e '/^struct/,/^};/s/}$/};/' ${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
625: rm -f ${LIB}/$file
626: fi
627: fi
628:
629: # Fix the CAT macro in SunOS memvar.h.
630: file=pixrect/memvar.h
631: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
632: mkdir ${LIB}/pixrect 2>/dev/null
633: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
634: chmod +w ${LIB}/$file 2>/dev/null
635: chmod a+r ${LIB}/$file 2>/dev/null
636: fi
637:
638: if [ -r ${LIB}/$file ]; then
639: echo Fixing $file
640: sed -e '/^#define.CAT(a,b)/ i\
641: #ifdef __STDC__ \
642: #define CAT(a,b) a##b\
643: #else
644: /^#define.CAT(a,b)/ a\
645: #endif
646: ' ${LIB}/$file > ${LIB}/${file}.sed
647: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
648: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
649: rm -f ${LIB}/$file
650: fi
651: fi
652:
653: # Check for yet more missing ';' in struct (in SunOS 4.0.x)
654: file=rpcsvc/rusers.h
655: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
656: mkdir ${LIB}/rpcsvc 2>/dev/null
657: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
658: chmod +w ${LIB}/$file 2>/dev/null
659: chmod a+r ${LIB}/$file 2>/dev/null
660: fi
661:
662: if [ -r ${LIB}/$file ]; then
663: echo Fixing $file
664: sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' ${LIB}/$file > ${LIB}/${file}.sed
665: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
666: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
667: rm -f ${LIB}/$file
668: fi
669: fi
670:
671: # Fix return type of exit and abort in <stdlib.h> on SunOS 4.1.
672: file=stdlib.h
673: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
674: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
675: chmod +w ${LIB}/$file 2>/dev/null
676: chmod a+r ${LIB}/$file 2>/dev/null
677: fi
678:
679: if [ -r ${LIB}/$file ]; then
680: echo Fixing $file
681: sed -e 's/int abort/void abort/g' \
682: -e 's/int free/void free/g' \
683: -e 's/char \* calloc/void \* calloc/g' \
684: -e 's/char \* malloc/void \* malloc/g' \
685: -e 's/char \* realloc/void \* realloc/g' \
686: -e 's/int exit/void exit/g' ${LIB}/$file > ${LIB}/${file}.sed
687: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
688: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
689: rm -f ${LIB}/$file
690: fi
691: fi
692:
693: # Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
694: file=malloc.h
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
698: chmod a+r ${LIB}/$file 2>/dev/null
699: fi
700:
701: if [ -r ${LIB}/$file ]; then
702: echo Fixing $file
703: sed -e 's/typedef[ ]char \* malloc_t/typedef void \* malloc_t/g' \
704: -e 's/int[ ][ ]*free/void free/g' \
705: ${LIB}/$file > ${LIB}/${file}.sed
706: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
707: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
708: rm -f ${LIB}/$file
709: fi
710: fi
711:
712:
713: # Fix bogus comment in <locale.h> on SunOS 4.1.
714: file=locale.h
715: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
716: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
717: chmod +w ${LIB}/$file 2>/dev/null
718: chmod a+r ${LIB}/$file 2>/dev/null
719: fi
720:
721: if [ -r ${LIB}/$file ]; then
722: echo Fixing $file
723: sed -e 's%#endif / \*%#endif /\* %g' ${LIB}/$file > ${LIB}/${file}.sed
724: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
725: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
726: rm -f ${LIB}/$file
727: fi
728: fi
729:
730: # Fix bogus #ifdef in <hsfs/hsfs_spec.h> on SunOS 4.1.
731: file=hsfs/hsfs_spec.h
732: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
733: mkdir ${LIB}/hsfs 2>/dev/null
734: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
735: chmod +w ${LIB}/$file 2>/dev/null
736: chmod a+r ${LIB}/$file 2>/dev/null
737: fi
738:
739: if [ -r ${LIB}/$file ]; then
740: echo Fixing $file
741: sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
742: ${LIB}/$file > ${LIB}/${file}.
743: rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
744: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
745: rm -f ${LIB}/$file
746: fi
747: fi
748:
749: # Fix bogus #ifdef in <hsfs/hsnode.h> on SunOS 4.1.
750: file=hsfs/hsnode.h
751: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
752: mkdir ${LIB}/hsfs 2>/dev/null
753: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
754: chmod +w ${LIB}/$file 2>/dev/null
755: chmod a+r ${LIB}/$file 2>/dev/null
756: fi
757:
758: if [ -r ${LIB}/$file ]; then
759: echo Fixing $file
760: sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \
761: ${LIB}/$file > ${LIB}/${file}.sed
762: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
763: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
764: rm -f ${LIB}/$file
765: fi
766: fi
767:
768: # Fix bogus #ifdef in <hsfs/iso_spec.h> on SunOS 4.1.
769: file=hsfs/iso_spec.h
770: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
771: mkdir ${LIB}/hsfs 2>/dev/null
772: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
773: chmod +w ${LIB}/$file 2>/dev/null
774: chmod a+r ${LIB}/$file 2>/dev/null
775: fi
776:
777: if [ -r ${LIB}/$file ]; then
778: echo Fixing $file
779: sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
780: ${LIB}/$file > ${LIB}/${file}.sed
781: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
782: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
783: rm -f ${LIB}/$file
784: fi
785: fi
786:
787: # Incorrect #include in Sony News-OS 3.2.
788: file=machine/machparam.h
789: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
790: mkdir ${LIB}/machine 2>/dev/null
791: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
792: chmod +w ${LIB}/$file 2>/dev/null
793: chmod a+r ${LIB}/$file 2>/dev/null
794: fi
795:
796: if [ -r ${LIB}/$file ]; then
797: echo Fixing $file, incorrect \#include
798: sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \
799: ${LIB}/$file > ${LIB}/${file}.
800: rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
801: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
802: rm -f ${LIB}/$file
803: fi
804: fi
805:
806: # Multiline comment after typedef on IRIX 4.0.1.
807: file=sys/types.h
808: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
809: mkdir ${LIB}/sys 2>/dev/null
810: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
811: chmod +w ${LIB}/$file 2>/dev/null
812: chmod a+r ${LIB}/$file 2>/dev/null
813: fi
814:
815: if [ -r ${LIB}/$file ]; then
816: echo Fixing $file, comment in the middle of \#ifdef
817: sed -e 's@type of the result@type of the result */@' \
818: -e 's@of the sizeof@/* of the sizeof@' \
819: ${LIB}/$file > ${LIB}/${file}.sed
820: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
821: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
822: rm -f ${LIB}/$file
823: fi
824: fi
825:
826: # Fix line in IRIX 4.0.1 header file. The sed script turns
827: # #define EM_CTRL (CUTIOC|0x1)
828: # into
829: # #define EM_CTRL (CUTIOC|0x'1')
830: file=sys/t3270reg.h
831: if [ -r ${LIB}/$file ]; then
832: echo Fixing $file, overeager sed script
833: sed -e "s/0x'1'/0x1/" ${LIB}/$file > ${LIB}/${file}.sed
834: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
835: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
836: rm -f ${LIB}/$file
837: fi
838: fi
839:
840: # Turning // comments into /* */ comments trashes this IRIX 4.0.1
841: # header file, which embeds // comments inside multi-line /* */
842: # comments. If this looks like the IRIX header file, we refix it by
843: # just throwing away the // comments.
844: file=fam.h
845: if [ -r ${LIB}/$file ]; then
846: if egrep indigo.esd ${LIB}/$file > /dev/null; then
847: echo Fixing $file, overeager sed script
848: rm ${LIB}/$file
849: sed -e 's|//.*$||g' $file > ${LIB}/$file
850: chmod +w ${LIB}/$file 2>/dev/null
851: chmod a+r ${LIB}/$file 2>/dev/null
852: fi
853: fi
854:
855: # Another IRIX 4.0.1 header file contains the string "//"
856: file=elf_abi.h
857: if [ -r ${LIB}/$file ]; then
858: echo Fixing $file, overeager sed script
859: sed -e 's|"/\*"\*/|"//"|' ${LIB}/$file > ${LIB}/${file}.sed
860: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
861: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
862: rm -f ${LIB}/$file
863: fi
864: fi
865:
866: # Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
867: # declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because
868: # many other systems have similar text but correct versions of the file.
869: # To ensure only Sun's is fixed, we grep for a likely unique string.
870: file=memory.h
871: if [ -r $file ] && egrep '/\* @\(#\)memory\.h 1\.[2-4] 8./../.. SMI; from S5R2 1\.2 \*/' $file > /dev/null; then
872: if [ ! -r ${LIB}/$file ]; then
873: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
874: chmod +w ${LIB}/$file 2>/dev/null
875: chmod a+r ${LIB}/$file 2>/dev/null
876: fi
877: if [ -r ${LIB}/$file ]; then
878: echo Replacing $file
879: cat > ${LIB}/$file << EOF
880: /* This file was generated by fixincludes */
881: #ifndef __memory_h__
882: #define __memory_h__
883:
884: #ifdef __STDC__
885: extern void *memccpy();
886: extern void *memchr();
887: extern void *memcpy();
888: extern void *memset();
889: #else
890: extern char *memccpy();
891: extern char *memchr();
892: extern char *memcpy();
893: extern char *memset();
894: #endif /* __STDC__ */
895:
896: extern int memcmp();
897:
898: #endif /* __memory_h__ */
899: EOF
900: fi
901: fi
902:
903: # parameters not const on DECstation Ultrix V4.0.
904: file=stdio.h
905: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
906: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
907: chmod +w ${LIB}/$file 2>/dev/null
908: chmod a+r ${LIB}/$file 2>/dev/null
909: fi
910:
911: if [ -r ${LIB}/$file ]; then
912: echo Fixing $file, non-const arg
913: sed -e 's@perror( char \*__s );@perror( const char *__s );@' \
914: -e 's@fputs( char \*__s,@fputs( const char *__s,@' \
915: -e 's@fopen( char \*__filename, char \*__type );@fopen( const char *__filename, const char *__type );@' \
916: -e 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@' \
917: -e 's@fscanf( FILE \*__stream, char \*__format,@fscanf( FILE *__stream, const char *__format,@' \
918: -e 's@scanf( char \*__format,@scanf( const char *__format,@' \
919: -e 's@sscanf( char \*__s, char \*__format,@sscanf( const char *__s, const char *__format,@' \
920: ${LIB}/$file > ${LIB}/${file}.sed
921: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
922: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
923: rm -f ${LIB}/$file
924: fi
925: fi
926:
927: # parameters conflict with C++ new on rs/6000
928: file=stdio.h
929: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
930: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
931: chmod +w ${LIB}/$file 2>/dev/null
932: fi
933:
934: if [ -r ${LIB}/$file ]; then
935: echo Fixing $file, parameter name conflicts
936: sed -e 's@rename(const char \*old, const char \*new)@rename(const char *_old, const char *_new)@' \
937: ${LIB}/$file > ${LIB}/${file}.sed
938: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
939: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
940: rm -f ${LIB}/$file
941: fi
942: fi
943:
944: # Don't use or define the name va_list in stdio.h.
945: # This is for ANSI and also to interoperate properly with gvarargs.h.
946: file=stdio.h
947: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
948: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
949: chmod +w ${LIB}/$file 2>/dev/null
950: chmod a+r ${LIB}/$file 2>/dev/null
951: fi
952:
953: if [ -r ${LIB}/$file ]; then
954: echo Fixing $file, use of va_list
955: # Arrange for stdio.h to use stdarg.h to define __gnuc_va_list
956: (echo "#define __need___va_list"
957: echo "#include <stdarg.h>") > ${LIB}/${file}.sed
958: # Use __gnuc_va_list in arg types in place of va_list.
959: # On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
960: # trailing parentheses and semicolon save all other systems from this.
961: # Define __va_list__ (something harmless and unused) instead of va_list.
962: # Don't claim to have defined va_list.
963: sed -e 's@ va_list @ __gnuc_va_list @' \
964: -e 's@ va_list)@ __gnuc_va_list)@' \
965: -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \
966: -e 's@ va_list@ __va_list__@' \
967: -e 's@\*va_list@*__va_list__@' \
968: -e 's@VA_LIST@DUMMY_VA_LIST@' \
969: ${LIB}/$file >> ${LIB}/${file}.sed
970:
971: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
972: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
973: rm -f ${LIB}/$file
974: fi
975: fi
976:
977: # Cancel out ansi_compat.h on Ultrix. Replace it with empty file.
978: file=ansi_compat.h
979: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
980: if grep -s ULTRIX $file; then
981: echo "/* This file intentionally left blank. */" > $LIB/$file
982: fi
983: fi
984:
985: # parameter to atof not const on DECstation Ultrix V4.0.
986: # also get rid of bogus inline definitions in HP-UX 8.0
987: file=math.h
988: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
989: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
990: chmod +w ${LIB}/$file 2>/dev/null
991: chmod a+r ${LIB}/$file 2>/dev/null
992: fi
993:
994: if [ -r ${LIB}/$file ]; then
995: echo Fixing $file, non-const arg
996: sed -e 's@atof( char \*__nptr );@atof( const char *__nptr );@' \
997: -e 's@inline int abs(int d) { return (d>0)?d:-d; }@@' \
998: -e 's@inline double abs(double d) { return fabs(d); }@@' \
999: ${LIB}/$file > ${LIB}/${file}.sed
1000: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1001: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1002: rm -f ${LIB}/$file
1003: fi
1004: fi
1005:
1006: # In limits.h, put #ifndefs around things that are supposed to be defined
1007: # in float.h to avoid redefinition errors if float.h is included first.
1008: # On HP/UX this patch does not work, because on HP/UX limits.h uses
1009: # multi line comments and the inserted #endif winds up inside the
1010: # comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if
1011: # we find a #ifndef FLT_MIN we assume that all the required #ifndefs
1012: # are there, and we do not add them ourselves.
1013: file=limits.h
1014: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1015: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
1016: chmod +w ${LIB}/$file 2>/dev/null
1017: chmod a+r ${LIB}/$file 2>/dev/null
1018: fi
1019:
1020: if [ -r ${LIB}/$file ]; then
1021: if egrep 'ifndef[ ]+FLT_MIN' ${LIB}/$file >/dev/null; then
1022: true
1023: else
1024: echo Fixing $file
1025: sed -e '/[ ]FLT_MIN[ ]/i\
1026: #ifndef FLT_MIN'\
1027: -e '/[ ]FLT_MIN[ ]/a\
1028: #endif'\
1029: -e '/[ ]FLT_MAX[ ]/i\
1030: #ifndef FLT_MAX'\
1031: -e '/[ ]FLT_MAX[ ]/a\
1032: #endif'\
1033: -e '/[ ]FLT_DIG[ ]/i\
1034: #ifndef FLT_DIG'\
1035: -e '/[ ]FLT_DIG[ ]/a\
1036: #endif'\
1037: -e '/[ ]DBL_MIN[ ]/i\
1038: #ifndef DBL_MIN'\
1039: -e '/[ ]DBL_MIN[ ]/a\
1040: #endif'\
1041: -e '/[ ]DBL_MAX[ ]/i\
1042: #ifndef DBL_MAX'\
1043: -e '/[ ]DBL_MAX[ ]/a\
1044: #endif'\
1045: -e '/[ ]DBL_DIG[ ]/i\
1046: #ifndef DBL_DIG'\
1047: -e '/[ ]DBL_DIG[ ]/a\
1048: #endif'\
1049: ${LIB}/$file > ${LIB}/${file}.sed
1050: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1051: fi
1052: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1053: echo Deleting ${LIB}/$file\; no fixes were needed.
1054: rm -f ${LIB}/$file
1055: fi
1056: fi
1057:
1058: # These two files on SunOS 4 are included by other files
1059: # in the same directory, using "...". So we must make sure they exist
1060: # in the same directory as the other fixed files.
1061: if [ -r ${INPUT}/multimedia/audio_errno.h ]
1062: then
1063: ln -s ${INPUT}/multimedia/audio_errno.h ${LIB}/multimedia 2>/dev/null
1064: fi
1065: if [ -r ${INPUT}/multimedia/audio_hdr.h ]
1066: then
1067: ln -s ${INPUT}/multimedia/audio_hdr.h ${LIB}/multimedia 2>/dev/null
1068: fi
1069:
1070: # These files on Ultrix 4.2 put comments around instances of #endif
1071: # __mips. When the sed expression turns that into #endif /* __mips */
1072: # the comment ends prematurely.
1073: for file in sys/audit.h sys/signal.h; do
1074: if [ -r ${LIB}/${file} ]; then
1075: echo Fixing $file, early comment termination
1076: sed -e 's|^#endif /\*.*\*/|#endif|g' ${LIB}/${file} > ${LIB}/${file}.sed
1077: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1078: fi
1079: done
1080:
1081: echo 'Removing unneeded directories:'
1082: cd $LIB
1083: files=`find . -type d -print | sort -r`
1084: for file in $files; do
1085: rmdir $LIB/$file > /dev/null 2>&1
1086: done
1087:
1088: if $LINKS; then
1089: echo 'Making internal symbolic non-directory links'
1090: cd ${INPUT}
1091: files=`find . -type l -print`
1092: for file in $files; do
1093: dest=`ls -ld $file | sed -n 's/.*-> //p'`
1094: if expr "$dest" : '[^/].*' > /dev/null; then
1095: target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
1096: if [ -f $target ]; then
1097: ln -s $dest ${LIB}/$file >/dev/null 2>&1
1098: fi
1099: fi
1100: done
1101: fi
1102:
1103: echo 'Cleaning up DONE files.'
1104: cd $LIB
1105: find . -name DONE -exec rm -f {} ';'
1106:
1107: exit 0
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.