]>
Commit | Line | Data |
---|---|---|
06bbab1b BK |
1 | #!/bin/sh |
2 | # | |
3 | # DO NOT EDIT THIS FILE (inclhack.sh) | |
4 | # | |
69063200 | 5 | # It has been autogen-ed Wednesday March 3, 1999 at 08:05:49 AM PST |
06bbab1b BK |
6 | # From the definitions inclhack.def |
7 | # and the template file inclhack.tpl | |
8 | # | |
9 | # Install modified versions of certain ANSI-incompatible system header | |
10 | # files which are fixed to work correctly with ANSI C and placed in a | |
11 | # directory that GNU C will search. | |
12 | # | |
1f414ac4 | 13 | # This script contains 105 fixup scripts. |
06bbab1b BK |
14 | # |
15 | # See README-fixinc for more information. | |
16 | # | |
17 | # fixincludes is free software. | |
18 | # | |
19 | # You may redistribute it and/or modify it under the terms of the | |
20 | # GNU General Public License, as published by the Free Software | |
21 | # Foundation; either version 2, or (at your option) any later version. | |
22 | # | |
23 | # fixincludes is distributed in the hope that it will be useful, | |
24 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
26 | # See the GNU General Public License for more details. | |
27 | # | |
28 | # You should have received a copy of the GNU General Public License | |
29 | # along with fixincludes. See the file "COPYING". If not, | |
30 | # write to: The Free Software Foundation, Inc., | |
31 | # 59 Temple Place - Suite 330, | |
32 | # Boston, MA 02111-1307, USA. | |
33 | # | |
34 | # # # # # # # # # # # # # # # # # # # # # | |
35 | # | |
36 | # Directory in which to store the results. | |
37 | # Fail if no arg to specify a directory for the output. | |
38 | if [ "x$1" = "x" ] | |
39 | then echo fixincludes: no output directory specified | |
40 | exit 1 | |
41 | fi | |
42 | ||
43 | LIB=${1} | |
44 | shift | |
45 | ||
46 | # Make sure it exists. | |
47 | if [ ! -d $LIB ]; then | |
48 | mkdir $LIB || { | |
49 | echo fixincludes: output dir '`'$LIB"' cannot be created" | |
50 | exit 1 | |
51 | } | |
52 | else | |
53 | ( \cd $LIB && touch DONE && rm DONE ) || { | |
54 | echo fixincludes: output dir '`'$LIB"' is an invalid directory" | |
55 | exit 1 | |
56 | } | |
57 | fi | |
58 | ||
59 | # Define what target system we're fixing. | |
60 | # | |
61 | if test -r ./Makefile; then | |
62 | target_canonical="`sed -n -e 's,^target[ ]*=[ ]*\(.*\)$,\1,p' < Makefile`" | |
63 | fi | |
64 | ||
65 | # If not from the Makefile, then try config.guess | |
66 | # | |
67 | if test -z "${target_canonical}" ; then | |
68 | if test -x ./config.guess ; then | |
69 | target_canonical="`config.guess`" ; fi | |
70 | test -z "${target_canonical}" && target_canonical=unknown | |
71 | fi | |
72 | export target_canonical | |
73 | ||
74 | # # # # # # # # # # # # # # # # # # # # # | |
75 | # | |
76 | # Define PWDCMD as a command to use to get the working dir | |
77 | # in the form that we want. | |
78 | PWDCMD=pwd | |
79 | ||
80 | case "`$PWDCMD`" in | |
81 | //*) | |
82 | # On an Apollo, discard everything before `/usr'. | |
83 | PWDCMD="eval pwd | sed -e 's,.*/usr/,/usr/,'" | |
84 | ;; | |
85 | esac | |
86 | ||
87 | # Original directory. | |
88 | ORIGDIR=`${PWDCMD}` | |
89 | ||
90 | # Make LIB absolute only if needed to avoid problems with the amd. | |
91 | case $LIB in | |
92 | /*) | |
93 | ;; | |
94 | *) | |
95 | cd $LIB; LIB=`${PWDCMD}` | |
96 | ;; | |
97 | esac | |
98 | ||
99 | echo Fixing headers into ${LIB} for ${target_canonical} target | |
100 | ||
101 | # Determine whether this system has symbolic links. | |
102 | if ln -s X $LIB/ShouldNotExist 2>/dev/null; then | |
103 | rm -f $LIB/ShouldNotExist | |
104 | LINKS=true | |
105 | elif ln -s X /tmp/ShouldNotExist 2>/dev/null; then | |
106 | rm -f /tmp/ShouldNotExist | |
107 | LINKS=true | |
108 | else | |
109 | LINKS=false | |
110 | fi | |
111 | ||
112 | # # # # # # # # # # # # # # # # # # # # # | |
113 | # | |
114 | # Search each input directory for broken header files. | |
115 | # This loop ends near the end of the file. | |
116 | # | |
117 | if test $# -eq 0 | |
118 | then | |
119 | INPUTLIST="/usr/include" | |
120 | else | |
121 | INPUTLIST="$@" | |
122 | fi | |
123 | ||
124 | for INPUT in ${INPUTLIST} ; do | |
125 | ||
126 | cd ${ORIGDIR} | |
127 | ||
1f414ac4 | 128 | cd ${INPUT} || continue |
06bbab1b BK |
129 | |
130 | # | |
131 | # # # # # # # # # # # # # # # # # # # # # | |
132 | # | |
133 | echo Finding directories and links to directories | |
134 | ||
135 | # Find all directories and all symlinks that point to directories. | |
136 | # Put the list in $files. | |
137 | # Each time we find a symlink, add it to newdirs | |
138 | # so that we do another find within the dir the link points to. | |
139 | # Note that $files may have duplicates in it; | |
140 | # later parts of this file are supposed to ignore them. | |
141 | dirs="." | |
142 | levels=2 | |
143 | while [ -n "$dirs" ] && [ $levels -gt 0 ] | |
144 | do | |
145 | levels=`expr $levels - 1` | |
146 | newdirs= | |
147 | for d in $dirs | |
148 | do | |
149 | echo " Searching $INPUT/$d" | |
150 | ||
151 | # Find all directories under $d, relative to $d, excluding $d itself. | |
152 | # (The /. is needed after $d in case $d is a symlink.) | |
153 | files="$files `find $d/. -type d -print | \ | |
154 | sed -e '/\/\.$/d' -e 's@/./@/@g'`" | |
155 | # Find all links to directories. | |
156 | # Using `-exec test -d' in find fails on some systems, | |
157 | # and trying to run test via sh fails on others, | |
158 | # so this is the simplest alternative left. | |
159 | # First find all the links, then test each one. | |
160 | theselinks= | |
161 | $LINKS && \ | |
162 | theselinks=`find $d/. -type l -print | sed -e 's@/./@/@g'` | |
163 | for d1 in $theselinks --dummy-- | |
164 | do | |
165 | # If the link points to a directory, | |
166 | # add that dir to $newdirs | |
167 | if [ -d $d1 ] | |
168 | then | |
169 | files="$files $d1" | |
170 | if [ "`ls -ld $d1 | sed -n 's/.*-> //p'`" != "." ] | |
171 | then | |
172 | newdirs="$newdirs $d1" | |
173 | fi | |
174 | fi | |
175 | done | |
176 | done | |
177 | ||
178 | dirs="$newdirs" | |
179 | done | |
180 | ||
181 | # # # # # # # # # # # # # # # # # # # # # | |
182 | # | |
183 | dirs= | |
184 | echo "All directories (including links to directories):" | |
185 | echo $files | |
186 | ||
187 | for file in $files; do | |
188 | rm -rf $LIB/$file | |
189 | if [ ! -d $LIB/$file ] | |
190 | then mkdir $LIB/$file | |
191 | fi | |
192 | done | |
193 | mkdir $LIB/root | |
194 | ||
195 | # # # # # # # # # # # # # # # # # # # # # | |
196 | # | |
197 | # treetops gets an alternating list | |
198 | # of old directories to copy | |
199 | # and the new directories to copy to. | |
200 | treetops="${INPUT} ${LIB}" | |
201 | ||
202 | if $LINKS; then | |
203 | echo 'Making symbolic directory links' | |
204 | for file in $files; do | |
205 | dest=`ls -ld $file | sed -n 's/.*-> //p'` | |
206 | if [ "$dest" ]; then | |
207 | cwd=`${PWDCMD}` | |
208 | # In case $dest is relative, get to $file's dir first. | |
209 | cd ${INPUT} | |
210 | cd `echo ./$file | sed -n 's&[^/]*$&&p'` | |
211 | # Check that the target directory exists. | |
212 | # Redirections changed to avoid bug in sh on Ultrix. | |
213 | (cd $dest) > /dev/null 2>&1 | |
214 | if [ $? = 0 ]; then | |
215 | cd $dest | |
216 | # X gets the dir that the link actually leads to. | |
217 | x=`${PWDCMD}` | |
218 | # Canonicalize ${INPUT} now to minimize the time an | |
219 | # automounter has to change the result of ${PWDCMD}. | |
220 | cinput=`cd ${INPUT}; ${PWDCMD}` | |
221 | # If a link points to ., make a similar link to . | |
222 | if [ $x = ${cinput} ]; then | |
223 | echo $file '->' . ': Making link' | |
224 | rm -fr ${LIB}/$file > /dev/null 2>&1 | |
225 | ln -s . ${LIB}/$file > /dev/null 2>&1 | |
226 | # If link leads back into ${INPUT}, | |
227 | # make a similar link here. | |
228 | elif expr $x : "${cinput}/.*" > /dev/null; then | |
229 | # Y gets the actual target dir name, relative to ${INPUT}. | |
230 | y=`echo $x | sed -n "s&${cinput}/&&p"` | |
231 | # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}. | |
232 | dots=`echo "$file" | | |
233 | sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'` | |
234 | echo $file '->' $dots$y ': Making link' | |
235 | rm -fr ${LIB}/$file > /dev/null 2>&1 | |
236 | ln -s $dots$y ${LIB}/$file > /dev/null 2>&1 | |
237 | else | |
238 | # If the link is to a dir $target outside ${INPUT}, | |
239 | # repoint the link at ${INPUT}/root$target | |
240 | # and process $target into ${INPUT}/root$target | |
241 | # treat this directory as if it actually contained the files. | |
242 | echo $file '->' root$x ': Making link' | |
243 | if [ -d $LIB/root$x ] | |
244 | then true | |
245 | else | |
246 | dirname=root$x/ | |
247 | dirmade=. | |
248 | cd $LIB | |
249 | while [ x$dirname != x ]; do | |
250 | component=`echo $dirname | sed -e 's|/.*$||'` | |
251 | mkdir $component >/dev/null 2>&1 | |
252 | cd $component | |
253 | dirmade=$dirmade/$component | |
254 | dirname=`echo $dirname | sed -e 's|[^/]*/||'` | |
255 | done | |
256 | fi | |
257 | # Duplicate directory structure created in ${LIB}/$file in new | |
258 | # root area. | |
259 | for file2 in $files; do | |
260 | case $file2 in | |
261 | $file/*) | |
262 | dupdir=${LIB}/root$x/`echo $file2 | sed -n "s|^${file}/||p"` | |
263 | echo "Duplicating ${file}'s ${dupdir}" | |
264 | if [ -d ${dupdir} ] | |
265 | then true | |
266 | else | |
267 | mkdir ${dupdir} | |
268 | fi | |
269 | ;; | |
270 | *) | |
271 | ;; | |
272 | esac | |
273 | done | |
274 | # Get the path from ${LIB} to $file, accounting for symlinks. | |
275 | parent=`echo "$file" | sed -e 's@/[^/]*$@@'` | |
276 | libabs=`cd ${LIB}; ${PWDCMD}` | |
277 | file2=`cd ${LIB}; cd $parent; ${PWDCMD} | sed -e "s@^${libabs}@@"` | |
278 | # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}. | |
279 | dots=`echo "$file2" | sed -e 's@/[^/]*@../@g'` | |
280 | rm -fr ${LIB}/$file > /dev/null 2>&1 | |
281 | ln -s ${dots}root$x ${LIB}/$file > /dev/null 2>&1 | |
282 | treetops="$treetops $x ${LIB}/root$x" | |
283 | fi | |
284 | fi | |
285 | cd $cwd | |
286 | fi | |
287 | done | |
288 | fi | |
289 | ||
290 | # # # # # # # # # # # # # # # # # # # # # | |
291 | # | |
292 | required= | |
293 | set x $treetops | |
294 | shift | |
295 | while [ $# != 0 ]; do | |
296 | # $1 is an old directory to copy, and $2 is the new directory to copy to. | |
297 | # | |
298 | SRCDIR=`cd ${INPUT} ; cd $1 ; ${PWDCMD}` | |
299 | export SRCDIR | |
300 | shift | |
301 | ||
302 | DESTDIR=`cd $1;${PWDCMD}` | |
303 | export DESTDIR | |
304 | shift | |
305 | ||
306 | # The same dir can appear more than once in treetops. | |
307 | # There's no need to scan it more than once. | |
308 | # | |
309 | if [ -f ${DESTDIR}/DONE ] | |
310 | then continue ; fi | |
311 | ||
312 | touch ${DESTDIR}/DONE | |
313 | echo Fixing directory ${SRCDIR} into ${DESTDIR} | |
314 | ||
315 | # Check .h files which are symlinks as well as those which are files. | |
316 | # A link to a header file will not be processed by anything but this. | |
317 | # | |
318 | cd ${SRCDIR} | |
319 | ||
320 | if $LINKS; then | |
321 | files=`find . -name '*.h' \( -type f -o -type l \) -print` | |
322 | else | |
323 | files=`find . -name '*.h' -type f -print` | |
324 | fi | |
325 | echo Checking header files | |
326 | for file in $files; do | |
327 | ||
328 | if ( test ! -r $file -o \ | |
329 | -n "`fgrep 'This file is part of the GNU C Library' $file`" ) | |
330 | then continue ; fi | |
331 | ||
332 | fixlist="" | |
333 | ||
334 | # | |
335 | # Fix 1: Aix_Syswait | |
336 | # | |
337 | case "$file" in ./sys/wait.h ) | |
338 | if ( test -n "`egrep 'bos325,' $file`" | |
339 | ) > /dev/null 2>&1 ; then | |
340 | fixlist="${fixlist} | |
341 | aix_syswait" | |
342 | if [ ! -r ${DESTDIR}/$file ] | |
343 | then infile=$file | |
344 | else infile=${DESTDIR}/$file ; fi | |
345 | ||
346 | sed -e '/^extern pid_t wait3();$/i\ | |
347 | struct rusage; | |
348 | ' \ | |
349 | < $infile > ${DESTDIR}/$file. | |
350 | ||
351 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
352 | fi # end of selection 'if' | |
353 | ;; # case end for file name test | |
354 | esac | |
355 | ||
356 | ||
357 | # | |
358 | # Fix 2: Aix_Volatile | |
359 | # | |
360 | case "$file" in ./sys/signal.h ) | |
361 | if ( test -n "`egrep 'typedef volatile int sig_atomic_t' $file`" | |
362 | ) > /dev/null 2>&1 ; then | |
363 | fixlist="${fixlist} | |
364 | aix_volatile" | |
365 | if [ ! -r ${DESTDIR}/$file ] | |
366 | then infile=$file | |
367 | else infile=${DESTDIR}/$file ; fi | |
368 | ||
369 | sed -e 's/typedef volatile int sig_atomic_t/typedef int sig_atomic_t/' \ | |
370 | < $infile > ${DESTDIR}/$file. | |
371 | ||
372 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
373 | fi # end of selection 'if' | |
374 | ;; # case end for file name test | |
375 | esac | |
376 | ||
377 | ||
378 | # | |
379 | # Fix 3: Alpha_Getopt | |
380 | # | |
381 | case "$file" in ./stdio.h | \ | |
382 | ./stdlib.h ) | |
383 | if ( test -n "`egrep 'getopt\\(int, char \\*\\[' $file`" | |
384 | ) > /dev/null 2>&1 ; then | |
385 | fixlist="${fixlist} | |
386 | alpha_getopt" | |
387 | if [ ! -r ${DESTDIR}/$file ] | |
388 | then infile=$file | |
389 | else infile=${DESTDIR}/$file ; fi | |
390 | ||
391 | sed -e 's/getopt(int, char \*\[\],[ ]*char \*)/getopt(int, char *const[], const char *)/' \ | |
392 | < $infile > ${DESTDIR}/$file. | |
393 | ||
394 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
395 | fi # end of selection 'if' | |
396 | ;; # case end for file name test | |
397 | esac | |
398 | ||
399 | ||
400 | # | |
401 | # Fix 4: Alpha_Parens | |
402 | # | |
403 | case "$file" in ./sym.h ) | |
404 | if ( test -n "`egrep '#ifndef\\(__mips64\\)' $file`" | |
405 | ) > /dev/null 2>&1 ; then | |
406 | fixlist="${fixlist} | |
407 | alpha_parens" | |
408 | if [ ! -r ${DESTDIR}/$file ] | |
409 | then infile=$file | |
410 | else infile=${DESTDIR}/$file ; fi | |
411 | ||
412 | sed -e 's/#ifndef(__mips64)/#ifndef __mips64/' \ | |
413 | < $infile > ${DESTDIR}/$file. | |
414 | ||
415 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
416 | fi # end of selection 'if' | |
417 | ;; # case end for file name test | |
418 | esac | |
419 | ||
420 | ||
421 | # | |
422 | # Fix 5: Alpha_Sbrk | |
423 | # | |
424 | case "$file" in ./unistd.h ) | |
425 | if ( test -n "`egrep 'char[ ]*\\*[ ]*sbrk[ ]*\\(' $file`" | |
426 | ) > /dev/null 2>&1 ; then | |
427 | fixlist="${fixlist} | |
428 | alpha_sbrk" | |
429 | if [ ! -r ${DESTDIR}/$file ] | |
430 | then infile=$file | |
431 | else infile=${DESTDIR}/$file ; fi | |
432 | ||
433 | sed -e 's/char\([ ]*\*[ ]*sbrk[ ]*(\)/void\1/' \ | |
434 | < $infile > ${DESTDIR}/$file. | |
435 | ||
436 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
437 | fi # end of selection 'if' | |
438 | ;; # case end for file name test | |
439 | esac | |
440 | ||
441 | ||
442 | # | |
443 | # Fix 6: Arm_Norcroft_Hint | |
444 | # | |
445 | case "$file" in ./X11/Intrinsic.h ) | |
446 | fixlist="${fixlist} | |
447 | arm_norcroft_hint" | |
448 | if [ ! -r ${DESTDIR}/$file ] | |
449 | then infile=$file | |
450 | else infile=${DESTDIR}/$file ; fi | |
451 | ||
452 | sed -e 's/___type p_type/p_type/' \ | |
453 | < $infile > ${DESTDIR}/$file. | |
454 | ||
455 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
456 | ;; # case end for file name test | |
457 | esac | |
458 | ||
459 | ||
460 | # | |
461 | # Fix 7: Arm_Wchar | |
462 | # | |
463 | case "$file" in ./stdlib.h ) | |
464 | if ( test -n "`egrep '#[ ]*define[ ]*__wchar_t' $file`" | |
465 | ) > /dev/null 2>&1 ; then | |
466 | fixlist="${fixlist} | |
467 | arm_wchar" | |
468 | if [ ! -r ${DESTDIR}/$file ] | |
469 | then infile=$file | |
470 | else infile=${DESTDIR}/$file ; fi | |
471 | ||
472 | sed -e 's/\(#[ ]*ifndef[ ]*\)__wchar_t/\1_GCC_WCHAR_T/' \ | |
473 | -e 's/\(#[ ]*define[ ]*\)__wchar_t/\1_GCC_WCHAR_T/' \ | |
474 | < $infile > ${DESTDIR}/$file. | |
475 | ||
476 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
477 | fi # end of selection 'if' | |
478 | ;; # case end for file name test | |
479 | esac | |
480 | ||
481 | ||
482 | # | |
483 | # Fix 8: Aux_Asm | |
484 | # | |
485 | case "$file" in ./sys/param.h ) | |
486 | if ( test -n "`egrep '#ifndef NOINLINE' $file`" | |
487 | ) > /dev/null 2>&1 ; then | |
488 | fixlist="${fixlist} | |
489 | aux_asm" | |
490 | if [ ! -r ${DESTDIR}/$file ] | |
491 | then infile=$file | |
492 | else infile=${DESTDIR}/$file ; fi | |
493 | ||
494 | sed -e 's|#ifndef NOINLINE|#if !defined(NOINLINE) \&\& !defined(__GNUC__)|' \ | |
495 | < $infile > ${DESTDIR}/$file. | |
496 | ||
497 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
498 | fi # end of selection 'if' | |
499 | ;; # case end for file name test | |
500 | esac | |
501 | ||
502 | ||
503 | # | |
504 | # Fix 9: Avoid_Bool | |
505 | # | |
506 | case "$file" in ./curses.h | \ | |
507 | ./term.h | \ | |
508 | ./tinfo.h ) | |
509 | fixlist="${fixlist} | |
510 | avoid_bool" | |
511 | if [ ! -r ${DESTDIR}/$file ] | |
512 | then infile=$file | |
513 | else infile=${DESTDIR}/$file ; fi | |
514 | ||
515 | sed -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/i\ | |
516 | #ifndef __cplusplus | |
517 | ' \ | |
518 | -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/a\ | |
519 | #endif | |
520 | ' \ | |
521 | -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/i\ | |
522 | #ifndef __cplusplus | |
523 | ' \ | |
524 | -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/a\ | |
525 | #endif | |
526 | ' \ | |
527 | < $infile > ${DESTDIR}/$file. | |
528 | ||
529 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
530 | ;; # case end for file name test | |
531 | esac | |
532 | ||
533 | ||
534 | # | |
535 | # Fix 10: Bad_Malloc_Decl | |
536 | # | |
537 | case "$file" in ./rpc/types.h ) | |
538 | if ( test -z "`egrep '\"C\"' $file`" | |
539 | ) > /dev/null 2>&1 ; then | |
540 | fixlist="${fixlist} | |
541 | bad_malloc_decl" | |
542 | if [ ! -r ${DESTDIR}/$file ] | |
543 | then infile=$file | |
544 | else infile=${DESTDIR}/$file ; fi | |
545 | ||
546 | sed -e '1i\ | |
547 | #ifdef __cplusplus\ | |
548 | extern "C" {\ | |
549 | #endif\ | |
550 | ||
551 | ' \ | |
552 | -e '$a\ | |
553 | #ifdef __cplusplus\ | |
554 | }\ | |
555 | #endif | |
556 | ' \ | |
557 | < $infile > ${DESTDIR}/$file. | |
558 | ||
559 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
560 | fi # end of selection 'if' | |
561 | ;; # case end for file name test | |
562 | esac | |
563 | ||
564 | ||
565 | # | |
566 | # Fix 11: Bad_Struct_Term | |
567 | # | |
568 | case "$file" in ./curses.h ) | |
569 | if ( test -n "`egrep '^[ ]*typedef[ ]+struct[ ]+term[ ]*;' $file`" | |
570 | ) > /dev/null 2>&1 ; then | |
571 | fixlist="${fixlist} | |
572 | bad_struct_term" | |
573 | if [ ! -r ${DESTDIR}/$file ] | |
574 | then infile=$file | |
575 | else infile=${DESTDIR}/$file ; fi | |
576 | ||
577 | sed -e 's/^[ ]*typedef[ ][ ]*\(struct[ ][ ]*term[ ]*;[ ]*\)$/\1/' \ | |
578 | < $infile > ${DESTDIR}/$file. | |
579 | ||
580 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
581 | fi # end of selection 'if' | |
582 | ;; # case end for file name test | |
583 | esac | |
584 | ||
585 | ||
586 | # | |
587 | # Fix 12: Badquote | |
588 | # | |
589 | case "$file" in ./sundev/vuid_event.h ) | |
590 | fixlist="${fixlist} | |
591 | badquote" | |
592 | if [ ! -r ${DESTDIR}/$file ] | |
593 | then infile=$file | |
594 | else infile=${DESTDIR}/$file ; fi | |
595 | ||
596 | sed -e 's/doesn'\''t/does not/' \ | |
597 | < $infile > ${DESTDIR}/$file. | |
598 | ||
599 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
600 | ;; # case end for file name test | |
601 | esac | |
602 | ||
603 | ||
604 | # | |
605 | # Fix 13: Bad_Lval | |
606 | # | |
607 | case "$file" in ./libgen.h | \ | |
608 | ./dirent.h | \ | |
609 | ./ftw.h | \ | |
610 | ./grp.h | \ | |
611 | ./ndbm.h | \ | |
612 | ./pthread.h | \ | |
613 | ./pwd.h | \ | |
614 | ./signal.h | \ | |
615 | ./standards.h | \ | |
616 | ./stdlib.h | \ | |
617 | ./string.h | \ | |
618 | ./stropts.h | \ | |
619 | ./time.h | \ | |
620 | ./unistd.h ) | |
621 | if ( test -n "`egrep '^[ ]*#[ ]*pragma[ ]extern_prefix' $file`" | |
622 | ) > /dev/null 2>&1 ; then | |
623 | fixlist="${fixlist} | |
624 | bad_lval" | |
625 | if [ ! -r ${DESTDIR}/$file ] | |
626 | then infile=$file | |
627 | else infile=${DESTDIR}/$file ; fi | |
628 | ||
629 | sed -e 's/^[ ]*#[ ]*define[ ]*\([^(]*\)\(([^)]*)\)[ ]*\(_.\)\1\2[ ]*$/#define \1 \3\1/' \ | |
630 | < $infile > ${DESTDIR}/$file. | |
631 | ||
632 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
633 | fi # end of selection 'if' | |
634 | ;; # case end for file name test | |
635 | esac | |
636 | ||
637 | ||
638 | # | |
639 | # Fix 14: Broken_Assert_Stdio | |
640 | # | |
641 | case "$file" in ./assert.h ) | |
642 | if ( test -n "`egrep 'stderr' $file`" -a \ | |
643 | -z "`egrep 'include.*stdio.h' $file`" | |
644 | ) > /dev/null 2>&1 ; then | |
645 | fixlist="${fixlist} | |
646 | broken_assert_stdio" | |
647 | if [ ! -r ${DESTDIR}/$file ] | |
648 | then infile=$file | |
649 | else infile=${DESTDIR}/$file ; fi | |
650 | ||
651 | sed -e '1i\ | |
652 | #include <stdio.h> | |
653 | ' \ | |
654 | < $infile > ${DESTDIR}/$file. | |
655 | ||
656 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
657 | fi # end of selection 'if' | |
658 | ;; # case end for file name test | |
659 | esac | |
660 | ||
661 | ||
662 | # | |
663 | # Fix 15: Broken_Assert_Stdlib | |
664 | # | |
665 | case "$file" in ./assert.h ) | |
666 | if ( test -n "`egrep 'exit *\\(|abort *\\(' $file`" -a \ | |
667 | -z "`egrep 'include.*stdlib.h' $file`" | |
668 | ) > /dev/null 2>&1 ; then | |
669 | fixlist="${fixlist} | |
670 | broken_assert_stdlib" | |
671 | if [ ! -r ${DESTDIR}/$file ] | |
672 | then infile=$file | |
673 | else infile=${DESTDIR}/$file ; fi | |
674 | ||
675 | sed -e '1i\ | |
676 | #ifdef __cplusplus\ | |
677 | #include <stdlib.h>\ | |
678 | #endif | |
679 | ' \ | |
680 | < $infile > ${DESTDIR}/$file. | |
681 | ||
682 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
683 | fi # end of selection 'if' | |
684 | ;; # case end for file name test | |
685 | esac | |
686 | ||
687 | ||
688 | # | |
689 | # Fix 16: Bsd43_Io_Macros | |
690 | # | |
691 | if ( test -n "`egrep 'BSD43__IO' $file`" | |
692 | ) > /dev/null 2>&1 ; then | |
693 | fixlist="${fixlist} | |
694 | bsd43_io_macros" | |
695 | if [ ! -r ${DESTDIR}/$file ] | |
696 | then infile=$file | |
697 | else infile=${DESTDIR}/$file ; fi | |
698 | ||
699 | sed -e '/[ ]BSD43__IO[A-Z]*[ ]*(/s/(\(.\),/('\''\1'\'',/' \ | |
700 | -e '/#[ ]*define[ ]*[ ]BSD43__IO/s/'\''\([cgx]\)'\''/\1/g' \ | |
701 | < $infile > ${DESTDIR}/$file. | |
702 | ||
703 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
704 | fi # end of selection 'if' | |
705 | ||
706 | ||
707 | # | |
708 | # Fix 17: No_Double_Slash | |
709 | # | |
710 | if ( test -n "`egrep '//[^*]' $file`" -a \ | |
711 | '(' -z "`echo ${file}|egrep '++$|\.hh$|\.H$'`" ')' | |
712 | ) > /dev/null 2>&1 ; then | |
713 | fixlist="${fixlist} | |
714 | no_double_slash" | |
715 | if [ ! -r ${DESTDIR}/$file ] | |
716 | then infile=$file | |
717 | else infile=${DESTDIR}/$file ; fi | |
718 | ||
719 | sed -e '/\/\/[^*]/s|//.*$||g' \ | |
720 | < $infile > ${DESTDIR}/$file. | |
721 | ||
722 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
723 | fi # end of selection 'if' | |
724 | ||
725 | ||
726 | # | |
727 | # Fix 18: Irix_Bogus_Cxx_Cmnt | |
728 | # | |
729 | case "$file" in ./elf_abi.h | \ | |
730 | ./elf.h ) | |
731 | fixlist="${fixlist} | |
732 | irix_bogus_cxx_cmnt" | |
733 | if [ ! -r ${DESTDIR}/$file ] | |
734 | then infile=$file | |
735 | else infile=${DESTDIR}/$file ; fi | |
736 | ||
737 | sed -e 's@"/\*"\*/@"//"@' \ | |
738 | < $infile > ${DESTDIR}/$file. | |
739 | ||
740 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
741 | ;; # case end for file name test | |
742 | esac | |
743 | ||
744 | ||
745 | # | |
746 | # Fix 19: Ecd_Cursor | |
747 | # | |
748 | case "$file" in ./sunwindow/win_lock.h | \ | |
749 | ./sunwindow/win_cursor.h ) | |
750 | fixlist="${fixlist} | |
751 | ecd_cursor" | |
752 | if [ ! -r ${DESTDIR}/$file ] | |
753 | then infile=$file | |
754 | else infile=${DESTDIR}/$file ; fi | |
755 | ||
756 | sed -e 's/ecd.cursor/ecd_cursor/' \ | |
757 | < $infile > ${DESTDIR}/$file. | |
758 | ||
759 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
760 | ;; # case end for file name test | |
761 | esac | |
762 | ||
763 | ||
764 | # | |
765 | # Fix 20: Else_Label | |
766 | # | |
767 | if ( test -n "`egrep '^[ ]*#[ ]*else[ ]+[!-.0-~]' $file`" | |
768 | ) > /dev/null 2>&1 ; then | |
769 | fixlist="${fixlist} | |
770 | else_label" | |
771 | if [ ! -r ${DESTDIR}/$file ] | |
772 | then infile=$file | |
773 | else infile=${DESTDIR}/$file ; fi | |
774 | ||
775 | sed -e ':loop | |
776 | /\\$/N | |
777 | s/\\$/\\+++fixinc_eol+++/ | |
778 | /\\$/b loop | |
779 | s/\\+++fixinc_eol+++/\\/g | |
780 | s%^\([ ]*#[ ]*else\)[ ]*/[^*].*%\1% | |
781 | s%^\([ ]*#[ ]*else\)[ ]*[^/ ].*%\1%' \ | |
782 | < $infile > ${DESTDIR}/$file. | |
783 | ||
784 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
785 | fi # end of selection 'if' | |
786 | ||
787 | ||
788 | # | |
789 | # Fix 21: Endif_Label | |
790 | # | |
791 | if ( test -n "`egrep '^[ ]*#[ ]*endif[ ]+[!-.0-z{|}~]' $file`" | |
792 | ) > /dev/null 2>&1 ; then | |
793 | fixlist="${fixlist} | |
794 | endif_label" | |
795 | if [ ! -r ${DESTDIR}/$file ] | |
796 | then infile=$file | |
797 | else infile=${DESTDIR}/$file ; fi | |
798 | ||
799 | sed -e ':loop | |
800 | /\\$/N | |
801 | s/\\$/\\+++fixinc_eol+++/ | |
802 | /\\$/b loop | |
803 | s/\\+++fixinc_eol+++/\\/g | |
804 | s%^\([ ]*#[ ]*endif\)[ ]*/[^*].*%\1% | |
805 | s%^\([ ]*#[ ]*endif\)[ ]*\*[^/].*%\1% | |
806 | s%^\([ ]*#[ ]*endif\)[ ]*[^/* ].*%\1%' \ | |
807 | < $infile > ${DESTDIR}/$file. | |
808 | ||
809 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
810 | fi # end of selection 'if' | |
811 | ||
812 | ||
813 | # | |
814 | # Fix 22: Hp_Inline | |
815 | # | |
816 | case "$file" in ./sys/spinlock.h ) | |
817 | if ( test -n "`egrep 'include.*\"\\.\\./machine/' $file`" | |
818 | ) > /dev/null 2>&1 ; then | |
819 | fixlist="${fixlist} | |
820 | hp_inline" | |
821 | if [ ! -r ${DESTDIR}/$file ] | |
822 | then infile=$file | |
823 | else infile=${DESTDIR}/$file ; fi | |
824 | ||
825 | sed -e 's,"../machine/inline.h",<machine/inline.h>,' \ | |
826 | -e 's,"../machine/psl.h",<machine/psl.h>,' \ | |
827 | < $infile > ${DESTDIR}/$file. | |
828 | ||
829 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
830 | fi # end of selection 'if' | |
831 | ;; # case end for file name test | |
832 | esac | |
833 | ||
834 | ||
835 | # | |
836 | # Fix 23: Hp_Sysfile | |
837 | # | |
838 | case "$file" in ./sys/file.h ) | |
839 | if ( test -n "`egrep 'HPUX_SOURCE' $file`" | |
840 | ) > /dev/null 2>&1 ; then | |
841 | fixlist="${fixlist} | |
842 | hp_sysfile" | |
843 | if [ ! -r ${DESTDIR}/$file ] | |
844 | then infile=$file | |
845 | else infile=${DESTDIR}/$file ; fi | |
846 | ||
847 | sed -e 's/(\.\.\.)/(struct file * ...)/' \ | |
848 | < $infile > ${DESTDIR}/$file. | |
849 | ||
850 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
851 | fi # end of selection 'if' | |
852 | ;; # case end for file name test | |
853 | esac | |
854 | ||
855 | ||
856 | # | |
857 | # Fix 24: Hpux_Cxx_Unready | |
858 | # | |
859 | case "$file" in ./sys/mman.h ) | |
860 | if ( test -z "`egrep '\"C\"|__BEGIN_DECLS' $file`" | |
861 | ) > /dev/null 2>&1 ; then | |
862 | fixlist="${fixlist} | |
863 | hpux_cxx_unready" | |
864 | if [ ! -r ${DESTDIR}/$file ] | |
865 | then infile=$file | |
866 | else infile=${DESTDIR}/$file ; fi | |
867 | ||
868 | sed -e '1i\ | |
869 | #ifdef __cplusplus\ | |
870 | extern "C" {\ | |
871 | #endif\ | |
872 | ||
873 | ' \ | |
874 | -e '$a\ | |
875 | #ifdef __cplusplus\ | |
876 | }\ | |
877 | #endif | |
878 | ' \ | |
879 | < $infile > ${DESTDIR}/$file. | |
880 | ||
881 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
882 | fi # end of selection 'if' | |
883 | ;; # case end for file name test | |
884 | esac | |
885 | ||
886 | ||
887 | # | |
888 | # Fix 25: Hpux_Maxint | |
889 | # | |
890 | case "$file" in ./sys/param.h ) | |
891 | fixlist="${fixlist} | |
892 | hpux_maxint" | |
893 | if [ ! -r ${DESTDIR}/$file ] | |
894 | then infile=$file | |
895 | else infile=${DESTDIR}/$file ; fi | |
896 | ||
897 | sed -e '/^#[ ]*define[ ]*MAXINT[ ]/i\ | |
898 | #ifndef MAXINT | |
899 | ' \ | |
900 | -e '/^#[ ]*define[ ]*MAXINT[ ]/a\ | |
901 | #endif | |
902 | ' \ | |
903 | < $infile > ${DESTDIR}/$file. | |
904 | ||
905 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
906 | ;; # case end for file name test | |
907 | esac | |
908 | ||
909 | ||
910 | # | |
911 | # Fix 26: Hpux_Systime | |
912 | # | |
913 | case "$file" in ./sys/time.h ) | |
914 | if ( test -n "`egrep '^extern struct sigevent;' $file`" | |
915 | ) > /dev/null 2>&1 ; then | |
916 | fixlist="${fixlist} | |
917 | hpux_systime" | |
918 | if [ ! -r ${DESTDIR}/$file ] | |
919 | then infile=$file | |
920 | else infile=${DESTDIR}/$file ; fi | |
921 | ||
922 | sed -e 's/^extern struct sigevent;/struct sigevent;/' \ | |
923 | < $infile > ${DESTDIR}/$file. | |
924 | ||
925 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
926 | fi # end of selection 'if' | |
927 | ;; # case end for file name test | |
928 | esac | |
929 | ||
930 | ||
931 | # | |
932 | # Fix 27: Interactv_Add1 | |
933 | # | |
934 | case "$file" in ./stdio.h | \ | |
935 | ./math.h | \ | |
936 | ./ctype.h | \ | |
937 | ./sys/limits.h | \ | |
938 | ./sys/fcntl.h | \ | |
939 | ./sys/dirent.h ) | |
940 | if ( test '(' -d /etc/conf/kconfig.d ')' -a \ | |
941 | '(' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`" ')' | |
942 | ) > /dev/null 2>&1 ; then | |
943 | fixlist="${fixlist} | |
944 | interactv_add1" | |
945 | if [ ! -r ${DESTDIR}/$file ] | |
946 | then infile=$file | |
947 | else infile=${DESTDIR}/$file ; fi | |
948 | ||
949 | sed -e 's/!defined(__STDC__) && !defined(_POSIX_SOURCE)/!defined(_POSIX_SOURCE)/' \ | |
950 | < $infile > ${DESTDIR}/$file. | |
951 | ||
952 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
953 | fi # end of selection 'if' | |
954 | ;; # case end for file name test | |
955 | esac | |
956 | ||
957 | ||
958 | # | |
959 | # Fix 28: Interactv_Add2 | |
960 | # | |
961 | case "$file" in ./math.h ) | |
962 | if ( test '(' -d /etc/conf/kconfig.d ')' -a \ | |
963 | '(' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`" ')' | |
964 | ) > /dev/null 2>&1 ; then | |
965 | fixlist="${fixlist} | |
966 | interactv_add2" | |
967 | if [ ! -r ${DESTDIR}/$file ] | |
968 | then infile=$file | |
969 | else infile=${DESTDIR}/$file ; fi | |
970 | ||
971 | sed -e 's/fmod(double)/fmod(double, double)/' \ | |
972 | < $infile > ${DESTDIR}/$file. | |
973 | ||
974 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
975 | fi # end of selection 'if' | |
976 | ;; # case end for file name test | |
977 | esac | |
978 | ||
979 | ||
980 | # | |
981 | # Fix 29: Interactv_Add3 | |
982 | # | |
983 | case "$file" in ./sys/limits.h ) | |
984 | if ( test '(' -d /etc/conf/kconfig.d ')' -a \ | |
985 | '(' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`" ')' | |
986 | ) > /dev/null 2>&1 ; then | |
987 | fixlist="${fixlist} | |
988 | interactv_add3" | |
989 | if [ ! -r ${DESTDIR}/$file ] | |
990 | then infile=$file | |
991 | else infile=${DESTDIR}/$file ; fi | |
992 | ||
993 | sed -e '/CHILD_MAX/s,/\* Max, Max,' \ | |
994 | -e '/OPEN_MAX/s,/\* Max, Max,' \ | |
995 | < $infile > ${DESTDIR}/$file. | |
996 | ||
997 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
998 | fi # end of selection 'if' | |
999 | ;; # case end for file name test | |
1000 | esac | |
1001 | ||
1002 | ||
1003 | # | |
1004 | # Fix 30: Io_Def_Quotes | |
1005 | # | |
1006 | if ( test -n "`egrep '[ ]_IO[A-Z]*[ ]*\\([A-Za-z]' $file`" | |
1007 | ) > /dev/null 2>&1 ; then | |
1008 | fixlist="${fixlist} | |
1009 | io_def_quotes" | |
1010 | if [ ! -r ${DESTDIR}/$file ] | |
1011 | then infile=$file | |
1012 | else infile=${DESTDIR}/$file ; fi | |
1013 | ||
1014 | sed -e 's/\([ ]_IO[A-Z]*[ ]*(\)\([A-Za-z]\),/\1'\''\2'\'',/' \ | |
1015 | -e '/#[ ]*define[ ]*[ ]_IO/s/'\''\([cgxtf]\)'\''/\1/g' \ | |
1016 | -e '/#[ ]*define[ ]*[ ]DESIOC/s/'\''\([cdgx]\)'\''/\1/g' \ | |
1017 | < $infile > ${DESTDIR}/$file. | |
1018 | ||
1019 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1020 | fi # end of selection 'if' | |
1021 | ||
1022 | ||
1023 | # | |
1024 | # Fix 31: Ioctl_Fix_Ctrl | |
1025 | # | |
1026 | if ( test -n "`egrep 'CTRL[ ]' $file`" | |
1027 | ) > /dev/null 2>&1 ; then | |
1028 | fixlist="${fixlist} | |
1029 | ioctl_fix_ctrl" | |
1030 | if [ ! -r ${DESTDIR}/$file ] | |
1031 | then infile=$file | |
1032 | else infile=${DESTDIR}/$file ; fi | |
1033 | ||
1034 | sed -e '/[^A-Z0-9_]CTRL[ ]*(/s/\([^'\'']\))/'\''\1'\'')/' \ | |
1035 | -e '/[^A-Z0-9]_CTRL[ ]*(/s/\([^'\'']\))/'\''\1'\'')/' \ | |
1036 | -e '/#[ ]*define[ ]*[ ]CTRL/s/'\''\([cgx]\)'\''/\1/g' \ | |
1037 | -e '/#[ ]*define[ ]*[ ]_CTRL/s/'\''\([cgx]\)'\''/\1/g' \ | |
1038 | -e '/#[ ]*define[ ]*[ ]BSD43_CTRL/s/'\''\([cgx]\)'\''/\1/g' \ | |
1039 | < $infile > ${DESTDIR}/$file. | |
1040 | ||
1041 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1042 | fi # end of selection 'if' | |
1043 | ||
1044 | ||
1045 | # | |
1046 | # Fix 32: Ip_Missing_Semi | |
1047 | # | |
1048 | case "$file" in ./netinet/ip.h ) | |
1049 | fixlist="${fixlist} | |
1050 | ip_missing_semi" | |
1051 | if [ ! -r ${DESTDIR}/$file ] | |
1052 | then infile=$file | |
1053 | else infile=${DESTDIR}/$file ; fi | |
1054 | ||
1055 | sed -e '/^struct/,/^};/s/}$/};/' \ | |
1056 | < $infile > ${DESTDIR}/$file. | |
1057 | ||
1058 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1059 | ;; # case end for file name test | |
1060 | esac | |
1061 | ||
1062 | ||
1063 | # | |
1064 | # Fix 33: Irix_Multiline_Cmnt | |
1065 | # | |
1066 | case "$file" in ./sys/types.h ) | |
1067 | fixlist="${fixlist} | |
1068 | irix_multiline_cmnt" | |
1069 | if [ ! -r ${DESTDIR}/$file ] | |
1070 | then infile=$file | |
1071 | else infile=${DESTDIR}/$file ; fi | |
1072 | ||
1073 | sed -e 's@type of the result@type of the result */@' \ | |
1074 | -e 's@of the sizeof@/* of the sizeof@' \ | |
1075 | < $infile > ${DESTDIR}/$file. | |
1076 | ||
1077 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1078 | ;; # case end for file name test | |
1079 | esac | |
1080 | ||
1081 | ||
1082 | # | |
1083 | # Fix 34: Irix_Sockaddr | |
1084 | # | |
1085 | case "$file" in ./rpc/auth.h ) | |
1086 | if ( test -n "`egrep 'authdes_create.*struct sockaddr' $file`" | |
1087 | ) > /dev/null 2>&1 ; then | |
1088 | fixlist="${fixlist} | |
1089 | irix_sockaddr" | |
1090 | if [ ! -r ${DESTDIR}/$file ] | |
1091 | then infile=$file | |
1092 | else infile=${DESTDIR}/$file ; fi | |
1093 | ||
1094 | sed -e '/authdes_create.*struct sockaddr/i\ | |
1095 | struct sockaddr; | |
1096 | ' \ | |
1097 | < $infile > ${DESTDIR}/$file. | |
1098 | ||
1099 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1100 | fi # end of selection 'if' | |
1101 | ;; # case end for file name test | |
1102 | esac | |
1103 | ||
1104 | ||
1105 | # | |
1106 | # Fix 35: Irix_Struct__File | |
1107 | # | |
1108 | case "$file" in ./rpc/xdr.h ) | |
1109 | fixlist="${fixlist} | |
1110 | irix_struct__file" | |
1111 | if [ ! -r ${DESTDIR}/$file ] | |
1112 | then infile=$file | |
1113 | else infile=${DESTDIR}/$file ; fi | |
1114 | ||
1115 | sed -e '/xdrstdio_create.*struct __file_s/i\ | |
1116 | struct __file_s; | |
1117 | ' \ | |
1118 | < $infile > ${DESTDIR}/$file. | |
1119 | ||
1120 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1121 | ;; # case end for file name test | |
1122 | esac | |
1123 | ||
1124 | ||
1125 | # | |
1126 | # Fix 36: Isc_Fmod | |
1127 | # | |
1128 | case "$file" in ./math.h ) | |
1129 | if ( test -n "`egrep 'fmod\\(double\\)' $file`" | |
1130 | ) > /dev/null 2>&1 ; then | |
1131 | fixlist="${fixlist} | |
1132 | isc_fmod" | |
1133 | if [ ! -r ${DESTDIR}/$file ] | |
1134 | then infile=$file | |
1135 | else infile=${DESTDIR}/$file ; fi | |
1136 | ||
1137 | sed -e 's/fmod(double)/fmod(double, double)/' \ | |
1138 | < $infile > ${DESTDIR}/$file. | |
1139 | ||
1140 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1141 | fi # end of selection 'if' | |
1142 | ;; # case end for file name test | |
1143 | esac | |
1144 | ||
1145 | ||
1146 | # | |
1147 | # Fix 37: Motorola_Nested | |
1148 | # | |
1149 | case "$file" in ./limits.h | \ | |
1150 | ./sys/limits.h ) | |
1151 | fixlist="${fixlist} | |
1152 | motorola_nested" | |
1153 | if [ ! -r ${DESTDIR}/$file ] | |
1154 | then infile=$file | |
1155 | else infile=${DESTDIR}/$file ; fi | |
1156 | ||
1157 | sed -e 's@^\(#undef[ ][ ]*PIPE_BUF[ ]*/\* max # bytes atomic in write to a\)$@\1 */@' \ | |
1158 | -e 's@\(/\*#define HUGE_VAL 3.40282346638528860e+38 \)\(/\*error value returned by Math lib\*/\)$@\1*/ \2@' \ | |
1159 | < $infile > ${DESTDIR}/$file. | |
1160 | ||
1161 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1162 | ;; # case end for file name test | |
1163 | esac | |
1164 | ||
1165 | ||
1166 | # | |
1167 | # Fix 38: Isc_Sys_Limits | |
1168 | # | |
1169 | case "$file" in ./sys/limits.h ) | |
1170 | if ( test -n "`egrep 'CHILD_MAX' $file`" | |
1171 | ) > /dev/null 2>&1 ; then | |
1172 | fixlist="${fixlist} | |
1173 | isc_sys_limits" | |
1174 | if [ ! -r ${DESTDIR}/$file ] | |
1175 | then infile=$file | |
1176 | else infile=${DESTDIR}/$file ; fi | |
1177 | ||
1178 | sed -e '/CHILD_MAX/s,/\* Max, Max,' \ | |
1179 | -e '/OPEN_MAX/s,/\* Max, Max,' \ | |
1180 | < $infile > ${DESTDIR}/$file. | |
1181 | ||
1182 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1183 | fi # end of selection 'if' | |
1184 | ;; # case end for file name test | |
1185 | esac | |
1186 | ||
1187 | ||
1188 | # | |
1189 | # Fix 39: Kandr_Concat | |
1190 | # | |
1191 | case "$file" in ./sparc/asm_linkage.h | \ | |
1192 | ./sun3/asm_linkage.h | \ | |
1193 | ./sun3x/asm_linkage.h | \ | |
1194 | ./sun4/asm_linkage.h | \ | |
1195 | ./sun4c/asm_linkage.h | \ | |
1196 | ./sun4m/asm_linkage.h | \ | |
1197 | ./sun4c/debug/asm_linkage.h | \ | |
1198 | ./sun4m/debug/asm_linkage.h | \ | |
1199 | ./arm/as_support.h | \ | |
1200 | ./arm/mc_type.h | \ | |
1201 | ./arm/xcb.h | \ | |
1202 | ./dev/chardefmac.h | \ | |
1203 | ./dev/ps_irq.h | \ | |
1204 | ./dev/screen.h | \ | |
1205 | ./dev/scsi.h | \ | |
1206 | ./sys/tty.h | \ | |
1207 | ./Xm.acorn/XmP.h | \ | |
1208 | ./bsd43/bsd43_.h ) | |
1209 | if ( test -n "`egrep '/\\*\\*/' $file`" | |
1210 | ) > /dev/null 2>&1 ; then | |
1211 | fixlist="${fixlist} | |
1212 | kandr_concat" | |
1213 | if [ ! -r ${DESTDIR}/$file ] | |
1214 | then infile=$file | |
1215 | else infile=${DESTDIR}/$file ; fi | |
1216 | ||
1217 | sed -e 's|/\*\*/| ## |g' \ | |
1218 | < $infile > ${DESTDIR}/$file. | |
1219 | ||
1220 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1221 | fi # end of selection 'if' | |
1222 | ;; # case end for file name test | |
1223 | esac | |
1224 | ||
1225 | ||
1226 | # | |
1227 | # Fix 40: Limits_Ifndefs | |
1228 | # | |
1229 | case "$file" in ./limits.h ) | |
1230 | if ( test -z "`egrep 'ifndef[ ]+FLT_MIN' $file`" | |
1231 | ) > /dev/null 2>&1 ; then | |
1232 | fixlist="${fixlist} | |
1233 | limits_ifndefs" | |
1234 | if [ ! -r ${DESTDIR}/$file ] | |
1235 | then infile=$file | |
1236 | else infile=${DESTDIR}/$file ; fi | |
1237 | ||
1238 | sed -e '/[ ]FLT_MIN[ ]/i\ | |
1239 | #ifndef FLT_MIN | |
1240 | ' \ | |
1241 | -e '/[ ]FLT_MIN[ ]/a\ | |
1242 | #endif | |
1243 | ' \ | |
1244 | -e '/[ ]FLT_MAX[ ]/i\ | |
1245 | #ifndef FLT_MAX | |
1246 | ' \ | |
1247 | -e '/[ ]FLT_MAX[ ]/a\ | |
1248 | #endif | |
1249 | ' \ | |
1250 | -e '/[ ]FLT_DIG[ ]/i\ | |
1251 | #ifndef FLT_DIG | |
1252 | ' \ | |
1253 | -e '/[ ]FLT_DIG[ ]/a\ | |
1254 | #endif | |
1255 | ' \ | |
1256 | -e '/[ ]DBL_MIN[ ]/i\ | |
1257 | #ifndef DBL_MIN | |
1258 | ' \ | |
1259 | -e '/[ ]DBL_MIN[ ]/a\ | |
1260 | #endif | |
1261 | ' \ | |
1262 | -e '/[ ]DBL_MAX[ ]/i\ | |
1263 | #ifndef DBL_MAX | |
1264 | ' \ | |
1265 | -e '/[ ]DBL_MAX[ ]/a\ | |
1266 | #endif | |
1267 | ' \ | |
1268 | -e '/[ ]DBL_DIG[ ]/i\ | |
1269 | #ifndef DBL_DIG | |
1270 | ' \ | |
1271 | -e '/[ ]DBL_DIG[ ]/a\ | |
1272 | #endif | |
1273 | ' \ | |
1274 | -e '/^\(\/\*#define HUGE_VAL 3\.[0-9e+]* *\)\/\*/s//\1/' \ | |
1275 | < $infile > ${DESTDIR}/$file. | |
1276 | ||
1277 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1278 | fi # end of selection 'if' | |
1279 | ;; # case end for file name test | |
1280 | esac | |
1281 | ||
1282 | ||
1283 | # | |
1284 | # Fix 41: Lynx_Void_Int | |
1285 | # | |
1286 | case "$file" in ./curses.h ) | |
1287 | if ( test -n "`egrep '#[ ]*define[ ]+void[ ]+int' $file`" | |
1288 | ) > /dev/null 2>&1 ; then | |
1289 | fixlist="${fixlist} | |
1290 | lynx_void_int" | |
1291 | if [ ! -r ${DESTDIR}/$file ] | |
1292 | then infile=$file | |
1293 | else infile=${DESTDIR}/$file ; fi | |
1294 | ||
1295 | sed -e '/#[ ]*define[ ][ ]*void[ ]int/d' \ | |
1296 | < $infile > ${DESTDIR}/$file. | |
1297 | ||
1298 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1299 | fi # end of selection 'if' | |
1300 | ;; # case end for file name test | |
1301 | esac | |
1302 | ||
1303 | ||
1304 | # | |
1305 | # Fix 42: Lynxos_Fcntl_Proto | |
1306 | # | |
1307 | case "$file" in ./fcntl.h ) | |
1308 | fixlist="${fixlist} | |
1309 | lynxos_fcntl_proto" | |
1310 | if [ ! -r ${DESTDIR}/$file ] | |
1311 | then infile=$file | |
1312 | else infile=${DESTDIR}/$file ; fi | |
1313 | ||
1314 | sed -e 's/\(fcntl.*(int, int, \)int)/\1...)/' \ | |
1315 | < $infile > ${DESTDIR}/$file. | |
1316 | ||
1317 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1318 | ;; # case end for file name test | |
1319 | esac | |
1320 | ||
1321 | ||
1322 | # | |
1323 | # Fix 43: M88k_Bad_Hypot_Opt | |
1324 | # | |
1325 | case "$file" in ./math.h ) | |
1326 | case "$target_canonical" in m88k-motorola-sysv3* ) | |
1327 | fixlist="${fixlist} | |
1328 | m88k_bad_hypot_opt" | |
1329 | if [ ! -r ${DESTDIR}/$file ] | |
1330 | then infile=$file | |
1331 | else infile=${DESTDIR}/$file ; fi | |
1332 | ||
1333 | sed -e 's/extern double floor(), ceil(), fmod(), fabs();/extern double floor(), ceil(), fmod(), fabs _PARAMS((double));/' \ | |
1334 | -e '/^extern double hypot();$/a\ | |
1335 | \/* Workaround a stupid Motorola optimization if one\ | |
1336 | of x or y is 0.0 and the other is negative! *\/\ | |
1337 | #ifdef __STDC__\ | |
1338 | static __inline__ double fake_hypot (double x, double y)\ | |
1339 | #else\ | |
1340 | static __inline__ double fake_hypot (x, y)\ | |
1341 | double x, y;\ | |
1342 | #endif\ | |
1343 | {\ | |
1344 | return fabs (hypot (x, y));\ | |
1345 | }\ | |
1346 | #define hypot fake_hypot | |
1347 | ' \ | |
1348 | < $infile > ${DESTDIR}/$file. | |
1349 | ||
1350 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1351 | ;; # case end for machine type test | |
1352 | esac | |
1353 | ;; # case end for file name test | |
1354 | esac | |
1355 | ||
1356 | ||
1357 | # | |
1358 | # Fix 44: M88k_Bad_S_If | |
1359 | # | |
1360 | case "$file" in ./sys/stat.h ) | |
1361 | case "$target_canonical" in m88k-*-sysv3* ) | |
1362 | if ( test -n "`egrep '#define[ ]+S_IS[A-Z]*(m)[ ]' $file`" | |
1363 | ) > /dev/null 2>&1 ; then | |
1364 | fixlist="${fixlist} | |
1365 | m88k_bad_s_if" | |
1366 | if [ ! -r ${DESTDIR}/$file ] | |
1367 | then infile=$file | |
1368 | else infile=${DESTDIR}/$file ; fi | |
1369 | ||
1370 | sed -e 's/^\(#define[ ]*S_IS[A-Z]*(m)\)[ ]*(m[ ]*&[ ]*\(S_IF[A-Z][A-Z][A-Z][A-Z]*\)[ ]*)/\1 (((m)\&S_IFMT)==\2)/' \ | |
1371 | -e 's/^\(#define[ ]*S_IS[A-Z]*(m)\)[ ]*(m[ ]*&[ ]*\(0[0-9]*\)[ ]*)/\1 (((m)\&S_IFMT)==\2)/' \ | |
1372 | < $infile > ${DESTDIR}/$file. | |
1373 | ||
1374 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1375 | fi # end of selection 'if' | |
1376 | ;; # case end for machine type test | |
1377 | esac | |
1378 | ;; # case end for file name test | |
1379 | esac | |
1380 | ||
1381 | ||
1382 | # | |
1383 | # Fix 45: M88k_Multi_Incl | |
1384 | # | |
1385 | case "$file" in ./time.h ) | |
1386 | case "$target_canonical" in m88k-tektronix-sysv3* ) | |
1387 | if ( test -z "`egrep '#ifndef' $file`" | |
1388 | ) > /dev/null 2>&1 ; then | |
1389 | fixlist="${fixlist} | |
1390 | m88k_multi_incl" | |
1391 | if [ ! -r ${DESTDIR}/$file ] | |
1392 | then infile=$file | |
1393 | else infile=${DESTDIR}/$file ; fi | |
1394 | ( echo Fixing $file, to protect against multiple inclusion. >&2 | |
1395 | cpp_wrapper=`echo $file | sed -e 's,\.,_,g' -e 's,/,_,g'` | |
1396 | sed -e "1i\ | |
1397 | #ifndef __GCC_GOT_${cpp_wrapper}_\ | |
1398 | #define __GCC_GOT_${cpp_wrapper}_\ | |
1399 | " \ | |
1400 | -e "$a\ | |
1401 | #endif /* ! __GCC_GOT_${cpp_wrapper}_ */ | |
1402 | " ) < $infile > ${DESTDIR}/$file. | |
1403 | ||
1404 | # Shell scripts have the potential of removing the output | |
1405 | # We interpret that to mean the file is not to be altered | |
1406 | # | |
1407 | if test ! -f ${DESTDIR}/$file. | |
1408 | then continue ; fi | |
1409 | ||
1410 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1411 | fi # end of selection 'if' | |
1412 | ;; # case end for machine type test | |
1413 | esac | |
1414 | ;; # case end for file name test | |
1415 | esac | |
1416 | ||
1417 | ||
1418 | # | |
1419 | # Fix 46: Machine_Name | |
1420 | # | |
1421 | if ( test -n "`egrep '^#[ ]*(if|elif).*[^a-zA-Z0-9_](_*[MSRrhim]|[Mbimnpstuv])[a-zA-Z0-9_]' $file`" | |
1422 | ) > /dev/null 2>&1 ; then | |
1423 | fixlist="${fixlist} | |
1424 | machine_name" | |
1425 | if [ ! -r ${DESTDIR}/$file ] | |
1426 | then infile=$file | |
1427 | else infile=${DESTDIR}/$file ; fi | |
1428 | ||
1429 | sed -e ':loop | |
1430 | /\\$/N | |
1431 | s/\\$/\\+++fixinc_eol+++/ | |
1432 | /\\$/b loop | |
1433 | s/\\+++fixinc_eol+++/\\/g | |
1434 | /#[ ]*[el]*if/ { | |
1435 | s/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g | |
1436 | s/ M32 / __M32__ /g | |
1437 | s/ _*MIPSE\([LB]\) / __MIPSE\1__ /g | |
1438 | s/ _*SYSTYPE_\([A-Z0-9]*\) / __SYSTYPE_\1__ /g | |
1439 | s/ _*\([Rr][34]\)000 / __\1000__ /g | |
1440 | s/ _*host_mips / __host_mips__ /g | |
1441 | s/ _*i386 / __i386__ /g | |
1442 | s/ _*mips / __mips__ /g | |
1443 | s/ bsd4\([0-9]\) / __bsd4\1__ /g | |
1444 | s/ is68k / __is68k__ /g | |
1445 | s/ m68k / __m68k__ /g | |
1446 | s/ m88k / __m88k__ /g | |
1447 | s/ mc680\([0-9]\)0 / __mc680\10__ /g | |
1448 | s/ news\([0-9]*\) / __news\1__ /g | |
1449 | s/ ns32000 / __ns32000__ /g | |
1450 | s/ pdp11 / __pdp11__ /g | |
1451 | s/ pyr / __pyr__ /g | |
1452 | s/ sel / __sel__ /g | |
1453 | s/ sony_news / __sony_news__ /g | |
1454 | s/ sparc / __sparc__ /g | |
1455 | s/ sun\([a-z0-9]*\) / __sun\1__ /g | |
1456 | s/ tahoe / __tahoe__ /g | |
1457 | s/ tower\([_0-9]*\) / __tower\1__ /g | |
1458 | s/ u370 / __u370__ /g | |
1459 | s/ u3b\([0-9]*\) / __u3b\1__ /g | |
1460 | s/ unix / __unix__ /g | |
1461 | s/ vax / __vax__ /g | |
1462 | s/ \([a-zA-Z0-9_][a-zA-Z0-9_]*\) /\1/g | |
1463 | }' \ | |
1464 | < $infile > ${DESTDIR}/$file. | |
1465 | ||
1466 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1467 | fi # end of selection 'if' | |
1468 | ||
1469 | ||
1470 | # | |
1471 | # Fix 47: Math_Exception | |
1472 | # | |
1473 | case "$file" in ./math.h ) | |
1474 | if ( test -n "`egrep 'struct exception' $file`" | |
1475 | ) > /dev/null 2>&1 ; then | |
1476 | fixlist="${fixlist} | |
1477 | math_exception" | |
1478 | if [ ! -r ${DESTDIR}/$file ] | |
1479 | then infile=$file | |
1480 | else infile=${DESTDIR}/$file ; fi | |
1481 | ||
1482 | sed -e '/struct exception/i\ | |
1483 | #ifdef __cplusplus\ | |
1484 | #define exception __math_exception\ | |
1485 | #endif | |
1486 | ' \ | |
1487 | -e '/struct exception/a\ | |
1488 | #ifdef __cplusplus\ | |
1489 | #undef exception\ | |
1490 | #endif | |
1491 | ' \ | |
1492 | -e '/matherr/i\ | |
1493 | #ifdef __cplusplus\ | |
1494 | #define exception __math_exception\ | |
1495 | #endif | |
1496 | ' \ | |
1497 | -e '/matherr/a\ | |
1498 | #ifdef __cplusplus\ | |
1499 | #undef exception\ | |
1500 | #endif | |
1501 | ' \ | |
1502 | < $infile > ${DESTDIR}/$file. | |
1503 | ||
1504 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1505 | fi # end of selection 'if' | |
1506 | ;; # case end for file name test | |
1507 | esac | |
1508 | ||
1509 | ||
1510 | # | |
1511 | # Fix 48: Math_Gcc_Ifndefs | |
1512 | # | |
1513 | case "$file" in ./math.h ) | |
1514 | fixlist="${fixlist} | |
1515 | math_gcc_ifndefs" | |
1516 | if [ ! -r ${DESTDIR}/$file ] | |
1517 | then infile=$file | |
1518 | else infile=${DESTDIR}/$file ; fi | |
1519 | ( dbl_max_def="`egrep 'define[ ]+DBL_MAX[ ]+.*' ${SRCDIR}/float.h 2>/dev/null`" | |
1520 | ||
1521 | if ( test -n "${dbl_max_def}" \ | |
1522 | -a -n "`egrep '#define[ ]*HUGE_VAL[ ]+DBL_MAX' $file`" \ | |
1523 | -a -z "`egrep '#define[ ]+DBL_MAX[ ]+' $file`" | |
1524 | ) > /dev/null 2>&1 | |
1525 | then sed -e '/define[ ]HUGE_VAL[ ]/i\ | |
1526 | #ifndef HUGE_VAL | |
1527 | ' \ | |
1528 | -e '/define[ ]HUGE_VAL[ ]/a\ | |
1529 | #endif | |
1530 | '\ | |
1531 | -e "/define[ ]HUGE_VAL[ ]DBL_MAX/s/DBL_MAX/$dbl_max_def/" | |
1532 | else sed -e '/define[ ]HUGE_VAL[ ]/i\ | |
1533 | #ifndef HUGE_VAL | |
1534 | ' \ | |
1535 | -e '/define[ ]HUGE_VAL[ ]/a\ | |
1536 | #endif | |
1537 | ' | |
1538 | fi ) < $infile > ${DESTDIR}/$file. | |
1539 | ||
1540 | # Shell scripts have the potential of removing the output | |
1541 | # We interpret that to mean the file is not to be altered | |
1542 | # | |
1543 | if test ! -f ${DESTDIR}/$file. | |
1544 | then continue ; fi | |
1545 | ||
1546 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1547 | ;; # case end for file name test | |
1548 | esac | |
1549 | ||
1550 | ||
1551 | # | |
1552 | # Fix 49: Motorola_Stupid_Opt | |
1553 | # | |
1554 | case "$file" in ./math.h ) | |
1555 | case "$target_canonical" in m88k-motorola-sysv3* ) | |
1556 | if ( test -n "`egrep '^extern double hypot();$' $file`" | |
1557 | ) > /dev/null 2>&1 ; then | |
1558 | fixlist="${fixlist} | |
1559 | motorola_stupid_opt" | |
1560 | if [ ! -r ${DESTDIR}/$file ] | |
1561 | then infile=$file | |
1562 | else infile=${DESTDIR}/$file ; fi | |
1563 | ||
1564 | sed -e '/^extern double hypot();$/a\ | |
1565 | \/* Workaround a stupid Motorola optimization if one\ | |
1566 | of x or y is 0.0 and the other is negative! *\/\ | |
1567 | #ifdef __STDC__\ | |
1568 | static __inline__ double fake_hypot (double x, double y)\ | |
1569 | #else\ | |
1570 | static __inline__ double fake_hypot (x, y)\ | |
1571 | double x, y;\ | |
1572 | #endif\ | |
1573 | {\ | |
1574 | return fabs (hypot (x, y));\ | |
1575 | }\ | |
1576 | #define hypot fake_hypot | |
1577 | ' \ | |
1578 | < $infile > ${DESTDIR}/$file. | |
1579 | ||
1580 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1581 | fi # end of selection 'if' | |
1582 | ;; # case end for machine type test | |
1583 | esac | |
1584 | ;; # case end for file name test | |
1585 | esac | |
1586 | ||
1587 | ||
1588 | # | |
1589 | # Fix 50: Nested_Comment | |
1590 | # | |
1591 | case "$file" in ./rpc/rpc.h ) | |
1592 | fixlist="${fixlist} | |
1593 | nested_comment" | |
1594 | if [ ! -r ${DESTDIR}/$file ] | |
1595 | then infile=$file | |
1596 | else infile=${DESTDIR}/$file ; fi | |
1597 | ||
1598 | sed -e 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@' \ | |
1599 | < $infile > ${DESTDIR}/$file. | |
1600 | ||
1601 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1602 | ;; # case end for file name test | |
1603 | esac | |
1604 | ||
1605 | ||
1606 | # | |
1607 | # Fix 51: News_Os_Recursion | |
1608 | # | |
1609 | case "$file" in ./stdlib.h ) | |
1610 | if ( test -n "`egrep '#include <stdlib.h>' $file`" | |
1611 | ) > /dev/null 2>&1 ; then | |
1612 | fixlist="${fixlist} | |
1613 | news_os_recursion" | |
1614 | if [ ! -r ${DESTDIR}/$file ] | |
1615 | then infile=$file | |
1616 | else infile=${DESTDIR}/$file ; fi | |
1617 | ||
1618 | sed -e '/^#include <stdlib.h>/i\ | |
1619 | #ifdef BOGUS_RECURSION | |
1620 | ' \ | |
1621 | -e '/^#include <stdlib.h>/a\ | |
1622 | #endif | |
1623 | ' \ | |
1624 | < $infile > ${DESTDIR}/$file. | |
1625 | ||
1626 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1627 | fi # end of selection 'if' | |
1628 | ;; # case end for file name test | |
1629 | esac | |
1630 | ||
1631 | ||
1632 | # | |
1633 | # Fix 52: Next_Math_Prefix | |
1634 | # | |
1635 | case "$file" in ./ansi/math.h ) | |
1636 | if ( test -n "`egrep '^extern.*double.*__const__.*' $file`" | |
1637 | ) > /dev/null 2>&1 ; then | |
1638 | fixlist="${fixlist} | |
1639 | next_math_prefix" | |
1640 | if [ ! -r ${DESTDIR}/$file ] | |
1641 | then infile=$file | |
1642 | else infile=${DESTDIR}/$file ; fi | |
1643 | ||
1644 | sed -e '/^extern.*double.*__const__.*sqrt(/s/__const__//' \ | |
1645 | -e '/^extern.*double.*__const__.*fabs(/s/__const__//' \ | |
1646 | -e '/^extern.*double.*__const__.*cos(/s/__const__//' \ | |
1647 | -e '/^extern.*double.*__const__.*hypot(/s/__const__//' \ | |
1648 | -e '/^extern.*double.*__const__.*sin(/s/__const__//' \ | |
1649 | < $infile > ${DESTDIR}/$file. | |
1650 | ||
1651 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1652 | fi # end of selection 'if' | |
1653 | ;; # case end for file name test | |
1654 | esac | |
1655 | ||
1656 | ||
1657 | # | |
1658 | # Fix 53: Next_Template | |
1659 | # | |
1660 | case "$file" in ./bsd/libc.h ) | |
1661 | if ( test -n "`egrep 'template' $file`" | |
1662 | ) > /dev/null 2>&1 ; then | |
1663 | fixlist="${fixlist} | |
1664 | next_template" | |
1665 | if [ ! -r ${DESTDIR}/$file ] | |
1666 | then infile=$file | |
1667 | else infile=${DESTDIR}/$file ; fi | |
1668 | ||
1669 | sed -e '/\(.*template\)/s/template//' \ | |
1670 | -e '/extern.*volatile.*void.*abort/s/volatile//' \ | |
1671 | < $infile > ${DESTDIR}/$file. | |
1672 | ||
1673 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1674 | fi # end of selection 'if' | |
1675 | ;; # case end for file name test | |
1676 | esac | |
1677 | ||
1678 | ||
1679 | # | |
1680 | # Fix 54: Next_Volitile | |
1681 | # | |
1682 | case "$file" in ./ansi/stdlib.h ) | |
1683 | if ( test -n "`egrep 'volatile' $file`" | |
1684 | ) > /dev/null 2>&1 ; then | |
1685 | fixlist="${fixlist} | |
1686 | next_volitile" | |
1687 | if [ ! -r ${DESTDIR}/$file ] | |
1688 | then infile=$file | |
1689 | else infile=${DESTDIR}/$file ; fi | |
1690 | ||
1691 | sed -e '/extern.*volatile.*void.*exit/s/volatile//' \ | |
1692 | -e '/extern.*volatile.*void.*abort/s/volatile//' \ | |
1693 | < $infile > ${DESTDIR}/$file. | |
1694 | ||
1695 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1696 | fi # end of selection 'if' | |
1697 | ;; # case end for file name test | |
1698 | esac | |
1699 | ||
1700 | ||
1701 | # | |
1702 | # Fix 55: Next_Wait_Union | |
1703 | # | |
1704 | case "$file" in ./sys/wait.h ) | |
1705 | if ( test -n "`egrep 'wait\\(union wait' $file`" | |
1706 | ) > /dev/null 2>&1 ; then | |
1707 | fixlist="${fixlist} | |
1708 | next_wait_union" | |
1709 | if [ ! -r ${DESTDIR}/$file ] | |
1710 | then infile=$file | |
1711 | else infile=${DESTDIR}/$file ; fi | |
1712 | ||
1713 | sed -e 's@wait(union wait@wait(void@' \ | |
1714 | < $infile > ${DESTDIR}/$file. | |
1715 | ||
1716 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1717 | fi # end of selection 'if' | |
1718 | ;; # case end for file name test | |
1719 | esac | |
1720 | ||
1721 | ||
1722 | # | |
1723 | # Fix 56: Nodeent_Syntax | |
1724 | # | |
1725 | case "$file" in ./netdnet/dnetdb.h ) | |
1726 | fixlist="${fixlist} | |
1727 | nodeent_syntax" | |
1728 | if [ ! -r ${DESTDIR}/$file ] | |
1729 | then infile=$file | |
1730 | else infile=${DESTDIR}/$file ; fi | |
1731 | ||
1732 | sed -e 's/char.*na_addr *$/char *na_addr;/' \ | |
1733 | < $infile > ${DESTDIR}/$file. | |
1734 | ||
1735 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1736 | ;; # case end for file name test | |
1737 | esac | |
1738 | ||
1739 | ||
1740 | # | |
1741 | # Fix 57: Osf_Namespace_A | |
1742 | # | |
1743 | case "$file" in ./reg_types.h | \ | |
1744 | ./sys/lc_core.h ) | |
1745 | if ( test '(' -r reg_types.h-a -r sys/lc_core.h-a -n "`grep '} regex_t;' reg_types.h`"-a -z "`grep __regex_t regex.h`" ')' | |
1746 | ) > /dev/null 2>&1 ; then | |
1747 | fixlist="${fixlist} | |
1748 | osf_namespace_a" | |
1749 | if [ ! -r ${DESTDIR}/$file ] | |
1750 | then infile=$file | |
1751 | else infile=${DESTDIR}/$file ; fi | |
1752 | ||
1753 | sed -e 's/regex_t/__regex_t/g' \ | |
1754 | -e 's/regoff_t/__regoff_t/g' \ | |
1755 | -e 's/regmatch_t/__regmatch_t/g' \ | |
1756 | < $infile > ${DESTDIR}/$file. | |
1757 | ||
1758 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1759 | fi # end of selection 'if' | |
1760 | ;; # case end for file name test | |
1761 | esac | |
1762 | ||
1763 | ||
1764 | # | |
1765 | # Fix 58: Osf_Namespace_B | |
1766 | # | |
1767 | case "$file" in ./regex.h ) | |
1768 | if ( test '(' -r reg_types.h-a -r sys/lc_core.h-a -n "`grep '} regex_t;' reg_types.h`"-a -z "`grep __regex_t regex.h`" ')' | |
1769 | ) > /dev/null 2>&1 ; then | |
1770 | fixlist="${fixlist} | |
1771 | osf_namespace_b" | |
1772 | if [ ! -r ${DESTDIR}/$file ] | |
1773 | then infile=$file | |
1774 | else infile=${DESTDIR}/$file ; fi | |
1775 | ||
1776 | sed -e '/#include <reg_types.h>/a\ | |
1777 | typedef __regex_t regex_t;\ | |
1778 | typedef __regoff_t regoff_t;\ | |
1779 | typedef __regmatch_t regmatch_t; | |
1780 | ' \ | |
1781 | < $infile > ${DESTDIR}/$file. | |
1782 | ||
1783 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1784 | fi # end of selection 'if' | |
1785 | ;; # case end for file name test | |
1786 | esac | |
1787 | ||
1788 | ||
1789 | # | |
1790 | # Fix 59: Pthread_Page_Size | |
1791 | # | |
1792 | case "$file" in ./pthread.h ) | |
1793 | if ( test -n "`egrep '^int __page_size' $file`" | |
1794 | ) > /dev/null 2>&1 ; then | |
1795 | fixlist="${fixlist} | |
1796 | pthread_page_size" | |
1797 | if [ ! -r ${DESTDIR}/$file ] | |
1798 | then infile=$file | |
1799 | else infile=${DESTDIR}/$file ; fi | |
1800 | ||
1801 | sed -e 's/^int __page_size/extern int __page_size/' \ | |
1802 | < $infile > ${DESTDIR}/$file. | |
1803 | ||
1804 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1805 | fi # end of selection 'if' | |
1806 | ;; # case end for file name test | |
1807 | esac | |
1808 | ||
1809 | ||
1810 | # | |
1811 | # Fix 60: Rs6000_Double | |
1812 | # | |
1813 | case "$file" in ./math.h ) | |
1814 | if ( test -n "`egrep '[^a-zA-Z_]class\\(' $file`" | |
1815 | ) > /dev/null 2>&1 ; then | |
1816 | fixlist="${fixlist} | |
1817 | rs6000_double" | |
1818 | if [ ! -r ${DESTDIR}/$file ] | |
1819 | then infile=$file | |
1820 | else infile=${DESTDIR}/$file ; fi | |
1821 | ||
1822 | sed -e '/class[(]/i\ | |
1823 | #ifndef __cplusplus | |
1824 | ' \ | |
1825 | -e '/class[(]/a\ | |
1826 | #endif | |
1827 | ' \ | |
1828 | < $infile > ${DESTDIR}/$file. | |
1829 | ||
1830 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1831 | fi # end of selection 'if' | |
1832 | ;; # case end for file name test | |
1833 | esac | |
1834 | ||
1835 | ||
1836 | # | |
1837 | # Fix 61: Rs6000_Fchmod | |
1838 | # | |
1839 | case "$file" in ./sys/stat.h ) | |
1840 | if ( test -n "`egrep 'fchmod\\(char' $file`" | |
1841 | ) > /dev/null 2>&1 ; then | |
1842 | fixlist="${fixlist} | |
1843 | rs6000_fchmod" | |
1844 | if [ ! -r ${DESTDIR}/$file ] | |
1845 | then infile=$file | |
1846 | else infile=${DESTDIR}/$file ; fi | |
1847 | ||
1848 | sed -e 's/fchmod(char \*/fchmod(int/' \ | |
1849 | < $infile > ${DESTDIR}/$file. | |
1850 | ||
1851 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1852 | fi # end of selection 'if' | |
1853 | ;; # case end for file name test | |
1854 | esac | |
1855 | ||
1856 | ||
1857 | # | |
1858 | # Fix 62: Rs6000_Param | |
1859 | # | |
1860 | case "$file" in ./stdio.h | \ | |
1861 | ./unistd.h ) | |
1862 | fixlist="${fixlist} | |
1863 | rs6000_param" | |
1864 | if [ ! -r ${DESTDIR}/$file ] | |
1865 | then infile=$file | |
1866 | else infile=${DESTDIR}/$file ; fi | |
1867 | ||
1868 | sed -e 's@rename(const char \*old, const char \*new)@rename(const char *_old, const char *_new)@' \ | |
1869 | < $infile > ${DESTDIR}/$file. | |
1870 | ||
1871 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1872 | ;; # case end for file name test | |
1873 | esac | |
1874 | ||
1875 | ||
1876 | # | |
1877 | # Fix 63: Sony_Include | |
1878 | # | |
1879 | case "$file" in ./machine/machparam.h ) | |
1880 | if ( test -n "`egrep '\"\\.\\./machine/endian.h\"' $file`" | |
1881 | ) > /dev/null 2>&1 ; then | |
1882 | fixlist="${fixlist} | |
1883 | sony_include" | |
1884 | if [ ! -r ${DESTDIR}/$file ] | |
1885 | then infile=$file | |
1886 | else infile=${DESTDIR}/$file ; fi | |
1887 | ||
1888 | sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \ | |
1889 | < $infile > ${DESTDIR}/$file. | |
1890 | ||
1891 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1892 | fi # end of selection 'if' | |
1893 | ;; # case end for file name test | |
1894 | esac | |
1895 | ||
1896 | ||
1897 | # | |
1898 | # Fix 64: Statsswtch | |
1899 | # | |
1900 | case "$file" in ./rpcsvc/rstat.h ) | |
1901 | if ( test -n "`egrep 'boottime$' $file`" | |
1902 | ) > /dev/null 2>&1 ; then | |
1903 | fixlist="${fixlist} | |
1904 | statsswtch" | |
1905 | if [ ! -r ${DESTDIR}/$file ] | |
1906 | then infile=$file | |
1907 | else infile=${DESTDIR}/$file ; fi | |
1908 | ||
1909 | sed -e 's/boottime$/boottime;/' \ | |
1910 | < $infile > ${DESTDIR}/$file. | |
1911 | ||
1912 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1913 | fi # end of selection 'if' | |
1914 | ;; # case end for file name test | |
1915 | esac | |
1916 | ||
1917 | ||
1918 | # | |
1919 | # Fix 65: Stdio_Va_List | |
1920 | # | |
1921 | case "$file" in ./stdio.h ) | |
1922 | fixlist="${fixlist} | |
1923 | stdio_va_list" | |
1924 | if [ ! -r ${DESTDIR}/$file ] | |
1925 | then infile=$file | |
1926 | else infile=${DESTDIR}/$file ; fi | |
1927 | ( if ( egrep "__need___va_list" $file ) > /dev/null 2>&1 ; then | |
1928 | : | |
1929 | else | |
1930 | echo "#define __need___va_list" | |
1931 | echo "#include <stdarg.h>" | |
1932 | fi | |
1933 | ||
1934 | sed -e 's@ va_list @ __gnuc_va_list @' \ | |
1935 | -e 's@ va_list)@ __gnuc_va_list)@' \ | |
1936 | -e 's@ _BSD_VA_LIST_));@ __gnuc_va_list));@' \ | |
1937 | -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \ | |
1938 | -e 's@ va_list@ __va_list__@' \ | |
1939 | -e 's@\*va_list@*__va_list__@' \ | |
1940 | -e 's@ __va_list)@ __gnuc_va_list)@' \ | |
1941 | -e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \ | |
1942 | -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \ | |
1943 | -e 's@VA_LIST@DUMMY_VA_LIST@' \ | |
1944 | -e 's@_Va_LIST@_VA_LIST@' ) < $infile > ${DESTDIR}/$file. | |
1945 | ||
1946 | # Shell scripts have the potential of removing the output | |
1947 | # We interpret that to mean the file is not to be altered | |
1948 | # | |
1949 | if test ! -f ${DESTDIR}/$file. | |
1950 | then continue ; fi | |
1951 | ||
1952 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1953 | ;; # case end for file name test | |
1954 | esac | |
1955 | ||
1956 | ||
1957 | # | |
1958 | # Fix 66: Sun_Bogus_Ifdef | |
1959 | # | |
1960 | case "$file" in ./hsfs/hsfs_spec.h | \ | |
1961 | ./hsfs/iso_spec.h ) | |
1962 | if ( test -n "`egrep '#ifdef __i386__ || __vax__' $file`" | |
1963 | ) > /dev/null 2>&1 ; then | |
1964 | fixlist="${fixlist} | |
1965 | sun_bogus_ifdef" | |
1966 | if [ ! -r ${DESTDIR}/$file ] | |
1967 | then infile=$file | |
1968 | else infile=${DESTDIR}/$file ; fi | |
1969 | ||
1970 | sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \ | |
1971 | < $infile > ${DESTDIR}/$file. | |
1972 | ||
1973 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1974 | fi # end of selection 'if' | |
1975 | ;; # case end for file name test | |
1976 | esac | |
1977 | ||
1978 | ||
1979 | # | |
1980 | # Fix 67: Sun_Bogus_Ifdef_Sun4c | |
1981 | # | |
1982 | case "$file" in ./hsfs/hsnode.h ) | |
1983 | if ( test -n "`egrep '#ifdef __i386__ || __sun4c__' $file`" | |
1984 | ) > /dev/null 2>&1 ; then | |
1985 | fixlist="${fixlist} | |
1986 | sun_bogus_ifdef_sun4c" | |
1987 | if [ ! -r ${DESTDIR}/$file ] | |
1988 | then infile=$file | |
1989 | else infile=${DESTDIR}/$file ; fi | |
1990 | ||
1991 | sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \ | |
1992 | < $infile > ${DESTDIR}/$file. | |
1993 | ||
1994 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
1995 | fi # end of selection 'if' | |
1996 | ;; # case end for file name test | |
1997 | esac | |
1998 | ||
1999 | ||
2000 | # | |
2001 | # Fix 68: Sun_Catmacro | |
2002 | # | |
2003 | case "$file" in ./pixrect/memvar.h ) | |
2004 | if ( test -n "`egrep '^#define[ ]+CAT(a,b)' $file`" | |
2005 | ) > /dev/null 2>&1 ; then | |
2006 | fixlist="${fixlist} | |
2007 | sun_catmacro" | |
2008 | if [ ! -r ${DESTDIR}/$file ] | |
2009 | then infile=$file | |
2010 | else infile=${DESTDIR}/$file ; fi | |
2011 | ||
2012 | sed -e '/^#define[ ]CAT(a,b)/ i\ | |
2013 | #ifdef __STDC__ \ | |
2014 | #define CAT(a,b) a##b\ | |
2015 | #else | |
2016 | ' \ | |
2017 | -e '/^#define[ ]CAT(a,b)/ a\ | |
2018 | #endif | |
2019 | ' \ | |
2020 | < $infile > ${DESTDIR}/$file. | |
2021 | ||
2022 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2023 | fi # end of selection 'if' | |
2024 | ;; # case end for file name test | |
2025 | esac | |
2026 | ||
2027 | ||
2028 | # | |
2029 | # Fix 69: Sun_Malloc | |
2030 | # | |
2031 | case "$file" in ./malloc.h ) | |
2032 | fixlist="${fixlist} | |
2033 | sun_malloc" | |
2034 | if [ ! -r ${DESTDIR}/$file ] | |
2035 | then infile=$file | |
2036 | else infile=${DESTDIR}/$file ; fi | |
2037 | ||
2038 | sed -e 's/typedef[ ]char \* malloc_t/typedef void \* malloc_t/g' \ | |
2039 | -e 's/int[ ][ ]*free/void free/g' \ | |
2040 | -e 's/char\([ ]*\*[ ]*malloc\)/void\1/g' \ | |
2041 | -e 's/char\([ ]*\*[ ]*realloc\)/void\1/g' \ | |
2042 | < $infile > ${DESTDIR}/$file. | |
2043 | ||
2044 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2045 | ;; # case end for file name test | |
2046 | esac | |
2047 | ||
2048 | ||
2049 | # | |
2050 | # Fix 70: Sun_Memcpy | |
2051 | # | |
2052 | case "$file" in ./memory.h ) | |
2053 | if ( test -n "`egrep '/\\* @\\(#\\)(head/memory.h 50.1 |memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2 )\\*/' $file`" | |
2054 | ) > /dev/null 2>&1 ; then | |
2055 | fixlist="${fixlist} | |
2056 | sun_memcpy" | |
2057 | if [ ! -r ${DESTDIR}/$file ] | |
2058 | then infile=$file | |
2059 | else infile=${DESTDIR}/$file ; fi | |
2060 | ||
2061 | sed -e '1i\ | |
2062 | /* This file was generated by fixincludes */\ | |
2063 | #ifndef __memory_h__\ | |
2064 | #define __memory_h__\ | |
2065 | \ | |
2066 | #ifdef __STDC__\ | |
2067 | extern void *memccpy();\ | |
2068 | extern void *memchr();\ | |
2069 | extern void *memcpy();\ | |
2070 | extern void *memset();\ | |
2071 | #else\ | |
2072 | extern char *memccpy();\ | |
2073 | extern char *memchr();\ | |
2074 | extern char *memcpy();\ | |
2075 | extern char *memset();\ | |
2076 | #endif /* __STDC__ */\ | |
2077 | \ | |
2078 | extern int memcmp();\ | |
2079 | \ | |
2080 | #endif /* __memory_h__ */ | |
2081 | ' \ | |
2082 | -e '1,$d' \ | |
2083 | < $infile > ${DESTDIR}/$file. | |
2084 | ||
2085 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2086 | fi # end of selection 'if' | |
2087 | ;; # case end for file name test | |
2088 | esac | |
2089 | ||
2090 | ||
2091 | # | |
2092 | # Fix 71: Sun_Rusers_Semi | |
2093 | # | |
2094 | case "$file" in ./rpcsvc/rusers.h ) | |
2095 | if ( test -n "`egrep '_cnt$' $file`" | |
2096 | ) > /dev/null 2>&1 ; then | |
2097 | fixlist="${fixlist} | |
2098 | sun_rusers_semi" | |
2099 | if [ ! -r ${DESTDIR}/$file ] | |
2100 | then infile=$file | |
2101 | else infile=${DESTDIR}/$file ; fi | |
2102 | ||
2103 | sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' \ | |
2104 | < $infile > ${DESTDIR}/$file. | |
2105 | ||
2106 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2107 | fi # end of selection 'if' | |
2108 | ;; # case end for file name test | |
2109 | esac | |
2110 | ||
2111 | ||
2112 | # | |
2113 | # Fix 72: Sun_Signal | |
2114 | # | |
2115 | case "$file" in ./sys/signal.h | \ | |
2116 | ./signal.h ) | |
2117 | if ( test -n "`egrep '^void \\(\\*signal\\(\\)\\)\\(\\);' $file`" | |
2118 | ) > /dev/null 2>&1 ; then | |
2119 | fixlist="${fixlist} | |
2120 | sun_signal" | |
2121 | if [ ! -r ${DESTDIR}/$file ] | |
2122 | then infile=$file | |
2123 | else infile=${DESTDIR}/$file ; fi | |
2124 | ||
2125 | sed -e '/^void (\*signal())();$/i\ | |
2126 | #ifdef __cplusplus\ | |
2127 | void (*signal(...))(...);\ | |
2128 | #else | |
2129 | ' \ | |
2130 | -e '/^void (\*signal())();$/a\ | |
2131 | #endif | |
2132 | ' \ | |
2133 | < $infile > ${DESTDIR}/$file. | |
2134 | ||
2135 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2136 | fi # end of selection 'if' | |
2137 | ;; # case end for file name test | |
2138 | esac | |
2139 | ||
2140 | ||
2141 | # | |
2142 | # Fix 73: Sun_Auth_Proto | |
2143 | # | |
2144 | case "$file" in ./rpc/auth.h | \ | |
2145 | ./rpc/clnt.h | \ | |
2146 | ./rpc/svc.h | \ | |
2147 | ./rpc/xdr.h ) | |
2148 | case "$target_canonical" in *-sun-* ) | |
2149 | if ( test -n "`egrep '\\(\\*[a-z][a-z_]*\\)\\(\\)' $file`" -a \ | |
2150 | -z "`egrep '\\(\\*[a-z][a-z_]*\\)\\([ ]*[a-zA-Z.].*\\)' $file`" | |
2151 | ) > /dev/null 2>&1 ; then | |
2152 | fixlist="${fixlist} | |
2153 | sun_auth_proto" | |
2154 | if [ ! -r ${DESTDIR}/$file ] | |
2155 | then infile=$file | |
2156 | else infile=${DESTDIR}/$file ; fi | |
2157 | ||
2158 | sed -e 's/^\(.*(\*[a-z][a-z_]*)(\)\();.*\)/\ | |
2159 | #ifdef __cplusplus\ | |
2160 | \1...\2\ | |
2161 | #else\ | |
2162 | \1\2\ | |
2163 | #endif/' \ | |
2164 | < $infile > ${DESTDIR}/$file. | |
2165 | ||
2166 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2167 | fi # end of selection 'if' | |
2168 | ;; # case end for machine type test | |
2169 | esac | |
2170 | ;; # case end for file name test | |
2171 | esac | |
2172 | ||
2173 | ||
2174 | # | |
2175 | # Fix 74: Sunos_Large_Macro | |
2176 | # | |
2177 | case "$file" in ./sundev/ipi_error.h ) | |
2178 | fixlist="${fixlist} | |
2179 | sunos_large_macro" | |
2180 | if [ ! -r ${DESTDIR}/$file ] | |
2181 | then infile=$file | |
2182 | else infile=${DESTDIR}/$file ; fi | |
2183 | ( echo "Removing incorrect fix to SunOS <sundev/ipi_error.h>" >&2 | |
2184 | rm -f ${DESTDIR}/$file ${DESTDIR}/$file. | |
2185 | cat > /dev/null ) < $infile > ${DESTDIR}/$file. | |
2186 | ||
2187 | # Shell scripts have the potential of removing the output | |
2188 | # We interpret that to mean the file is not to be altered | |
2189 | # | |
2190 | if test ! -f ${DESTDIR}/$file. | |
2191 | then continue ; fi | |
2192 | ||
2193 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2194 | ;; # case end for file name test | |
2195 | esac | |
2196 | ||
2197 | ||
2198 | # | |
2199 | # Fix 75: Sunos_Matherr_Decl | |
2200 | # | |
2201 | case "$file" in ./math.h ) | |
2202 | if ( test '(' "`fgrep 'struct exception' $file | line`" != 'struct exception {' ')' | |
2203 | ) > /dev/null 2>&1 ; then | |
2204 | fixlist="${fixlist} | |
2205 | sunos_matherr_decl" | |
2206 | if [ ! -r ${DESTDIR}/$file ] | |
2207 | then infile=$file | |
2208 | else infile=${DESTDIR}/$file ; fi | |
2209 | ||
2210 | sed -e '/matherr/i\ | |
2211 | struct exception; | |
2212 | ' \ | |
2213 | < $infile > ${DESTDIR}/$file. | |
2214 | ||
2215 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2216 | fi # end of selection 'if' | |
2217 | ;; # case end for file name test | |
2218 | esac | |
2219 | ||
2220 | ||
2221 | # | |
2222 | # Fix 76: Sunos_Strlen | |
2223 | # | |
2224 | case "$file" in ./strings.h ) | |
2225 | fixlist="${fixlist} | |
2226 | sunos_strlen" | |
2227 | if [ ! -r ${DESTDIR}/$file ] | |
2228 | then infile=$file | |
2229 | else infile=${DESTDIR}/$file ; fi | |
2230 | ||
2231 | sed -e 's/int[ ]*strlen();/__SIZE_TYPE__ strlen();/' \ | |
2232 | < $infile > ${DESTDIR}/$file. | |
2233 | ||
2234 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2235 | ;; # case end for file name test | |
2236 | esac | |
2237 | ||
2238 | ||
2239 | # | |
2240 | # Fix 77: Systypes | |
2241 | # | |
2242 | case "$file" in ./sys/types.h | \ | |
2243 | ./stdlib.h | \ | |
2244 | ./sys/stdtypes.h | \ | |
2245 | ./stddef.h | \ | |
2246 | ./memory.h | \ | |
2247 | ./unistd.h ) | |
2248 | if ( test -n "`egrep 'typedef[ ]+[a-z_][ a-z_]*[ ](size|ptrdiff|wchar)_t' $file`" | |
2249 | ) > /dev/null 2>&1 ; then | |
2250 | fixlist="${fixlist} | |
2251 | systypes" | |
2252 | if [ ! -r ${DESTDIR}/$file ] | |
2253 | then infile=$file | |
2254 | else infile=${DESTDIR}/$file ; fi | |
2255 | ||
2256 | sed -e '/^[ ]*\*[ ]*typedef unsigned int size_t;/N' \ | |
2257 | -e 's/^\([ ]*\*[ ]*typedef unsigned int size_t;\n[ ]*\*\/\)/\1\ | |
2258 | #ifndef __SIZE_TYPE__\ | |
2259 | #define __SIZE_TYPE__ long unsigned int\ | |
2260 | #endif\ | |
2261 | typedef __SIZE_TYPE__ size_t;\ | |
2262 | /' \ | |
2263 | -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/i\ | |
2264 | #ifndef __SIZE_TYPE__\ | |
2265 | #define __SIZE_TYPE__ long unsigned int\ | |
2266 | #endif | |
2267 | ' \ | |
2268 | -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/typedef __SIZE_TYPE__ size_t/' \ | |
2269 | -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/i\ | |
2270 | #ifndef __PTRDIFF_TYPE__\ | |
2271 | #define __PTRDIFF_TYPE__ long int\ | |
2272 | #endif | |
2273 | ' \ | |
2274 | -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/typedef __PTRDIFF_TYPE__ ptrdiff_t/' \ | |
2275 | -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/i\ | |
2276 | #ifndef __WCHAR_TYPE__\ | |
2277 | #define __WCHAR_TYPE__ int\ | |
2278 | #endif\ | |
2279 | #ifndef __cplusplus | |
2280 | ' \ | |
2281 | -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/a\ | |
2282 | #endif | |
2283 | ' \ | |
2284 | -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/typedef __WCHAR_TYPE__ wchar_t/' \ | |
2285 | < $infile > ${DESTDIR}/$file. | |
2286 | ||
2287 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2288 | fi # end of selection 'if' | |
2289 | ;; # case end for file name test | |
2290 | esac | |
2291 | ||
2292 | ||
2293 | # | |
2294 | # Fix 78: Systypes_For_Aix | |
2295 | # | |
2296 | case "$file" in ./sys/types.h ) | |
2297 | if ( test -n "`egrep 'typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t' $file`" -a \ | |
2298 | -z "`egrep '_GCC_SIZE_T' $file`" | |
2299 | ) > /dev/null 2>&1 ; then | |
2300 | fixlist="${fixlist} | |
2301 | systypes_for_aix" | |
2302 | if [ ! -r ${DESTDIR}/$file ] | |
2303 | then infile=$file | |
2304 | else infile=${DESTDIR}/$file ; fi | |
2305 | ||
2306 | sed -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/i\ | |
2307 | #ifndef _GCC_SIZE_T\ | |
2308 | #define _GCC_SIZE_T | |
2309 | ' \ | |
2310 | -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/a\ | |
2311 | #endif | |
2312 | ' \ | |
2313 | < $infile > ${DESTDIR}/$file. | |
2314 | ||
2315 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2316 | fi # end of selection 'if' | |
2317 | ;; # case end for file name test | |
2318 | esac | |
2319 | ||
2320 | ||
2321 | # | |
2322 | # Fix 79: Sysv68_String | |
2323 | # | |
2324 | case "$file" in ./string.h ) | |
2325 | fixlist="${fixlist} | |
2326 | sysv68_string" | |
2327 | if [ ! -r ${DESTDIR}/$file ] | |
2328 | then infile=$file | |
2329 | else infile=${DESTDIR}/$file ; fi | |
2330 | ||
2331 | sed -e 's/extern[ ]*int[ ]*strlen();/extern unsigned int strlen();/' \ | |
2332 | -e 's/extern[ ]*int[ ]*ffs[ ]*(long);/extern int ffs(int);/' \ | |
2333 | -e 's/strdup(char \*s1);/strdup(const char *s1);/' \ | |
2334 | -e '/^extern char$/N' \ | |
2335 | -e 's/^extern char\(\n \*memccpy(),\)$/extern void\1/' \ | |
2336 | -e '/^ strncmp(),$/N' \ | |
2337 | -e 's/^\( strncmp()\),\n\( strlen(),\)$/\1;\ | |
2338 | extern unsigned int\ | |
2339 | \2/' \ | |
2340 | -e '/^extern int$/N' \ | |
2341 | -e 's/^extern int\(\n strlen(),\)/extern size_t\1/' \ | |
2342 | < $infile > ${DESTDIR}/$file. | |
2343 | ||
2344 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2345 | ;; # case end for file name test | |
2346 | esac | |
2347 | ||
2348 | ||
2349 | # | |
2350 | # Fix 80: Sysz_Stdlib_For_Sun | |
2351 | # | |
2352 | case "$file" in ./stdlib.h ) | |
2353 | case "$target_canonical" in *-sun-* | \ | |
2354 | m88k-*-sysv3* ) | |
2355 | fixlist="${fixlist} | |
2356 | sysz_stdlib_for_sun" | |
2357 | if [ ! -r ${DESTDIR}/$file ] | |
2358 | then infile=$file | |
2359 | else infile=${DESTDIR}/$file ; fi | |
2360 | ||
2361 | sed -e 's/int abort/void abort/g' \ | |
2362 | -e 's/int free/void free/g' \ | |
2363 | -e 's/char[ ]*\*[ ]*calloc/void \* calloc/g' \ | |
2364 | -e 's/char[ ]*\*[ ]*malloc/void \* malloc/g' \ | |
2365 | -e 's/char[ ]*\*[ ]*realloc/void \* realloc/g' \ | |
2366 | -e 's/int[ ][ ]*exit/void exit/g' \ | |
2367 | -e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/i\ | |
2368 | #ifndef _GCC_SIZE_T\ | |
2369 | #define _GCC_SIZE_T | |
2370 | ' \ | |
2371 | -e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/a\ | |
2372 | #endif | |
2373 | ' \ | |
2374 | < $infile > ${DESTDIR}/$file. | |
2375 | ||
2376 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2377 | ;; # case end for machine type test | |
2378 | esac | |
2379 | ;; # case end for file name test | |
2380 | esac | |
2381 | ||
2382 | ||
2383 | # | |
2384 | # Fix 81: Sysz_Stdtypes_For_Sun | |
2385 | # | |
2386 | case "$file" in ./sys/stdtypes.h ) | |
2387 | fixlist="${fixlist} | |
2388 | sysz_stdtypes_for_sun" | |
2389 | if [ ! -r ${DESTDIR}/$file ] | |
2390 | then infile=$file | |
2391 | else infile=${DESTDIR}/$file ; fi | |
2392 | ||
2393 | sed -e '/[ ]size_t.*;/i\ | |
2394 | #ifndef _GCC_SIZE_T\ | |
2395 | #define _GCC_SIZE_T | |
2396 | ' \ | |
2397 | -e '/[ ]size_t.*;/a\ | |
2398 | #endif | |
2399 | ' \ | |
2400 | -e '/[ ]ptrdiff_t.*;/i\ | |
2401 | #ifndef _GCC_PTRDIFF_T\ | |
2402 | #define _GCC_PTRDIFF_T | |
2403 | ' \ | |
2404 | -e '/[ ]ptrdiff_t.*;/a\ | |
2405 | #endif | |
2406 | ' \ | |
2407 | -e '/[ ]wchar_t.*;/i\ | |
2408 | #ifndef _GCC_WCHAR_T\ | |
2409 | #define _GCC_WCHAR_T | |
2410 | ' \ | |
2411 | -e '/[ ]wchar_t.*;/a\ | |
2412 | #endif | |
2413 | ' \ | |
2414 | < $infile > ${DESTDIR}/$file. | |
2415 | ||
2416 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2417 | ;; # case end for file name test | |
2418 | esac | |
2419 | ||
2420 | ||
2421 | # | |
2422 | # Fix 82: Tinfo_Cplusplus | |
2423 | # | |
2424 | case "$file" in ./tinfo.h ) | |
2425 | fixlist="${fixlist} | |
2426 | tinfo_cplusplus" | |
2427 | if [ ! -r ${DESTDIR}/$file ] | |
2428 | then infile=$file | |
2429 | else infile=${DESTDIR}/$file ; fi | |
2430 | ||
2431 | sed -e 's/[ ]_cplusplus/ __cplusplus/' \ | |
2432 | < $infile > ${DESTDIR}/$file. | |
2433 | ||
2434 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2435 | ;; # case end for file name test | |
2436 | esac | |
2437 | ||
2438 | ||
2439 | # | |
2440 | # Fix 83: Ultrix_Ansi_Compat | |
2441 | # | |
2442 | case "$file" in ./ansi_compat.h ) | |
2443 | if ( test -n "`egrep 'ULTRIX' $file`" | |
2444 | ) > /dev/null 2>&1 ; then | |
2445 | fixlist="${fixlist} | |
2446 | ultrix_ansi_compat" | |
2447 | if [ ! -r ${DESTDIR}/$file ] | |
2448 | then infile=$file | |
2449 | else infile=${DESTDIR}/$file ; fi | |
2450 | ||
2451 | sed -e '1i\ | |
2452 | /* This file intentionally left blank. */ | |
2453 | ' \ | |
2454 | -e '1,$d' \ | |
2455 | < $infile > ${DESTDIR}/$file. | |
2456 | ||
2457 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2458 | fi # end of selection 'if' | |
2459 | ;; # case end for file name test | |
2460 | esac | |
2461 | ||
2462 | ||
2463 | # | |
1f414ac4 BK |
2464 | # Fix 84: Ultrix_Fix_Fixproto |
2465 | # | |
2466 | case "$file" in ./sys/utsname.h ) | |
2467 | if ( test -n "`egrep 'ULTRIX' $file`" | |
2468 | ) > /dev/null 2>&1 ; then | |
2469 | fixlist="${fixlist} | |
2470 | ultrix_fix_fixproto" | |
2471 | if [ ! -r ${DESTDIR}/$file ] | |
2472 | then infile=$file | |
2473 | else infile=${DESTDIR}/$file ; fi | |
2474 | ||
2475 | sed -e '/^[ ]*extern[ ]*int[ ]*uname();$/i\ | |
2476 | struct utsname; | |
2477 | ' \ | |
2478 | < $infile > ${DESTDIR}/$file. | |
2479 | ||
2480 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2481 | fi # end of selection 'if' | |
2482 | ;; # case end for file name test | |
2483 | esac | |
2484 | ||
2485 | ||
2486 | # | |
2487 | # Fix 85: Ultrix_Atof_Param | |
06bbab1b BK |
2488 | # |
2489 | case "$file" in ./math.h ) | |
2490 | fixlist="${fixlist} | |
2491 | ultrix_atof_param" | |
2492 | if [ ! -r ${DESTDIR}/$file ] | |
2493 | then infile=$file | |
2494 | else infile=${DESTDIR}/$file ; fi | |
2495 | ||
2496 | sed -e 's@atof(\([ ]*char[ ]*\*[^)]*\))@atof(const \1)@' \ | |
2497 | -e 's@inline int abs(int [a-z][a-z]*) {.*}@extern "C" int abs(int);@' \ | |
2498 | -e 's@inline double abs(double [a-z][a-z]*) {.*}@@' \ | |
2499 | -e 's@inline int sqr(int [a-z][a-z]*) {.*}@@' \ | |
2500 | -e 's@inline double sqr(double [a-z][a-z]*) {.*}@@' \ | |
2501 | < $infile > ${DESTDIR}/$file. | |
2502 | ||
2503 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2504 | ;; # case end for file name test | |
2505 | esac | |
2506 | ||
2507 | ||
2508 | # | |
1f414ac4 | 2509 | # Fix 86: Ultrix_Const |
06bbab1b BK |
2510 | # |
2511 | case "$file" in ./stdio.h ) | |
2512 | fixlist="${fixlist} | |
2513 | ultrix_const" | |
2514 | if [ ! -r ${DESTDIR}/$file ] | |
2515 | then infile=$file | |
2516 | else infile=${DESTDIR}/$file ; fi | |
2517 | ||
2518 | sed -e 's@perror( char \*__s );@perror( const char *__s );@' \ | |
2519 | -e 's@fputs( char \*__s,@fputs( const char *__s,@' \ | |
2520 | -e 's@fopen( char \*__filename, char \*__type );@fopen( const char *__filename, const char *__type );@' \ | |
2521 | -e 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@' \ | |
2522 | -e 's@fscanf( FILE \*__stream, char \*__format,@fscanf( FILE *__stream, const char *__format,@' \ | |
2523 | -e 's@scanf( char \*__format,@scanf( const char *__format,@' \ | |
2524 | -e 's@sscanf( char \*__s, char \*__format,@sscanf( const char *__s, const char *__format,@' \ | |
2525 | -e 's@popen(char \*, char \*);@popen(const char *, const char *);@' \ | |
2526 | -e 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@' \ | |
2527 | < $infile > ${DESTDIR}/$file. | |
2528 | ||
2529 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2530 | ;; # case end for file name test | |
2531 | esac | |
2532 | ||
2533 | ||
2534 | # | |
1f414ac4 | 2535 | # Fix 87: Ultrix_Ifdef |
06bbab1b BK |
2536 | # |
2537 | case "$file" in ./sys/file.h ) | |
2538 | if ( test -n "`egrep '#ifdef KERNEL' $file`" | |
2539 | ) > /dev/null 2>&1 ; then | |
2540 | fixlist="${fixlist} | |
2541 | ultrix_ifdef" | |
2542 | if [ ! -r ${DESTDIR}/$file ] | |
2543 | then infile=$file | |
2544 | else infile=${DESTDIR}/$file ; fi | |
2545 | ||
2546 | sed -e 's/#ifdef KERNEL/#if defined(KERNEL)/' \ | |
2547 | < $infile > ${DESTDIR}/$file. | |
2548 | ||
2549 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2550 | fi # end of selection 'if' | |
2551 | ;; # case end for file name test | |
2552 | esac | |
2553 | ||
2554 | ||
2555 | # | |
1f414ac4 | 2556 | # Fix 88: Ultrix_Nested_Cmnt |
06bbab1b BK |
2557 | # |
2558 | case "$file" in ./rpc/svc.h ) | |
2559 | fixlist="${fixlist} | |
2560 | ultrix_nested_cmnt" | |
2561 | if [ ! -r ${DESTDIR}/$file ] | |
2562 | then infile=$file | |
2563 | else infile=${DESTDIR}/$file ; fi | |
2564 | ||
2565 | sed -e 's@^\( \* int protocol; \)/\*@\1*/ /*@' \ | |
2566 | < $infile > ${DESTDIR}/$file. | |
2567 | ||
2568 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2569 | ;; # case end for file name test | |
2570 | esac | |
2571 | ||
2572 | ||
2573 | # | |
1f414ac4 | 2574 | # Fix 89: Ultrix_Static |
06bbab1b BK |
2575 | # |
2576 | case "$file" in ./machine/cpu.h ) | |
2577 | if ( test -n "`egrep '#include \"r[34]_cpu' $file`" | |
2578 | ) > /dev/null 2>&1 ; then | |
2579 | fixlist="${fixlist} | |
2580 | ultrix_static" | |
2581 | if [ ! -r ${DESTDIR}/$file ] | |
2582 | then infile=$file | |
2583 | else infile=${DESTDIR}/$file ; fi | |
2584 | ||
2585 | sed -e 's/^static struct tlb_pid_state/struct tlb_pid_state/' \ | |
2586 | -e 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/' \ | |
2587 | -e 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/' \ | |
2588 | < $infile > ${DESTDIR}/$file. | |
2589 | ||
2590 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2591 | fi # end of selection 'if' | |
2592 | ;; # case end for file name test | |
2593 | esac | |
2594 | ||
2595 | ||
2596 | # | |
1f414ac4 | 2597 | # Fix 90: Undefine_Null |
06bbab1b BK |
2598 | # |
2599 | if ( test -n "`egrep '^#[ ]*define[ ]*[ ]NULL[ ]' $file`" -a \ | |
2600 | -z "`egrep '#[ ]*(ifn|un)def[ ]*[ ]NULL($|[ ])' $file`" | |
2601 | ) > /dev/null 2>&1 ; then | |
2602 | fixlist="${fixlist} | |
2603 | undefine_null" | |
2604 | if [ ! -r ${DESTDIR}/$file ] | |
2605 | then infile=$file | |
2606 | else infile=${DESTDIR}/$file ; fi | |
2607 | ||
2608 | sed -e '/^#[ ]*define[ ][ ]*NULL[ ]/i\ | |
2609 | #undef NULL | |
2610 | ' \ | |
2611 | < $infile > ${DESTDIR}/$file. | |
2612 | ||
2613 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2614 | fi # end of selection 'if' | |
2615 | ||
2616 | ||
2617 | # | |
1f414ac4 | 2618 | # Fix 91: Va_I960_Macro |
06bbab1b BK |
2619 | # |
2620 | case "$file" in ./arch/i960/archI960.h ) | |
2621 | if ( test -n "`egrep '__(vsiz|vali|vpad|alignof__)' $file`" | |
2622 | ) > /dev/null 2>&1 ; then | |
2623 | fixlist="${fixlist} | |
2624 | va_i960_macro" | |
2625 | if [ ! -r ${DESTDIR}/$file ] | |
2626 | then infile=$file | |
2627 | else infile=${DESTDIR}/$file ; fi | |
2628 | ||
2629 | sed -e 's/__vsiz/__vxvsiz/' \ | |
2630 | -e 's/__vali/__vxvali/' \ | |
2631 | -e 's/__vpad/__vxvpad/' \ | |
2632 | -e 's/__alignof__/__vxalignof__/' \ | |
2633 | < $infile > ${DESTDIR}/$file. | |
2634 | ||
2635 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2636 | fi # end of selection 'if' | |
2637 | ;; # case end for file name test | |
2638 | esac | |
2639 | ||
2640 | ||
2641 | # | |
1f414ac4 | 2642 | # Fix 92: Void_Null |
06bbab1b BK |
2643 | # |
2644 | case "$file" in ./curses.h | \ | |
2645 | ./dbm.h | \ | |
2646 | ./locale.h | \ | |
2647 | ./stdio.h | \ | |
2648 | ./stdlib.h | \ | |
2649 | ./string.h | \ | |
2650 | ./time.h | \ | |
2651 | ./unistd.h | \ | |
2652 | ./sys/dir.h | \ | |
2653 | ./sys/param.h | \ | |
2654 | ./sys/types.h ) | |
2655 | if ( test -n "`egrep '#[ ]*define[ ][ ]*NULL[ ].*void' $file`" | |
2656 | ) > /dev/null 2>&1 ; then | |
2657 | fixlist="${fixlist} | |
2658 | void_null" | |
2659 | if [ ! -r ${DESTDIR}/$file ] | |
2660 | then infile=$file | |
2661 | else infile=${DESTDIR}/$file ; fi | |
2662 | ||
2663 | sed -e 's/^#[ ]*define[ ]*NULL[ ]*((void[ ]*\*)0)/#define NULL 0/' \ | |
2664 | < $infile > ${DESTDIR}/$file. | |
2665 | ||
2666 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2667 | fi # end of selection 'if' | |
2668 | ;; # case end for file name test | |
2669 | esac | |
2670 | ||
2671 | ||
2672 | # | |
1f414ac4 | 2673 | # Fix 93: Vxworks_Gcc_Problem |
06bbab1b BK |
2674 | # |
2675 | case "$file" in ./types/vxTypesBase.h ) | |
2676 | if ( test -n "`egrep '__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__' $file`" | |
2677 | ) > /dev/null 2>&1 ; then | |
2678 | fixlist="${fixlist} | |
2679 | vxworks_gcc_problem" | |
2680 | if [ ! -r ${DESTDIR}/$file ] | |
2681 | then infile=$file | |
2682 | else infile=${DESTDIR}/$file ; fi | |
2683 | ||
2684 | sed -e 's/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/#if 1/' \ | |
2685 | -e '/[ ]size_t/i\ | |
2686 | #ifndef _GCC_SIZE_T\ | |
2687 | #define _GCC_SIZE_T | |
2688 | ' \ | |
2689 | -e '/[ ]size_t/a\ | |
2690 | #endif | |
2691 | ' \ | |
2692 | -e '/[ ]ptrdiff_t/i\ | |
2693 | #ifndef _GCC_PTRDIFF_T\ | |
2694 | #define _GCC_PTRDIFF_T | |
2695 | ' \ | |
2696 | -e '/[ ]ptrdiff_t/a\ | |
2697 | #endif | |
2698 | ' \ | |
2699 | -e '/[ ]wchar_t/i\ | |
2700 | #ifndef _GCC_WCHAR_T\ | |
2701 | #define _GCC_WCHAR_T | |
2702 | ' \ | |
2703 | -e '/[ ]wchar_t/a\ | |
2704 | #endif | |
2705 | ' \ | |
2706 | < $infile > ${DESTDIR}/$file. | |
2707 | ||
2708 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2709 | fi # end of selection 'if' | |
2710 | ;; # case end for file name test | |
2711 | esac | |
2712 | ||
2713 | ||
2714 | # | |
1f414ac4 | 2715 | # Fix 94: Vxworks_Needs_Vxtypes |
06bbab1b BK |
2716 | # |
2717 | case "$file" in ./time.h ) | |
2718 | if ( test -n "`egrep 'uint_t[ ][ ]*_clocks_per_sec' $file`" | |
2719 | ) > /dev/null 2>&1 ; then | |
2720 | fixlist="${fixlist} | |
2721 | vxworks_needs_vxtypes" | |
2722 | if [ ! -r ${DESTDIR}/$file ] | |
2723 | then infile=$file | |
2724 | else infile=${DESTDIR}/$file ; fi | |
2725 | ||
2726 | sed -e 's/uint_t/unsigned int/' \ | |
2727 | < $infile > ${DESTDIR}/$file. | |
2728 | ||
2729 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2730 | fi # end of selection 'if' | |
2731 | ;; # case end for file name test | |
2732 | esac | |
2733 | ||
2734 | ||
2735 | # | |
1f414ac4 | 2736 | # Fix 95: Vxworks_Needs_Vxworks |
06bbab1b BK |
2737 | # |
2738 | case "$file" in ./sys/stat.h ) | |
2739 | if ( test -n "`egrep '#[ ]define[ ][ ]*__INCstath' $file`" -a \ | |
2740 | '(' -r types/vxTypesOld.h ')' -a \ | |
2741 | '(' -n "`fgrep '#include' $file`" ')' -a \ | |
2742 | '(' -n "`fgrep ULONG $file`" ')' | |
2743 | ) > /dev/null 2>&1 ; then | |
2744 | fixlist="${fixlist} | |
2745 | vxworks_needs_vxworks" | |
2746 | if [ ! -r ${DESTDIR}/$file ] | |
2747 | then infile=$file | |
2748 | else infile=${DESTDIR}/$file ; fi | |
2749 | ||
2750 | sed -e '/#[ ]define[ ][ ]*__INCstath/a\ | |
2751 | #include <types/vxTypesOld.h> | |
2752 | ' \ | |
2753 | < $infile > ${DESTDIR}/$file. | |
2754 | ||
2755 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2756 | fi # end of selection 'if' | |
2757 | ;; # case end for file name test | |
2758 | esac | |
2759 | ||
2760 | ||
2761 | # | |
1f414ac4 | 2762 | # Fix 96: Vxworks_Time |
06bbab1b BK |
2763 | # |
2764 | case "$file" in ./time.h ) | |
2765 | if ( test -n "`egrep 'VOIDFUNCPTR' $file`" -a \ | |
2766 | '(' -r vxWorks.h ')' | |
2767 | ) > /dev/null 2>&1 ; then | |
2768 | fixlist="${fixlist} | |
2769 | vxworks_time" | |
2770 | if [ ! -r ${DESTDIR}/$file ] | |
2771 | then infile=$file | |
2772 | else infile=${DESTDIR}/$file ; fi | |
2773 | ||
2774 | sed -e '/VOIDFUNCPTR/i\ | |
2775 | #ifndef __gcc_VOIDFUNCPTR_defined\ | |
2776 | #ifdef __cplusplus\ | |
2777 | typedef void (*__gcc_VOIDFUNCPTR) (...);\ | |
2778 | #else\ | |
2779 | typedef void (*__gcc_VOIDFUNCPTR) ();\ | |
2780 | #endif\ | |
2781 | #define __gcc_VOIDFUNCPTR_defined\ | |
2782 | #endif | |
2783 | ' \ | |
2784 | -e 's/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g' \ | |
2785 | < $infile > ${DESTDIR}/$file. | |
2786 | ||
2787 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2788 | fi # end of selection 'if' | |
2789 | ;; # case end for file name test | |
2790 | esac | |
2791 | ||
2792 | ||
2793 | # | |
1f414ac4 | 2794 | # Fix 97: X11_Class |
06bbab1b BK |
2795 | # |
2796 | case "$file" in ./X11/ShellP.h ) | |
2797 | if ( test -z "`egrep '__cplusplus' $file`" | |
2798 | ) > /dev/null 2>&1 ; then | |
2799 | fixlist="${fixlist} | |
2800 | x11_class" | |
2801 | if [ ! -r ${DESTDIR}/$file ] | |
2802 | then infile=$file | |
2803 | else infile=${DESTDIR}/$file ; fi | |
2804 | ||
2805 | sed -e '/char \*class;/i\ | |
2806 | #ifdef __cplusplus\ | |
2807 | char *c_class;\ | |
2808 | #else | |
2809 | ' \ | |
2810 | -e '/char \*class;/a\ | |
2811 | #endif | |
2812 | ' \ | |
2813 | < $infile > ${DESTDIR}/$file. | |
2814 | ||
2815 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2816 | fi # end of selection 'if' | |
2817 | ;; # case end for file name test | |
2818 | esac | |
2819 | ||
2820 | ||
2821 | # | |
1f414ac4 | 2822 | # Fix 98: X11_Class_Usage |
06bbab1b BK |
2823 | # |
2824 | case "$file" in ./Xm/BaseClassI.h ) | |
2825 | if ( test -z "`egrep '__cplusplus' $file`" | |
2826 | ) > /dev/null 2>&1 ; then | |
2827 | fixlist="${fixlist} | |
2828 | x11_class_usage" | |
2829 | if [ ! -r ${DESTDIR}/$file ] | |
2830 | then infile=$file | |
2831 | else infile=${DESTDIR}/$file ; fi | |
2832 | ||
2833 | sed -e 's/ class[)]/ c_class)/g' \ | |
2834 | < $infile > ${DESTDIR}/$file. | |
2835 | ||
2836 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2837 | fi # end of selection 'if' | |
2838 | ;; # case end for file name test | |
2839 | esac | |
2840 | ||
2841 | ||
2842 | # | |
1f414ac4 | 2843 | # Fix 99: X11_New |
06bbab1b BK |
2844 | # |
2845 | case "$file" in ./Xm/Traversal.h ) | |
2846 | if ( test -z "`egrep '__cplusplus' $file`" | |
2847 | ) > /dev/null 2>&1 ; then | |
2848 | fixlist="${fixlist} | |
2849 | x11_new" | |
2850 | if [ ! -r ${DESTDIR}/$file ] | |
2851 | then infile=$file | |
2852 | else infile=${DESTDIR}/$file ; fi | |
2853 | ||
2854 | sed -e '/Widget old, new;/i\ | |
2855 | #ifdef __cplusplus\ | |
2856 | Widget old, c_new;\ | |
2857 | #else | |
2858 | ' \ | |
2859 | -e '/Widget old, new;/a\ | |
2860 | #endif | |
2861 | ' \ | |
2862 | -e 's/Widget new,/Widget c_new,/g' \ | |
2863 | < $infile > ${DESTDIR}/$file. | |
2864 | ||
2865 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2866 | fi # end of selection 'if' | |
2867 | ;; # case end for file name test | |
2868 | esac | |
2869 | ||
2870 | ||
2871 | # | |
1f414ac4 | 2872 | # Fix 100: X11_Sprintf |
06bbab1b BK |
2873 | # |
2874 | case "$file" in ./X11*/Xmu.h ) | |
2875 | fixlist="${fixlist} | |
2876 | x11_sprintf" | |
2877 | if [ ! -r ${DESTDIR}/$file ] | |
2878 | then infile=$file | |
2879 | else infile=${DESTDIR}/$file ; fi | |
2880 | ||
2881 | sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\ | |
2882 | extern char * sprintf();\ | |
2883 | #endif /* !defined __STDC__ */,' \ | |
2884 | < $infile > ${DESTDIR}/$file. | |
2885 | ||
2886 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2887 | ;; # case end for file name test | |
2888 | esac | |
2889 | ||
2890 | ||
2891 | # | |
1f414ac4 | 2892 | # Fix 101: Zzz_Ki_Iface |
06bbab1b BK |
2893 | # |
2894 | case "$file" in ./sys/ki_iface.h ) | |
2895 | if ( test -n "`egrep 'These definitions are for HP Internal developers' $file`" | |
2896 | ) > /dev/null 2>&1 ; then | |
2897 | fixlist="${fixlist} | |
2898 | zzz_ki_iface" | |
2899 | if [ ! -r ${DESTDIR}/$file ] | |
2900 | then infile=$file | |
2901 | else infile=${DESTDIR}/$file ; fi | |
2902 | ( echo "Removing incorrect fix to HP-UX <$file>" >&2 | |
2903 | rm -f ${DESTDIR}/$file ${DESTDIR}/$file. | |
2904 | cat > /dev/null ) < $infile > ${DESTDIR}/$file. | |
2905 | ||
2906 | # Shell scripts have the potential of removing the output | |
2907 | # We interpret that to mean the file is not to be altered | |
2908 | # | |
2909 | if test ! -f ${DESTDIR}/$file. | |
2910 | then continue ; fi | |
2911 | ||
2912 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2913 | fi # end of selection 'if' | |
2914 | ;; # case end for file name test | |
2915 | esac | |
2916 | ||
2917 | ||
2918 | # | |
1f414ac4 | 2919 | # Fix 102: Zzz_Ki |
06bbab1b BK |
2920 | # |
2921 | case "$file" in ./sys/ki.h ) | |
2922 | if ( test -n "`egrep '11.00 HP-UX LP64' $file`" | |
2923 | ) > /dev/null 2>&1 ; then | |
2924 | fixlist="${fixlist} | |
2925 | zzz_ki" | |
2926 | if [ ! -r ${DESTDIR}/$file ] | |
2927 | then infile=$file | |
2928 | else infile=${DESTDIR}/$file ; fi | |
2929 | ( echo "Removing incorrect fix to HP-UX <$file>" >&2 | |
2930 | rm -f ${DESTDIR}/$file ${DESTDIR}/$file. | |
2931 | cat > /dev/null ) < $infile > ${DESTDIR}/$file. | |
2932 | ||
2933 | # Shell scripts have the potential of removing the output | |
2934 | # We interpret that to mean the file is not to be altered | |
2935 | # | |
2936 | if test ! -f ${DESTDIR}/$file. | |
2937 | then continue ; fi | |
2938 | ||
2939 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2940 | fi # end of selection 'if' | |
2941 | ;; # case end for file name test | |
2942 | esac | |
2943 | ||
2944 | ||
2945 | # | |
1f414ac4 | 2946 | # Fix 103: Zzz_Ki_Calls |
06bbab1b BK |
2947 | # |
2948 | case "$file" in ./sys/ki_calls.h ) | |
2949 | if ( test -n "`egrep 'KI_MAX_PROCS is an arbitrary number' $file`" | |
2950 | ) > /dev/null 2>&1 ; then | |
2951 | fixlist="${fixlist} | |
2952 | zzz_ki_calls" | |
2953 | if [ ! -r ${DESTDIR}/$file ] | |
2954 | then infile=$file | |
2955 | else infile=${DESTDIR}/$file ; fi | |
2956 | ( echo "Removing incorrect fix to HP-UX <$file>" >&2 | |
2957 | rm -f ${DESTDIR}/$file ${DESTDIR}/$file. | |
2958 | cat > /dev/null ) < $infile > ${DESTDIR}/$file. | |
2959 | ||
2960 | # Shell scripts have the potential of removing the output | |
2961 | # We interpret that to mean the file is not to be altered | |
2962 | # | |
2963 | if test ! -f ${DESTDIR}/$file. | |
2964 | then continue ; fi | |
2965 | ||
2966 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2967 | fi # end of selection 'if' | |
2968 | ;; # case end for file name test | |
2969 | esac | |
2970 | ||
2971 | ||
2972 | # | |
1f414ac4 | 2973 | # Fix 104: Zzz_Ki_Defs |
06bbab1b BK |
2974 | # |
2975 | case "$file" in ./sys/ki_defs.h ) | |
2976 | if ( test -n "`egrep 'Kernel Instrumentation Definitions' $file`" | |
2977 | ) > /dev/null 2>&1 ; then | |
2978 | fixlist="${fixlist} | |
2979 | zzz_ki_defs" | |
2980 | if [ ! -r ${DESTDIR}/$file ] | |
2981 | then infile=$file | |
2982 | else infile=${DESTDIR}/$file ; fi | |
2983 | ( echo "Removing incorrect fix to HP-UX <$file>" >&2 | |
2984 | rm -f ${DESTDIR}/$file ${DESTDIR}/$file. | |
2985 | cat > /dev/null ) < $infile > ${DESTDIR}/$file. | |
2986 | ||
2987 | # Shell scripts have the potential of removing the output | |
2988 | # We interpret that to mean the file is not to be altered | |
2989 | # | |
2990 | if test ! -f ${DESTDIR}/$file. | |
2991 | then continue ; fi | |
2992 | ||
2993 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
2994 | fi # end of selection 'if' | |
2995 | ;; # case end for file name test | |
2996 | esac | |
2997 | ||
2998 | ||
2999 | # | |
1f414ac4 | 3000 | # Fix 105: Zzz_Time |
06bbab1b BK |
3001 | # |
3002 | case "$file" in ./sys/time.h ) | |
3003 | if ( test -n "`egrep 'For CASPEC, look in' $file`" | |
3004 | ) > /dev/null 2>&1 ; then | |
3005 | fixlist="${fixlist} | |
3006 | zzz_time" | |
3007 | if [ ! -r ${DESTDIR}/$file ] | |
3008 | then infile=$file | |
3009 | else infile=${DESTDIR}/$file ; fi | |
3010 | ( echo "Removing incorrect fix to HP-UX <$file>" >&2 | |
3011 | rm -f ${DESTDIR}/$file ${DESTDIR}/$file. | |
3012 | cat > /dev/null ) < $infile > ${DESTDIR}/$file. | |
3013 | ||
3014 | # Shell scripts have the potential of removing the output | |
3015 | # We interpret that to mean the file is not to be altered | |
3016 | # | |
3017 | if test ! -f ${DESTDIR}/$file. | |
3018 | then continue ; fi | |
3019 | ||
3020 | mv -f ${DESTDIR}/$file. ${DESTDIR}/$file | |
3021 | fi # end of selection 'if' | |
3022 | ;; # case end for file name test | |
3023 | esac | |
3024 | # IF the output has been removed OR it is unchanged, | |
3025 | # THEN ensure the output is gone | |
3026 | # ELSE look for local directory include syntax | |
3027 | # | |
3028 | if ( test ! -f ${DESTDIR}/$file || \ | |
3029 | cmp $file ${DESTDIR}/$file ) > /dev/null 2>&1 | |
3030 | then | |
3031 | rm -f ${DESTDIR}/$file | |
3032 | else | |
3033 | echo "Fixed $file:${fixlist}" | |
3034 | ||
3035 | # Find any include directives that use "file". | |
3036 | # | |
3037 | for include in ` | |
3038 | egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${DESTDIR}/$file | | |
3039 | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'` | |
3040 | do | |
3041 | dir=`echo $file | sed -e s'|/[^/]*$||'` | |
3042 | required="$required ${SRCDIR} $dir/$include ${DESTDIR}/$dir/$include" | |
3043 | done | |
3044 | fi | |
3045 | done # for file in $files | |
3046 | ||
3047 | done | |
3048 | ||
3049 | ## Make sure that any include files referenced using double quotes | |
3050 | ## exist in the fixed directory. This comes last since otherwise | |
3051 | ## we might end up deleting some of these files "because they don't | |
3052 | ## need any change." | |
3053 | set x `echo $required` | |
3054 | shift | |
3055 | while [ $# != 0 ]; do | |
3056 | newreq= | |
3057 | while [ $# != 0 ]; do | |
3058 | # $1 is the directory to copy from, | |
3059 | # $2 is the unfixed file, | |
3060 | # $3 is the fixed file name. | |
3061 | # | |
3062 | cd ${INPUT} | |
3063 | cd $1 | |
1f414ac4 BK |
3064 | if [ -f $2 ] ; then |
3065 | if [ -r $2 ] && [ ! -r $3 ]; then | |
3066 | cp $2 $3 >/dev/null 2>&1 || echo "Can't copy $2" >&2 | |
3067 | chmod +w $3 2>/dev/null | |
3068 | chmod a+r $3 2>/dev/null | |
3069 | echo Copied $2 | |
3070 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 | | |
06bbab1b | 3071 | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'` |
1f414ac4 BK |
3072 | do |
3073 | dir=`echo $2 | sed -e s'|/[^/]*$||'` | |
3074 | dir2=`echo $3 | sed -e s'|/[^/]*$||'` | |
3075 | newreq="$newreq $1 $dir/$include $dir2/$include" | |
3076 | done | |
3077 | fi | |
06bbab1b BK |
3078 | fi |
3079 | shift; shift; shift | |
3080 | done | |
3081 | set x $newreq | |
3082 | shift | |
3083 | done | |
3084 | ||
3085 | echo 'Cleaning up DONE files.' | |
3086 | cd $LIB | |
3087 | find . -name DONE -exec rm -f '{}' ';' | |
3088 | ||
3089 | echo 'Removing unneeded directories:' | |
3090 | cd $LIB | |
3091 | files=`find . -type d -print | sort -r` | |
3092 | for file in $files; do | |
3093 | rmdir $LIB/$file > /dev/null 2>&1 | : | |
3094 | done | |
3095 | ||
3096 | # # # # # # # # # # # # # # # # # # # # # | |
3097 | # | |
3098 | # End of for INPUT directories | |
3099 | # | |
3100 | done | |
3101 | # | |
3102 | # # # # # # # # # # # # # # # # # # # # # | |
3103 | ||
3104 | cd $ORIGDIR | |
3105 | rm -f include/assert.h | |
1f414ac4 | 3106 | cp ${srcdir}/assert.h include/assert.h || exit 1 |
06bbab1b BK |
3107 | chmod a+r include/assert.h |
3108 |