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