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