]> gcc.gnu.org Git - gcc.git/blob - gcc/fixinc.svr4
Don't create absolute symbolic links;
[gcc.git] / gcc / fixinc.svr4
1 #! /bin/sh
2 #
3 # fixinc.svr4 -- Install modified versions of certain ANSI-incompatible
4 # native System V Release 4 system include files.
5 #
6 # Written by Ron Guilmette (rfg@ncd.com).
7 #
8 # This file is part of GNU CC.
9 #
10 # GNU CC is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2, or (at your option)
13 # any later version.
14 #
15 # GNU CC is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License
21 # along with GNU CC; see the file COPYING. If not, write to
22 # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23 #
24 # This script munges the native include files provided with System V
25 # Release 4 systems so as to remove things which are violations of the
26 # ANSI C standard. Once munged, the resulting new system include files
27 # are placed in a directory that GNU C will search *before* searching
28 # the /usr/include directory. This script should work properly for most
29 # System V Release 4 systems. For other types of systems, you should
30 # use the `fixincludes' script instead.
31 #
32 # See README-fixinc for more information.
33
34 # Directory where gcc sources (and sometimes special include files) live.
35 SRCDIR=${3-${SRCDIR-.}}
36
37 # Directory containing the original header files.
38 INPUT=${2-${INPUT-/usr/include}}
39
40 # Fail if no arg to specify a directory for the output.
41 if [ x$1 = x ]
42 then echo fixincludes: no output directory specified
43 exit 1
44 fi
45
46 # Directory in which to store the results.
47 LIB=${1?"fixincludes: output directory not specified"}
48
49 # Make sure it exists.
50 if [ ! -d $LIB ]; then
51 mkdir $LIB || exit 1
52 fi
53
54 ORIG_DIR=`pwd`
55
56 # Make LIB absolute if it is relative.
57 # Don't do this if not necessary, since may screw up automounters.
58 case $LIB in
59 /*)
60 ;;
61 *)
62 cd $LIB; LIB=`${PWDCMD-pwd}`
63 ;;
64 esac
65
66 echo 'Building fixincludes in ' ${LIB}
67
68 # Determine whether this filesystem has symbolic links.
69 if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
70 rm -f $LIB/ShouldNotExist
71 LINKS=true
72 else
73 LINKS=false
74 fi
75
76 echo 'Making directories:'
77 cd ${INPUT}
78 if $LINKS; then
79 files=`ls -LR | sed -n s/:$//p`
80 else
81 files=`find . -type d -print | sed '/^.$/d'`
82 fi
83 for file in $files; do
84 rm -rf $LIB/$file
85 if [ ! -d $LIB/$file ]
86 then mkdir $LIB/$file
87 fi
88 done
89
90 # treetops gets an alternating list
91 # of old directories to copy
92 # and the new directories to copy to.
93 treetops="${INPUT} ${LIB}"
94
95 if $LINKS; then
96 echo 'Making internal symbolic directory links'
97 for file in $files; do
98 dest=`ls -ld $file | sed -n 's/.*-> //p'`
99 if [ "$dest" ]; then
100 cwd=`pwd`
101 # In case $dest is relative, get to $file's dir first.
102 cd ${INPUT}
103 cd `echo ./$file | sed -n 's&[^/]*$&&p'`
104 # Check that the target directory exists.
105 # Redirections changed to avoid bug in sh on Ultrix.
106 (cd $dest) > /dev/null 2>&1
107 if [ $? = 0 ]; then
108 cd $dest
109 # X gets the dir that the link actually leads to.
110 x=`pwd`
111 # If link leads back into ${INPUT},
112 # make a similar link here.
113 if expr $x : "${INPUT}/.*" > /dev/null; then
114 # Y gets the actual target dir name, relative to ${INPUT}.
115 y=`echo $x | sed -n "s&${INPUT}/&&p"`
116 # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
117 dots=`echo "$file" |
118 sed -e 's@^./@@' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
119 echo $file '->' $dots$y ': Making link'
120 rm -fr ${LIB}/$file > /dev/null 2>&1
121 ln -s $dots$y ${LIB}/$file > /dev/null 2>&1
122 else
123 # If the link is to outside ${INPUT},
124 # treat this directory as if it actually contained the files.
125 # This line used to have $dest instead of $x.
126 # $dest seemed to be wrong for links found in subdirectories
127 # of ${INPUT}. Does this change break anything?
128 treetops="$treetops $x ${LIB}/$file"
129 fi
130 fi
131 cd $cwd
132 fi
133 done
134 fi
135
136 set - $treetops
137 while [ $# != 0 ]; do
138 # $1 is an old directory to copy, and $2 is the new directory to copy to.
139 echo "Finding header files in $1:"
140 cd ${INPUT}
141 cd $1
142 files=`find . -name '*.h' -type f -print`
143 echo 'Checking header files:'
144 for file in $files; do
145 if [ -r $file ]; then
146 cp $file $2/$file >/dev/null 2>&1 || echo "Can't copy $file"
147 chmod +w $2/$file
148 chmod a+r $2/$file
149
150 # The following have been removed from the sed command below
151 # because it is more useful to leave these things in.
152 # The only reason to remove them was for -pedantic,
153 # which isn't much of a reason. -- rms.
154 # /^[ ]*#[ ]*ident/d
155
156 # This code makes Solaris SCSI fail, because it changes the
157 # alignment within some critical structures. See <sys/scsi/impl/commands.h>.
158 # s/u_char\([ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[ ]*:[ ]*[0-9][0-9]*\)/u_int\1/
159 # Disable these also, since they probably aren't safe either.
160 # s/u_short\([ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[ ]*:[ ]*[0-9][0-9]*\)/u_int\1/
161 # s/ushort\([ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[ ]*:[ ]*[0-9][0-9]*\)/u_int\1/
162 # s/evcm_t\([ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[ ]*:[ ]*[0-9][0-9]*\)/u_int\1/
163 # s/Pbyte\([ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[ ]*:[ ]*SEQSIZ\)/unsigned int\1/
164
165 # The change of u_char, etc, to u_int
166 # applies to bit fields.
167 sed -e '
168 s%^\([ ]*#[ ]*else\)[ ]*/[^*].*%\1%
169 s%^\([ ]*#[ ]*else\)[ ]*[^/ ].*%\1%
170 s%^\([ ]*#[ ]*endif\)[ ]*/[^*].*%\1%
171 s%^\([ ]*#[ ]*endif\)[ ]*[^/ ].*%\1%
172 s/#lint(on)/defined(lint)/g
173 s/#lint(off)/!defined(lint)/g
174 s/#machine(\([^)]*\))/defined(__\1__)/g
175 s/#system(\([^)]*\))/defined(__\1__)/g
176 s/#cpu(\([^)]*\))/defined(__\1__)/g
177 /#[a-z]*if.*[ (]m68k/ s/\([^_]\)m68k/\1__m68k__/g
178 /#[a-z]*if.*[ (]__i386\([^_]\)/ s/__i386/__i386__/g
179 /#[a-z]*if.*[ (]i386/ s/\([^_]\)i386/\1__i386__/g
180 /#[a-z]*if.*[ (]sparc/ s/\([^_]\)sparc/\1__sparc__/g
181 /#[a-z]*if.*[ (]mc68000/ s/\([^_]\)mc68000/\1__mc68000__/g
182 /#[a-z]*if.*[ (]vax/ s/\([^_]\)vax/\1__vax__/g
183 /#[a-z]*if.*[ (]sun/ s/\([^_]\)\(sun[a-z0-9]*\)\([^a-z0-9_]\)/\1__\2__\3/g
184 /#[a-z]*if.*[ (]sun/ s/\([^_]\)\(sun[a-z0-9]*\)$/\1__\2__/g
185 /#[a-z]*if.*[ (]ns32000/ s/\([^_]\)ns32000/\1__ns32000__/g
186 /#[a-z]*if.*[ (]pyr/ s/\([^_]\)pyr/\1__pyr__/g
187 /#[a-z]*if.*[ (]is68k/ s/\([^_]\)is68k/\1__is68k__/g
188 s/__STDC__ == 0/!defined (__STRICT_ANSI__)/g
189 s/__STDC__ != 0/defined (__STRICT_ANSI__)/g
190 s/__STDC__ - 0 == 0/!defined (__STRICT_ANSI__)/g
191 ' $2/$file > $2/$file.sed
192 mv $2/$file.sed $2/$file
193 if cmp $file $2/$file >/dev/null 2>&1; then
194 rm $2/$file
195 else
196 echo Fixed $file
197 fi
198 fi
199 done
200 shift; shift
201 done
202
203 # Fix first broken decl of getcwd present on some svr4 systems.
204
205 file=stdlib.h
206 base=`basename $file`
207 if [ -r ${LIB}/$file ]; then
208 file_to_fix=${LIB}/$file
209 else
210 if [ -r ${INPUT}/$file ]; then
211 file_to_fix=${INPUT}/$file
212 else
213 file_to_fix=""
214 fi
215 fi
216 if [ \! -z "$file_to_fix" ]; then
217 echo Checking $file_to_fix
218 sed -e 's/getcwd(char \*, int)/getcwd(char *, size_t)/' $file_to_fix > /tmp/$base
219 if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
220 true
221 else
222 echo Fixed $file_to_fix
223 rm -f ${LIB}/$file
224 cp /tmp/$base ${LIB}/$file
225 chmod a+r ${LIB}/$file
226 fi
227 rm -f /tmp/$base
228 fi
229
230 # Fix second broken decl of getcwd present on some svr4 systems. Also
231 # fix the incorrect decl of profil present on some svr4 systems.
232
233 file=unistd.h
234 base=`basename $file`
235 if [ -r ${LIB}/$file ]; then
236 file_to_fix=${LIB}/$file
237 else
238 if [ -r ${INPUT}/$file ]; then
239 file_to_fix=${INPUT}/$file
240 else
241 file_to_fix=""
242 fi
243 fi
244 if [ \! -z "$file_to_fix" ]; then
245 echo Checking $file_to_fix
246 sed -e 's/getcwd(char \*, int)/getcwd(char *, size_t)/' $file_to_fix \
247 | sed -e 's/profil(unsigned short \*, unsigned int, unsigned int, unsigned int)/profil(unsigned short *, size_t, int, unsigned)/' > /tmp/$base
248 if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
249 true
250 else
251 echo Fixed $file_to_fix
252 rm -f ${LIB}/$file
253 cp /tmp/$base ${LIB}/$file
254 chmod a+r ${LIB}/$file
255 fi
256 rm -f /tmp/$base
257 fi
258
259 # Fix the definition of NULL in <sys/param.h> so that it is conditional
260 # and so that it is correct for both C and C++.
261
262 file=sys/param.h
263 base=`basename $file`
264 if [ -r ${LIB}/$file ]; then
265 file_to_fix=${LIB}/$file
266 else
267 if [ -r ${INPUT}/$file ]; then
268 file_to_fix=${INPUT}/$file
269 else
270 file_to_fix=""
271 fi
272 fi
273 if [ \! -z "$file_to_fix" ]; then
274 echo Checking $file_to_fix
275 cp $file_to_fix /tmp/$base
276 chmod +w /tmp/$base
277 chmod a+r /tmp/$base
278 sed -e '/^#define[ ]*NULL[ ]*0$/c\
279 #ifndef NULL\
280 #ifdef __cplusplus\
281 #define __NULL_TYPE\
282 #else /* !defined(__cplusplus) */\
283 #define __NULL_TYPE (void *)\
284 #endif /* !defined(__cplusplus) */\
285 #define NULL (__NULL_TYPE 0)\
286 #endif /* !defined(NULL) */' /tmp/$base > /tmp/$base.sed
287 if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
288 true
289 else
290 echo Fixed $file_to_fix
291 rm -f ${LIB}/$file
292 cp /tmp/$base.sed ${LIB}/$file
293 chmod a+r ${LIB}/$file
294 fi
295 rm -f /tmp/$base /tmp/$base.sed
296 fi
297
298 # Likewise fix the definition of NULL in <stdio.h> so that it is conditional
299 # and so that it is correct for both C and C++.
300
301 file=stdio.h
302 base=`basename $file`
303 if [ -r ${LIB}/$file ]; then
304 file_to_fix=${LIB}/$file
305 else
306 if [ -r ${INPUT}/$file ]; then
307 file_to_fix=${INPUT}/$file
308 else
309 file_to_fix=""
310 fi
311 fi
312 if [ \! -z "$file_to_fix" ]; then
313 echo Checking $file_to_fix
314 cp $file_to_fix /tmp/$base
315 chmod +w /tmp/$base
316 sed -e '/^#define[ ]*NULL[ ]*0$/c\
317 #ifdef __cplusplus\
318 #define __NULL_TYPE\
319 #else /* !defined(__cplusplus) */\
320 #define __NULL_TYPE (void *)\
321 #endif /* !defined(__cplusplus) */\
322 #define NULL (__NULL_TYPE 0)' /tmp/$base > /tmp/$base.sed
323 if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
324 true
325 else
326 echo Fixed $file_to_fix
327 rm -f ${LIB}/$file
328 cp /tmp/$base.sed ${LIB}/$file
329 chmod a+r ${LIB}/$file
330 fi
331 rm -f /tmp/$base /tmp/$base.sed
332 fi
333
334 # Likewise fix the definition of NULL in <dbm.h> so that it is conditional
335 # and so that it is correct for both C and C++.
336
337 file=dbm.h
338 base=`basename $file`
339 if [ -r ${LIB}/$file ]; then
340 file_to_fix=${LIB}/$file
341 else
342 if [ -r ${INPUT}/$file ]; then
343 file_to_fix=${INPUT}/$file
344 else
345 file_to_fix=""
346 fi
347 fi
348 if [ \! -z "$file_to_fix" ]; then
349 echo Checking $file_to_fix
350 cp $file_to_fix /tmp/$base
351 chmod +w /tmp/$base
352 sed -e '/^#define[ ]*NULL[ ]*((char \*) 0)$/c\
353 #ifndef NULL\
354 #ifdef __cplusplus\
355 #define __NULL_TYPE\
356 #else /* !defined(__cplusplus) */\
357 #define __NULL_TYPE (void *)\
358 #endif /* !defined(__cplusplus) */\
359 #define NULL (__NULL_TYPE 0)\
360 #endif /* !defined(NULL) */' /tmp/$base > /tmp/$base.sed
361 if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
362 true
363 else
364 echo Fixed $file_to_fix
365 rm -f ${LIB}/$file
366 cp /tmp/$base.sed ${LIB}/$file
367 chmod a+r ${LIB}/$file
368 fi
369 rm -f /tmp/$base /tmp/$base.sed
370 fi
371
372 # Add a prototyped declaration of mmap to <sys/mman.h>.
373
374 file=sys/mman.h
375 base=`basename $file`
376 if [ -r ${LIB}/$file ]; then
377 file_to_fix=${LIB}/$file
378 else
379 if [ -r ${INPUT}/$file ]; then
380 file_to_fix=${INPUT}/$file
381 else
382 file_to_fix=""
383 fi
384 fi
385 if [ \! -z "$file_to_fix" ]; then
386 echo Checking $file_to_fix
387 cp $file_to_fix /tmp/$base
388 chmod +w /tmp/$base
389 sed -e '/^extern caddr_t mmap();$/c\
390 #ifdef __STDC__\
391 extern caddr_t mmap (caddr_t addr, size_t len, int prot, int flags,\
392 int fd, off_t off);\
393 #else /* !defined(__STDC__) */\
394 extern caddr_t mmap ();\
395 #endif /* !defined(__STDC__) */' /tmp/$base > /tmp/$base.sed
396 if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
397 true
398 else
399 echo Fixed $file_to_fix
400 rm -f ${LIB}/$file
401 cp /tmp/$base.sed ${LIB}/$file
402 chmod a+r ${LIB}/$file
403 fi
404 rm -f /tmp/$base /tmp/$base.sed
405 fi
406
407 # Fix declarations of `ftw' and `nftw' in <ftw.h>.
408
409 file=ftw.h
410 base=`basename $file`
411 if [ -r ${LIB}/$file ]; then
412 file_to_fix=${LIB}/$file
413 else
414 if [ -r ${INPUT}/$file ]; then
415 file_to_fix=${INPUT}/$file
416 else
417 file_to_fix=""
418 fi
419 fi
420 if [ \! -z "$file_to_fix" ]; then
421 echo Checking $file_to_fix
422 cp $file_to_fix /tmp/$base
423 chmod +w /tmp/$base
424 sed -e '/^extern int ftw(const/c\
425 #if !defined(_STYPES)\
426 static\
427 #else\
428 extern\
429 #endif\
430 int ftw(const char *, int (*)(const char *, const struct stat *, int), int);' \
431 -e '/^extern int nftw/c\
432 #if defined(_STYPES)\
433 static\
434 #else\
435 extern\
436 #endif\
437 int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *),int, int);' \
438 -e '/^extern int ftw(),/c\
439 #if !defined(_STYPES)\
440 static\
441 #else\
442 extern\
443 #endif\
444 int ftw();\
445 #if defined(_STYPES)\
446 static\
447 #else\
448 extern\
449 #endif\
450 int nftw();' /tmp/$base > /tmp/$base.sed
451 if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
452 true
453 else
454 echo Fixed $file_to_fix
455 rm -f ${LIB}/$file
456 cp /tmp/$base.sed ${LIB}/$file
457 chmod a+r ${LIB}/$file
458 fi
459 rm -f /tmp/$base /tmp/$base.sed
460 fi
461
462 # Add a `static' declaration of `getrnge' into <regexp.h>.
463
464 # Don't do this if there is already a `static void getrnge' declaration
465 # present, since this would cause a redeclaration error. Solaris 2.x has
466 # such a declaration.
467
468 file=regexp.h
469 base=`basename $file`
470 if [ -r ${LIB}/$file ]; then
471 file_to_fix=${LIB}/$file
472 else
473 if [ -r ${INPUT}/$file ]; then
474 file_to_fix=${INPUT}/$file
475 else
476 file_to_fix=""
477 fi
478 fi
479 if [ \! -z "$file_to_fix" ]; then
480 echo Checking $file_to_fix
481 if grep "static void getrnge" $file_to_fix > /dev/null; then
482 true
483 else
484 cp $file_to_fix /tmp/$base
485 chmod +w /tmp/$base
486 sed -e '/^static int[ ]*size;/c\
487 static int size ;\
488 \
489 static int getrnge ();' /tmp/$base > /tmp/$base.sed
490 if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
491 true
492 else
493 echo Fixed $file_to_fix
494 rm -f ${LIB}/$file
495 cp /tmp/$base.sed ${LIB}/$file
496 chmod a+r ${LIB}/$file
497 fi
498 fi
499 rm -f /tmp/$base /tmp/$base.sed
500 fi
501
502 # Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
503 # that is visible to any ANSI compiler using this include. Simply
504 # delete the lines that #define some string functions to internal forms.
505
506 file=string.h
507 base=`basename $file`
508 if [ -r ${LIB}/$file ]; then
509 file_to_fix=${LIB}/$file
510 else
511 if [ -r ${INPUT}/$file ]; then
512 file_to_fix=${INPUT}/$file
513 else
514 file_to_fix=""
515 fi
516 fi
517 if [ \! -z "$file_to_fix" ]; then
518 echo Checking $file_to_fix
519 cp $file_to_fix /tmp/$base
520 chmod +w /tmp/$base
521 sed -e '/#define.*__std_hdr_/d' /tmp/$base > /tmp/$base.sed
522 if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
523 true
524 else
525 echo Fixed $file_to_fix
526 rm -f ${LIB}/$file
527 cp /tmp/$base.sed ${LIB}/$file
528 chmod a+r ${LIB}/$file
529 fi
530 rm -f /tmp/$base /tmp/$base.sed
531 fi
532
533 # Delete any #defines of `__i386' which may be present in <ieeefp.h>. They
534 # tend to conflict with the compiler's own definition of this symbol. (We
535 # will use the compiler's definition.)
536 # Likewise __sparc, for Solaris, and __i860, and a few others
537 # (guessing it is necessary for all of them).
538
539 file=ieeefp.h
540 base=`basename $file`
541 if [ -r ${LIB}/$file ]; then
542 file_to_fix=${LIB}/$file
543 else
544 if [ -r ${INPUT}/$file ]; then
545 file_to_fix=${INPUT}/$file
546 else
547 file_to_fix=""
548 fi
549 fi
550 if [ \! -z "$file_to_fix" ]; then
551 echo Checking $file_to_fix
552 cp $file_to_fix /tmp/$base
553 chmod +w /tmp/$base
554 sed -e '/#define[ ]*__i386 /d' -e '/#define[ ]*__sparc /d' \
555 -e '/#define[ ]*__i860 /d' -e '/#define[ ]*__m88k /d' \
556 -e '/#define[ ]*__mips /d' -e '/#define[ ]*__m68k /d' \
557 /tmp/$base > /tmp/$base.sed
558 if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
559 true
560 else
561 echo Fixed $file_to_fix
562 rm -f ${LIB}/$file
563 cp /tmp/$base.sed ${LIB}/$file
564 chmod a+r ${LIB}/$file
565 fi
566 rm -f /tmp/$base /tmp/$base.sed
567 fi
568
569 # Add a #define of _SIGACTION_ into <sys/signal.h>.
570 # Also fix types of SIG_DFL, SIG_ERR, SIG_IGN, and SIG_HOLD.
571
572 file=sys/signal.h
573 base=`basename $file`
574 if [ -r ${LIB}/$file ]; then
575 file_to_fix=${LIB}/$file
576 else
577 if [ -r ${INPUT}/$file ]; then
578 file_to_fix=${INPUT}/$file
579 else
580 file_to_fix=""
581 fi
582 fi
583 if [ \! -z "$file_to_fix" ]; then
584 echo Checking $file_to_fix
585 cp $file_to_fix /tmp/$base
586 chmod +w /tmp/$base
587 sed -e '/^struct sigaction {/c\
588 #define _SIGACTION_\
589 struct sigaction {' \
590 -e '1,$s/(void *(\*)())/(void (*)(int))/' /tmp/$base > /tmp/$base.sed
591 if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
592 true
593 else
594 echo Fixed $file_to_fix
595 rm -f ${LIB}/$file
596 cp /tmp/$base.sed ${LIB}/$file
597 chmod a+r ${LIB}/$file
598 fi
599 rm -f /tmp/$base /tmp/$base.sed
600 fi
601
602 # Fix declarations of `makedev', `major', and `minor' in <sys/mkdev.h>.
603
604 file=sys/mkdev.h
605 base=`basename $file`
606 if [ -r ${LIB}/$file ]; then
607 file_to_fix=${LIB}/$file
608 else
609 if [ -r ${INPUT}/$file ]; then
610 file_to_fix=${INPUT}/$file
611 else
612 file_to_fix=""
613 fi
614 fi
615 if [ \! -z "$file_to_fix" ]; then
616 echo Checking $file_to_fix
617 cp $file_to_fix /tmp/$base
618 chmod +w /tmp/$base
619 sed -e '/^dev_t makedev(const/c\
620 static dev_t makedev(const major_t, const minor_t);' \
621 -e '/^dev_t makedev()/c\
622 static dev_t makedev();' \
623 -e '/^major_t major(const/c\
624 static major_t major(const dev_t);' \
625 -e '/^major_t major()/c\
626 static major_t major();' \
627 -e '/^minor_t minor(const/c\
628 static minor_t minor(const dev_t);' \
629 -e '/^minor_t minor()/c\
630 static minor_t minor();' /tmp/$base > /tmp/$base.sed
631 if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
632 true
633 else
634 echo Fixed $file_to_fix
635 rm -f ${LIB}/$file
636 cp /tmp/$base.sed ${LIB}/$file
637 chmod a+r ${LIB}/$file
638 fi
639 rm -f /tmp/$base /tmp/$base.sed
640 fi
641
642 # Fix reference to NMSZ in <sys/adv.h>.
643
644 file=sys/adv.h
645 base=`basename $file`
646 if [ -r ${LIB}/$file ]; then
647 file_to_fix=${LIB}/$file
648 else
649 if [ -r ${INPUT}/$file ]; then
650 file_to_fix=${INPUT}/$file
651 else
652 file_to_fix=""
653 fi
654 fi
655 if [ \! -z "$file_to_fix" ]; then
656 echo Checking $file_to_fix
657 sed 's/\[NMSZ\]/\[RFS_NMSZ\]/g' $file_to_fix > /tmp/$base
658 if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
659 true
660 else
661 echo Fixed $file_to_fix
662 rm -f ${LIB}/$file
663 cp /tmp/$base ${LIB}/$file
664 chmod a+r ${LIB}/$file
665 fi
666 rm -f /tmp/$base
667 fi
668
669 # Fix reference to NC_NPI_RAW in <sys/netcspace.h>. Also fix types of
670 # array initializers.
671
672 file=sys/netcspace.h
673 base=`basename $file`
674 if [ -r ${LIB}/$file ]; then
675 file_to_fix=${LIB}/$file
676 else
677 if [ -r ${INPUT}/$file ]; then
678 file_to_fix=${INPUT}/$file
679 else
680 file_to_fix=""
681 fi
682 fi
683 if [ \! -z "$file_to_fix" ]; then
684 echo Checking $file_to_fix
685 sed 's/NC_NPI_RAW/NC_TPI_RAW/g' $file_to_fix \
686 | sed 's/NC_/(unsigned long) NC_/' > /tmp/$base
687 if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
688 true
689 else
690 echo Fixed $file_to_fix
691 rm -f ${LIB}/$file
692 cp /tmp/$base ${LIB}/$file
693 chmod a+r ${LIB}/$file
694 fi
695 rm -f /tmp/$base
696 fi
697
698 # Conditionalize all of <fs/rfs/rf_cache.h> on _KERNEL being defined.
699
700 file=fs/rfs/rf_cache.h
701 base=`basename $file`
702 if [ -r ${LIB}/$file ]; then
703 file_to_fix=${LIB}/$file
704 else
705 if [ -r ${INPUT}/$file ]; then
706 file_to_fix=${INPUT}/$file
707 else
708 file_to_fix=""
709 fi
710 fi
711 if [ \! -z "$file_to_fix" ]; then
712 echo Checking $file_to_fix
713 if grep _KERNEL $file_to_fix > /dev/null; then
714 true
715 else
716 echo '#ifdef _KERNEL' > /tmp/$base
717 cat $file_to_fix >> /tmp/$base
718 echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
719 echo Fixed $file_to_fix
720 rm -f ${LIB}/$file
721 cp /tmp/$base ${LIB}/$file
722 chmod a+r ${LIB}/$file
723 rm -f /tmp/$base
724 fi
725 fi
726
727 # Conditionalize all of <sys/erec.h> on _KERNEL being defined.
728
729 file=sys/erec.h
730 base=`basename $file`
731 if [ -r ${LIB}/$file ]; then
732 file_to_fix=${LIB}/$file
733 else
734 if [ -r ${INPUT}/$file ]; then
735 file_to_fix=${INPUT}/$file
736 else
737 file_to_fix=""
738 fi
739 fi
740 if [ \! -z "$file_to_fix" ]; then
741 echo Checking $file_to_fix
742 if grep _KERNEL $file_to_fix > /dev/null; then
743 true
744 else
745 echo '#ifdef _KERNEL' > /tmp/$base
746 cat $file_to_fix >> /tmp/$base
747 echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
748 echo Fixed $file_to_fix
749 rm -f ${LIB}/$file
750 cp /tmp/$base ${LIB}/$file
751 chmod a+r ${LIB}/$file
752 rm -f /tmp/$base
753 fi
754 fi
755
756 # Conditionalize all of <sys/err.h> on _KERNEL being defined.
757
758 file=sys/err.h
759 base=`basename $file`
760 if [ -r ${LIB}/$file ]; then
761 file_to_fix=${LIB}/$file
762 else
763 if [ -r ${INPUT}/$file ]; then
764 file_to_fix=${INPUT}/$file
765 else
766 file_to_fix=""
767 fi
768 fi
769 if [ \! -z "$file_to_fix" ]; then
770 echo Checking $file_to_fix
771 if grep _KERNEL $file_to_fix > /dev/null; then
772 true
773 else
774 echo '#ifdef _KERNEL' > /tmp/$base
775 cat $file_to_fix >> /tmp/$base
776 echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
777 echo Fixed $file_to_fix
778 rm -f ${LIB}/$file
779 cp /tmp/$base ${LIB}/$file
780 chmod a+r ${LIB}/$file
781 rm -f /tmp/$base
782 fi
783 fi
784
785 # Conditionalize all of <sys/char.h> on _KERNEL being defined.
786
787 file=sys/char.h
788 base=`basename $file`
789 if [ -r ${LIB}/$file ]; then
790 file_to_fix=${LIB}/$file
791 else
792 if [ -r ${INPUT}/$file ]; then
793 file_to_fix=${INPUT}/$file
794 else
795 file_to_fix=""
796 fi
797 fi
798 if [ \! -z "$file_to_fix" ]; then
799 echo Checking $file_to_fix
800 if grep _KERNEL $file_to_fix > /dev/null; then
801 true
802 else
803 echo '#ifdef _KERNEL' > /tmp/$base
804 cat $file_to_fix >> /tmp/$base
805 echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
806 echo Fixed $file_to_fix
807 rm -f ${LIB}/$file
808 cp /tmp/$base ${LIB}/$file
809 chmod a+r ${LIB}/$file
810 rm -f /tmp/$base
811 fi
812 fi
813
814 # Conditionalize all of <sys/getpages.h> on _KERNEL being defined.
815
816 file=sys/getpages.h
817 base=`basename $file`
818 if [ -r ${LIB}/$file ]; then
819 file_to_fix=${LIB}/$file
820 else
821 if [ -r ${INPUT}/$file ]; then
822 file_to_fix=${INPUT}/$file
823 else
824 file_to_fix=""
825 fi
826 fi
827 if [ \! -z "$file_to_fix" ]; then
828 echo Checking $file_to_fix
829 if grep _KERNEL $file_to_fix > /dev/null; then
830 true
831 else
832 echo '#ifdef _KERNEL' > /tmp/$base
833 cat $file_to_fix >> /tmp/$base
834 echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
835 echo Fixed $file_to_fix
836 rm -f ${LIB}/$file
837 cp /tmp/$base ${LIB}/$file
838 chmod a+r ${LIB}/$file
839 rm -f /tmp/$base
840 fi
841 fi
842
843 # Conditionalize all of <sys/map.h> on _KERNEL being defined.
844
845 file=sys/map.h
846 base=`basename $file`
847 if [ -r ${LIB}/$file ]; then
848 file_to_fix=${LIB}/$file
849 else
850 if [ -r ${INPUT}/$file ]; then
851 file_to_fix=${INPUT}/$file
852 else
853 file_to_fix=""
854 fi
855 fi
856 if [ \! -z "$file_to_fix" ]; then
857 echo Checking $file_to_fix
858 if grep _KERNEL $file_to_fix > /dev/null; then
859 true
860 else
861 echo '#ifdef _KERNEL' > /tmp/$base
862 cat $file_to_fix >> /tmp/$base
863 echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
864 echo Fixed $file_to_fix
865 rm -f ${LIB}/$file
866 cp /tmp/$base ${LIB}/$file
867 chmod a+r ${LIB}/$file
868 rm -f /tmp/$base
869 fi
870 fi
871
872 # Conditionalize all of <sys/cmn_err.h> on _KERNEL being defined.
873
874 file=sys/cmn_err.h
875 base=`basename $file`
876 if [ -r ${LIB}/$file ]; then
877 file_to_fix=${LIB}/$file
878 else
879 if [ -r ${INPUT}/$file ]; then
880 file_to_fix=${INPUT}/$file
881 else
882 file_to_fix=""
883 fi
884 fi
885 if [ \! -z "$file_to_fix" ]; then
886 echo Checking $file_to_fix
887 if grep _KERNEL $file_to_fix > /dev/null; then
888 true
889 else
890 echo '#ifdef _KERNEL' > /tmp/$base
891 cat $file_to_fix >> /tmp/$base
892 echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
893 echo Fixed $file_to_fix
894 rm -f ${LIB}/$file
895 cp /tmp/$base ${LIB}/$file
896 chmod a+r ${LIB}/$file
897 rm -f /tmp/$base
898 fi
899 fi
900
901 # Conditionalize all of <sys/kdebugger.h> on _KERNEL being defined.
902
903 file=sys/kdebugger.h
904 base=`basename $file`
905 if [ -r ${LIB}/$file ]; then
906 file_to_fix=${LIB}/$file
907 else
908 if [ -r ${INPUT}/$file ]; then
909 file_to_fix=${INPUT}/$file
910 else
911 file_to_fix=""
912 fi
913 fi
914 if [ \! -z "$file_to_fix" ]; then
915 echo Checking $file_to_fix
916 if grep _KERNEL $file_to_fix > /dev/null; then
917 true
918 else
919 echo '#ifdef _KERNEL' > /tmp/$base
920 cat $file_to_fix >> /tmp/$base
921 echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
922 echo Fixed $file_to_fix
923 rm -f ${LIB}/$file
924 cp /tmp/$base ${LIB}/$file
925 chmod a+r ${LIB}/$file
926 rm -f /tmp/$base
927 fi
928 fi
929
930 # Conditionalize some of <netinet/in.h> on _KERNEL being defined.
931
932 file=netinet/in.h
933 base=`basename $file`
934 if [ -r ${LIB}/$file ]; then
935 file_to_fix=${LIB}/$file
936 else
937 if [ -r ${INPUT}/$file ]; then
938 file_to_fix=${INPUT}/$file
939 else
940 file_to_fix=""
941 fi
942 fi
943 if [ \! -z "$file_to_fix" ]; then
944 echo Checking $file_to_fix
945 if grep _KERNEL $file_to_fix > /dev/null; then
946 true
947 else
948 sed -e '/#ifdef INKERNEL/i\
949 #ifdef _KERNEL' \
950 -e '/#endif[ ]*\/\* INKERNEL \*\//a\
951 #endif /* _KERNEL */' \
952 $file_to_fix > ${LIB}/${file}.sed
953 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
954 echo Fixed $file_to_fix
955 fi
956 fi
957
958 # Conditionalize some of <sys/endian.h> on __GNUC__ and __GNUG__.
959
960 file=sys/endian.h
961 base=`basename $file`
962 if [ -r ${LIB}/$file ]; then
963 file_to_fix=${LIB}/$file
964 else
965 if [ -r ${INPUT}/$file ]; then
966 file_to_fix=${INPUT}/$file
967 else
968 file_to_fix=""
969 fi
970 fi
971 if [ \! -z "$file_to_fix" ]; then
972 echo Checking $file_to_fix
973 if grep __GNUC__ $file_to_fix > /dev/null; then
974 true
975 else
976 sed -e '/# ifdef __STDC__/i\
977 # if !defined (__GNUC__) && !defined (__GNUG__)' \
978 -e '/# include <sys\/byteorder.h>/s/ / /'\
979 -e '/# include <sys\/byteorder.h>/i\
980 # endif /* !defined (__GNUC__) && !defined (__GNUG__) */'\
981 $file_to_fix > ${LIB}/${file}.sed
982 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
983 echo Fixed $file_to_fix
984 fi
985 fi
986
987 # Commented out because tmcconne@sedona.intel.com says we don't clearly need it
988 # and the text in types.h is not erroneous.
989 ## In sys/types.h, don't name the enum for booleans.
990 #
991 #file=sys/types.h
992 #base=`basename $file`
993 #if [ -r ${LIB}/$file ]; then
994 # file_to_fix=${LIB}/$file
995 #else
996 # if [ -r ${INPUT}/$file ]; then
997 # file_to_fix=${INPUT}/$file
998 # else
999 # file_to_fix=""
1000 # fi
1001 #fi
1002 #if [ \! -z "$file_to_fix" ]; then
1003 # echo Checking $file_to_fix
1004 # if grep "enum boolean" $file_to_fix > /dev/null; then
1005 # sed -e 's/enum boolean/enum/' ${LIB}/$file > ${LIB}/${file}.sed
1006 # rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1007 # echo Fixed $file_to_fix
1008 # else
1009 # true
1010 # fi
1011 #fi
1012
1013 # Remove useless extern keyword from struct forward declarations in
1014 # <sys/stream.h> and <sys/strsubr.h>
1015
1016 file=sys/stream.h
1017 base=`basename $file`
1018 if [ -r ${LIB}/$file ]; then
1019 file_to_fix=${LIB}/$file
1020 else
1021 if [ -r ${INPUT}/$file ]; then
1022 file_to_fix=${INPUT}/$file
1023 else
1024 file_to_fix=""
1025 fi
1026 fi
1027 if [ \! -z "$file_to_fix" ]; then
1028 echo Checking $file_to_fix
1029 sed -e '
1030 s/extern struct stdata;/struct stdata;/g
1031 s/extern struct strevent;/struct strevent;/g
1032 ' $file_to_fix > /tmp/$base
1033 if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
1034 true
1035 else
1036 echo Fixed $file_to_fix
1037 rm -f ${LIB}/$file
1038 cp /tmp/$base ${LIB}/$file
1039 chmod a+r ${LIB}/$file
1040 fi
1041 rm -f /tmp/$base
1042 fi
1043
1044 file=sys/strsubr.h
1045 base=`basename $file`
1046 if [ -r ${LIB}/$file ]; then
1047 file_to_fix=${LIB}/$file
1048 else
1049 if [ -r ${INPUT}/$file ]; then
1050 file_to_fix=${INPUT}/$file
1051 else
1052 file_to_fix=""
1053 fi
1054 fi
1055 if [ \! -z "$file_to_fix" ]; then
1056 echo Checking $file_to_fix
1057 sed -e '
1058 s/extern struct strbuf;/struct strbuf;/g
1059 s/extern struct uio;/struct uio;/g
1060 s/extern struct thread;/struct thread;/g
1061 s/extern struct proc;/struct proc;/g
1062 ' $file_to_fix > /tmp/$base
1063 if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
1064 true
1065 else
1066 echo Fixed $file_to_fix
1067 rm -f ${LIB}/$file
1068 cp /tmp/$base ${LIB}/$file
1069 chmod a+r ${LIB}/$file
1070 fi
1071 rm -f /tmp/$base
1072 fi
1073
1074 # Put storage class at start of decl, to avoid warning.
1075 file=rpc/types.h
1076 base=`basename $file`
1077 if [ -r ${LIB}/$file ]; then
1078 file_to_fix=${LIB}/$file
1079 else
1080 if [ -r ${INPUT}/$file ]; then
1081 file_to_fix=${INPUT}/$file
1082 else
1083 file_to_fix=""
1084 fi
1085 fi
1086 if [ \! -z "$file_to_fix" ]; then
1087 echo Checking $file_to_fix
1088 sed -e '
1089 s/const extern/extern const/g
1090 ' $file_to_fix > /tmp/$base
1091 if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
1092 true
1093 else
1094 echo Fixed $file_to_fix
1095 rm -f ${LIB}/$file
1096 cp /tmp/$base ${LIB}/$file
1097 chmod a+r ${LIB}/$file
1098 fi
1099 rm -f /tmp/$base
1100 fi
1101
1102 # Convert functions to prototype form, and fix arg names in <sys/stat.h>.
1103
1104 file=sys/stat.h
1105 base=`basename $file`
1106 if [ -r ${LIB}/$file ]; then
1107 file_to_fix=${LIB}/$file
1108 else
1109 if [ -r ${INPUT}/$file ]; then
1110 file_to_fix=${INPUT}/$file
1111 else
1112 file_to_fix=""
1113 fi
1114 fi
1115 if [ \! -z "$file_to_fix" ]; then
1116 echo Checking $file_to_fix
1117 cp $file_to_fix /tmp/$base
1118 chmod +w /tmp/$base
1119 sed -e '/^stat(/{
1120 N
1121 N
1122 s/(.*)\n/( /
1123 s/;\n/, /
1124 s/;$/)/
1125 }' \
1126 -e '/^lstat(/{
1127 N
1128 N
1129 s/(.*)\n/( /
1130 s/;\n/, /
1131 s/;$/)/
1132 }' \
1133 -e '/^fstat(/{
1134 N
1135 N
1136 s/(.*)\n/( /
1137 s/;\n/, /
1138 s/;$/)/
1139 }' \
1140 -e '/^mknod(/{
1141 N
1142 N
1143 N
1144 s/(.*)\n/( /
1145 s/;\n/, /g
1146 s/;$/)/
1147 }' \
1148 -e '1,$s/\([^A-Za-z]\)path\([^A-Za-z]\)/\1__path\2/g' \
1149 -e '1,$s/\([^A-Za-z]\)buf\([^A-Za-z]\)/\1__buf\2/g' \
1150 -e '1,$s/\([^A-Za-z]\)fd\([^A-Za-z]\)/\1__fd\2/g' \
1151 -e '1,$s/ret\([^u]\)/__ret\1/g' \
1152 -e '1,$s/\([^_]\)mode\([^_]\)/\1__mode\2/g' \
1153 -e '1,$s/\([^_r]\)dev\([^_]\)/\1__dev\2/g' /tmp/$base > /tmp/$base.sed
1154 if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
1155 true
1156 else
1157 echo Fixed $file_to_fix
1158 rm -f ${LIB}/$file
1159 cp /tmp/$base.sed ${LIB}/$file
1160 chmod a+r ${LIB}/$file
1161 fi
1162 rm -f /tmp/$base /tmp/$base.sed
1163 fi
1164
1165 # Sony NEWSOS 5.0 does not support the complete ANSI C standard.
1166
1167 if [ -x /bin/sony ]; then
1168 if /bin/sony; then
1169
1170 # Change <stdio.h> to not define __filbuf, __flsbuf, and __iob
1171
1172 file=stdio.h
1173 base=`basename $file`
1174 if [ -r ${LIB}/$file ]; then
1175 file_to_fix=${LIB}/$file
1176 else
1177 if [ -r ${INPUT}/$file ]; then
1178 file_to_fix=${INPUT}/$file
1179 else
1180 file_to_fix=""
1181 fi
1182 fi
1183 if [ \! -z "$file_to_fix" ]; then
1184 echo Checking $file_to_fix
1185 cp $file_to_fix /tmp/$base
1186 chmod +w /tmp/$base
1187 sed -e '
1188 s/__filbuf/_filbuf/g
1189 s/__flsbuf/_flsbuf/g
1190 s/__iob/_iob/g
1191 ' /tmp/$base > /tmp/$base.sed
1192 mv /tmp/$base.sed /tmp/$base
1193 if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then
1194 true
1195 else
1196 echo Fixed $file_to_fix
1197 rm -f ${LIB}/$file
1198 cp /tmp/$base ${LIB}/$file
1199 chmod a+r ${LIB}/$file
1200 fi
1201 rm -f /tmp/$base
1202 fi
1203
1204 # Change <ctype.h> to not define __ctype
1205
1206 file=ctype.h
1207 base=`basename $file`
1208 if [ -r ${LIB}/$file ]; then
1209 file_to_fix=${LIB}/$file
1210 else
1211 if [ -r ${INPUT}/$file ]; then
1212 file_to_fix=${INPUT}/$file
1213 else
1214 file_to_fix=""
1215 fi
1216 fi
1217 if [ \! -z "$file_to_fix" ]; then
1218 echo Checking $file_to_fix
1219 cp $file_to_fix /tmp/$base
1220 chmod +w /tmp/$base
1221 sed -e '
1222 s/__ctype/_ctype/g
1223 ' /tmp/$base > /tmp/$base.sed
1224 mv /tmp/$base.sed /tmp/$base
1225 if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then
1226 true
1227 else
1228 echo Fixed $file_to_fix
1229 rm -f ${LIB}/$file
1230 cp /tmp/$base ${LIB}/$file
1231 chmod a+r ${LIB}/$file
1232 fi
1233 rm -f /tmp/$base
1234 fi
1235 fi
1236 fi
1237
1238 # In limits.h, put #ifndefs around things that are supposed to be defined
1239 # in float.h to avoid redefinition errors if float.h is included first.
1240 # Solaris 2.1 has this problem.
1241
1242 file=limits.h
1243 base=`basename $file`
1244 if [ -r ${LIB}/$file ]; then
1245 file_to_fix=${LIB}/$file
1246 else
1247 if [ -r ${INPUT}/$file ]; then
1248 file_to_fix=${INPUT}/$file
1249 else
1250 file_to_fix=""
1251 fi
1252 fi
1253 if [ \! -z "$file_to_fix" ]; then
1254 echo Checking $file_to_fix
1255 sed -e '/[ ]FLT_MIN[ ]/i\
1256 #ifndef FLT_MIN'\
1257 -e '/[ ]FLT_MIN[ ]/a\
1258 #endif'\
1259 -e '/[ ]FLT_MAX[ ]/i\
1260 #ifndef FLT_MAX'\
1261 -e '/[ ]FLT_MAX[ ]/a\
1262 #endif'\
1263 -e '/[ ]FLT_DIG[ ]/i\
1264 #ifndef FLT_DIG'\
1265 -e '/[ ]FLT_DIG[ ]/a\
1266 #endif'\
1267 -e '/[ ]DBL_MIN[ ]/i\
1268 #ifndef DBL_MIN'\
1269 -e '/[ ]DBL_MIN[ ]/a\
1270 #endif'\
1271 -e '/[ ]DBL_MAX[ ]/i\
1272 #ifndef DBL_MAX'\
1273 -e '/[ ]DBL_MAX[ ]/a\
1274 #endif'\
1275 -e '/[ ]DBL_DIG[ ]/i\
1276 #ifndef DBL_DIG'\
1277 -e '/[ ]DBL_DIG[ ]/a\
1278 #endif' $file_to_fix > /tmp/$base
1279 if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
1280 true
1281 else
1282 echo Fixed $file_to_fix
1283 rm -f ${LIB}/$file
1284 cp /tmp/$base ${LIB}/$file
1285 chmod a+r ${LIB}/$file
1286 fi
1287 rm -f /tmp/$base
1288 fi
1289
1290 # Completely replace <sys/varargs.h> with a file that includes gcc's
1291 # stdarg.h or varargs.h files as appropriate.
1292
1293 file=sys/varargs.h
1294 if [ -r ${INPUT}/$file ]; then
1295 echo Replacing $file
1296 cat > ${LIB}/$file << EOF
1297 /* This file was generated by fixincludes. */
1298 #ifndef _SYS_VARARGS_H
1299 #define _SYS_VARARGS_H
1300
1301 #ifdef __STDC__
1302 #include <stdarg.h>
1303 #else
1304 #include <varargs.h>
1305 #endif
1306
1307 #endif /* _SYS_VARARGS_H */
1308 EOF
1309 chmod a+r ${LIB}/$file
1310 fi
1311
1312 echo 'Removing unneeded directories:'
1313 cd $LIB
1314 files=`find . -type d -print | sort -r`
1315 for file in $files; do
1316 rmdir $LIB/$file > /dev/null 2>&1
1317 done
1318
1319 if $LINKS; then
1320 echo 'Making internal symbolic non-directory links'
1321 cd ${INPUT}
1322 files=`find . -type l -print`
1323 for file in $files; do
1324 dest=`ls -ld $file | sed -n 's/.*-> //p'`
1325 if expr "$dest" : '[^/].*' > /dev/null; then
1326 target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
1327 if [ -f $target ]; then
1328 ln -s $dest ${LIB}/$file >/dev/null 2>&1
1329 fi
1330 fi
1331 done
1332 fi
1333
1334 cd ${ORIG_DIR}
1335
1336 echo 'Replacing <sys/byteorder.h>'
1337 rm -f ${LIB}/sys/byteorder.h
1338 cp ${SRCDIR}/byteorder.h ${LIB}/sys/byteorder.h
1339
1340 exit 0
1341
This page took 0.117157 seconds and 6 git commands to generate.