1992-02-29 19:29:37 +01:00
|
|
|
#! /bin/sh
|
|
|
|
# Install modified versions of certain ANSI-incompatible system header files
|
|
|
|
# which are fixed to work correctly with ANSI C
|
|
|
|
# and placed in a directory that GNU C will search.
|
|
|
|
|
|
|
|
# See README-fixinc for more information.
|
|
|
|
|
1993-08-11 15:22:45 +02:00
|
|
|
# Command to run gcc.
|
|
|
|
GCCCMD=${4-${GCCCMD-gcc}}
|
|
|
|
|
1992-07-21 19:47:35 +02:00
|
|
|
# Directory where gcc sources (and sometimes special include files) live.
|
|
|
|
# fixincludes doesn't use this, but fixinc.svr4 does, and I want to make
|
|
|
|
# sure somebody doesn't try to use arg3 for something incompatible. -- gumby
|
|
|
|
SRCDIR=${3-${SRCDIR-.}}
|
|
|
|
|
1992-02-29 19:29:37 +01:00
|
|
|
# Directory containing the original header files.
|
|
|
|
# (This was named INCLUDES, but that conflicts with a name in Makefile.in.)
|
|
|
|
INPUT=${2-${INPUT-/usr/include}}
|
|
|
|
|
1993-01-04 22:55:03 +01:00
|
|
|
# Directory in which to store the results.
|
|
|
|
LIB=${1?"fixincludes: output directory not specified"}
|
1992-02-29 19:29:37 +01:00
|
|
|
|
1992-11-26 18:27:01 +01:00
|
|
|
# Define PWDCMD as a command to use to get the working dir
|
|
|
|
# in the form that we want.
|
|
|
|
PWDCMD=pwd
|
|
|
|
case "`pwd`" in
|
|
|
|
//*)
|
|
|
|
# On an Apollo, discard everything before `/usr'.
|
1992-11-27 05:27:21 +01:00
|
|
|
PWDCMD="eval pwd | sed -e 's,.*/usr/,/usr/,'"
|
1992-11-26 18:27:01 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
1993-02-20 09:17:28 +01:00
|
|
|
# Original directory.
|
|
|
|
ORIGDIR=`${PWDCMD}`
|
|
|
|
|
1992-02-29 19:29:37 +01:00
|
|
|
# Make sure it exists.
|
|
|
|
if [ ! -d $LIB ]; then
|
|
|
|
mkdir $LIB || exit 1
|
|
|
|
fi
|
|
|
|
|
1993-01-06 11:54:53 +01:00
|
|
|
# Make LIB absolute only if needed to avoid problems with the amd.
|
|
|
|
case $LIB in
|
|
|
|
/*)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
cd $LIB; LIB=`${PWDCMD}`
|
|
|
|
;;
|
|
|
|
esac
|
1992-02-29 19:29:37 +01:00
|
|
|
|
1993-02-21 01:14:46 +01:00
|
|
|
# Make SRCDIR absolute only if needed to avoid problems with the amd.
|
|
|
|
cd $ORIGDIR
|
|
|
|
case $SRCDIR in
|
|
|
|
/*)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
cd $SRCDIR; SRCDIR=`${PWDCMD}`
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
1992-02-29 19:29:37 +01:00
|
|
|
# Fail if no arg to specify a directory for the output.
|
|
|
|
if [ x$1 = x ]
|
|
|
|
then echo fixincludes: no output directory specified
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
1992-09-03 10:55:41 +02:00
|
|
|
echo Building fixed headers in ${LIB}
|
1992-02-29 19:29:37 +01:00
|
|
|
|
|
|
|
# Determine whether this system has symbolic links.
|
|
|
|
if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
|
|
|
|
rm -f $LIB/ShouldNotExist
|
1993-07-10 21:06:09 +02:00
|
|
|
LINKS=true
|
|
|
|
elif ln -s X /tmp/ShouldNotExist 2>/dev/null; then
|
|
|
|
rm -f /tmp/ShouldNotExist
|
1992-02-29 19:29:37 +01:00
|
|
|
LINKS=true
|
|
|
|
else
|
|
|
|
LINKS=false
|
|
|
|
fi
|
|
|
|
|
1992-09-03 10:55:41 +02:00
|
|
|
echo Finding directories and links to directories
|
1992-02-29 19:29:37 +01:00
|
|
|
cd ${INPUT}
|
1992-03-18 06:21:50 +01:00
|
|
|
# Find all directories and all symlinks that point to directories.
|
1992-07-12 23:33:47 +02:00
|
|
|
# Put the list in $files.
|
|
|
|
# Each time we find a symlink, add it to newdirs
|
|
|
|
# so that we do another find within the dir the link points to.
|
|
|
|
# Note that $files may have duplicates in it;
|
|
|
|
# later parts of this file are supposed to ignore them.
|
|
|
|
dirs="."
|
1992-07-29 06:44:02 +02:00
|
|
|
levels=2
|
|
|
|
while [ -n "$dirs" ] && [ $levels -gt 0 ]
|
1992-07-12 23:33:47 +02:00
|
|
|
do
|
1992-07-29 06:44:02 +02:00
|
|
|
levels=`expr $levels - 1`
|
1992-07-12 23:33:47 +02:00
|
|
|
newdirs=
|
1992-07-29 06:44:02 +02:00
|
|
|
for d in $dirs
|
1992-07-12 23:33:47 +02:00
|
|
|
do
|
1992-09-03 10:55:41 +02:00
|
|
|
echo " Searching $INPUT/$d"
|
1992-07-12 23:33:47 +02:00
|
|
|
if [ "$d" != . ]
|
|
|
|
then
|
|
|
|
d=$d/.
|
|
|
|
fi
|
|
|
|
|
1992-07-29 06:44:02 +02:00
|
|
|
# Find all directories under $d, relative to $d, excluding $d itself.
|
1992-08-01 20:11:28 +02:00
|
|
|
files="$files `find $d -type d -print | \
|
|
|
|
sed -e '/\/\.$/d' -e '/^\.$/d'`"
|
|
|
|
# Find all links to directories.
|
|
|
|
# Using `-exec test -d' in find fails on some systems,
|
|
|
|
# and trying to run test via sh fails on others,
|
|
|
|
# so this is the simplest alternative left.
|
|
|
|
# First find all the links, then test each one.
|
|
|
|
theselinks=
|
1992-07-12 23:33:47 +02:00
|
|
|
$LINKS && \
|
1992-08-01 20:11:28 +02:00
|
|
|
theselinks=`find $d -type l -print`
|
|
|
|
for d1 in $theselinks --dummy--
|
|
|
|
do
|
1992-09-03 10:55:41 +02:00
|
|
|
# If the link points to a directory,
|
|
|
|
# add that dir to $newdirs
|
1992-08-01 20:11:28 +02:00
|
|
|
if [ -d $d1 ]
|
|
|
|
then
|
|
|
|
newdirs="$newdirs $d1"
|
|
|
|
fi
|
|
|
|
done
|
1992-07-12 23:33:47 +02:00
|
|
|
done
|
|
|
|
|
1992-07-29 06:46:29 +02:00
|
|
|
files="$files $newdirs"
|
1992-07-12 23:33:47 +02:00
|
|
|
dirs="$newdirs"
|
|
|
|
done
|
|
|
|
|
|
|
|
dirs=
|
1992-09-03 10:55:41 +02:00
|
|
|
echo "All directories (including links to directories):"
|
1992-07-12 23:33:47 +02:00
|
|
|
echo $files
|
|
|
|
|
1992-02-29 19:29:37 +01:00
|
|
|
for file in $files; do
|
|
|
|
rm -rf $LIB/$file
|
|
|
|
if [ ! -d $LIB/$file ]
|
|
|
|
then mkdir $LIB/$file
|
|
|
|
fi
|
|
|
|
done
|
1992-09-03 10:55:41 +02:00
|
|
|
mkdir $LIB/root
|
1992-02-29 19:29:37 +01:00
|
|
|
|
|
|
|
# treetops gets an alternating list
|
|
|
|
# of old directories to copy
|
|
|
|
# and the new directories to copy to.
|
|
|
|
treetops="${INPUT} ${LIB}"
|
|
|
|
|
|
|
|
if $LINKS; then
|
1992-09-03 10:55:41 +02:00
|
|
|
echo 'Making symbolic directory links'
|
1992-02-29 19:29:37 +01:00
|
|
|
for file in $files; do
|
|
|
|
dest=`ls -ld $file | sed -n 's/.*-> //p'`
|
|
|
|
if [ "$dest" ]; then
|
1992-11-26 18:27:01 +01:00
|
|
|
cwd=`${PWDCMD}`
|
1992-02-29 19:29:37 +01:00
|
|
|
# In case $dest is relative, get to $file's dir first.
|
|
|
|
cd ${INPUT}
|
|
|
|
cd `echo ./$file | sed -n 's&[^/]*$&&p'`
|
|
|
|
# Check that the target directory exists.
|
|
|
|
# Redirections changed to avoid bug in sh on Ultrix.
|
|
|
|
(cd $dest) > /dev/null 2>&1
|
|
|
|
if [ $? = 0 ]; then
|
|
|
|
cd $dest
|
|
|
|
# X gets the dir that the link actually leads to.
|
1992-11-26 18:27:01 +01:00
|
|
|
x=`${PWDCMD}`
|
1992-09-03 10:55:41 +02:00
|
|
|
# If a link points to ., make a similar link to .
|
|
|
|
if [ $x = $INPUT ]; then
|
|
|
|
echo $file '->' . ': Making link'
|
|
|
|
rm -fr ${LIB}/$file > /dev/null 2>&1
|
|
|
|
ln -s . ${LIB}/$file > /dev/null 2>&1
|
1992-02-29 19:29:37 +01:00
|
|
|
# If link leads back into ${INPUT},
|
|
|
|
# make a similar link here.
|
1992-09-03 10:55:41 +02:00
|
|
|
elif expr $x : "${INPUT}/.*" > /dev/null; then
|
1992-02-29 19:29:37 +01:00
|
|
|
# Y gets the actual target dir name, relative to ${INPUT}.
|
|
|
|
y=`echo $x | sed -n "s&${INPUT}/&&p"`
|
1993-07-01 21:06:50 +02:00
|
|
|
# DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
|
|
|
|
dots=`echo "$file" |
|
|
|
|
sed -e 's@^./@@' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
|
|
|
|
echo $file '->' $dots$y ': Making link'
|
1992-02-29 19:29:37 +01:00
|
|
|
rm -fr ${LIB}/$file > /dev/null 2>&1
|
1993-07-01 21:06:50 +02:00
|
|
|
ln -s $dots$y ${LIB}/$file > /dev/null 2>&1
|
1992-02-29 19:29:37 +01:00
|
|
|
else
|
1992-09-03 10:55:41 +02:00
|
|
|
# If the link is to a dir $target outside ${INPUT},
|
|
|
|
# repoint the link at ${INPUT}/root$target
|
|
|
|
# and process $target into ${INPUT}/root$target
|
1992-02-29 19:29:37 +01:00
|
|
|
# treat this directory as if it actually contained the files.
|
1992-09-03 10:55:41 +02:00
|
|
|
echo $file '->' root$x ': Making link'
|
|
|
|
if [ -d $LIB/root$x ]
|
|
|
|
then true
|
|
|
|
else
|
|
|
|
dirname=root$x/
|
|
|
|
dirmade=.
|
|
|
|
cd $LIB
|
|
|
|
while [ x$dirname != x ]; do
|
|
|
|
component=`echo $dirname | sed -e 's|/.*$||'`
|
|
|
|
mkdir $component >/dev/null 2>&1
|
|
|
|
cd $component
|
|
|
|
dirmade=$dirmade/$component
|
|
|
|
dirname=`echo $dirname | sed -e 's|[^/]*/||'`
|
|
|
|
done
|
|
|
|
fi
|
1993-01-05 03:11:29 +01:00
|
|
|
# Duplicate directory structure created in ${LIB}/$file in new
|
|
|
|
# root area.
|
|
|
|
for file2 in $files; do
|
|
|
|
case $file2 in
|
1993-02-09 20:05:03 +01:00
|
|
|
$file/./*)
|
1993-01-05 03:11:29 +01:00
|
|
|
dupdir=${LIB}/root$x/`echo $file2 | sed -n "s|^${file}/||p"`
|
|
|
|
echo "Duplicating ${file}'s ${dupdir}"
|
|
|
|
if [ -d ${dupdir} ]
|
|
|
|
then true
|
|
|
|
else
|
|
|
|
mkdir ${dupdir}
|
|
|
|
fi
|
|
|
|
;;
|
1993-02-09 20:05:03 +01:00
|
|
|
*)
|
|
|
|
;;
|
1993-01-05 03:11:29 +01:00
|
|
|
esac
|
|
|
|
done
|
1993-07-01 21:06:50 +02:00
|
|
|
# DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
|
|
|
|
dots=`echo "$file" |
|
|
|
|
sed -e 's@^./@@' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
|
1992-09-03 10:55:41 +02:00
|
|
|
rm -fr ${LIB}/$file > /dev/null 2>&1
|
1993-07-01 21:06:50 +02:00
|
|
|
ln -s ${dots}root$x ${LIB}/$file > /dev/null 2>&1
|
1992-09-03 10:55:41 +02:00
|
|
|
treetops="$treetops $x ${LIB}/root$x"
|
1992-02-29 19:29:37 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
cd $cwd
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
1993-10-12 20:51:26 +01:00
|
|
|
required=
|
1993-03-23 00:30:13 +01:00
|
|
|
set x $treetops
|
|
|
|
shift
|
1992-02-29 19:29:37 +01:00
|
|
|
while [ $# != 0 ]; do
|
|
|
|
# $1 is an old directory to copy, and $2 is the new directory to copy to.
|
|
|
|
cd ${INPUT}
|
|
|
|
cd $1
|
1992-09-03 10:55:41 +02:00
|
|
|
# The same dir can appear more than once in treetops.
|
|
|
|
# There's no need to scan it more than once.
|
|
|
|
if [ -f $2/DONE ]
|
|
|
|
then
|
|
|
|
files=
|
|
|
|
else
|
|
|
|
touch $2/DONE
|
|
|
|
echo Fixing directory $1 into $2
|
1992-08-14 07:12:31 +02:00
|
|
|
# Check .h files which are symlinks as well as those which are files.
|
|
|
|
# A link to a header file will not be processed by anything but this.
|
1992-09-19 06:43:29 +02:00
|
|
|
if $LINKS; then
|
|
|
|
files=`find . -name '*.h' \( -type f -o -type l \) -print`
|
|
|
|
else
|
|
|
|
files=`find . -name '*.h' -type f -print`
|
|
|
|
fi
|
1992-09-03 10:55:41 +02:00
|
|
|
echo Checking header files
|
|
|
|
fi
|
1992-02-29 19:29:37 +01:00
|
|
|
# Note that BSD43_* are used on recent MIPS systems.
|
|
|
|
for file in $files; do
|
|
|
|
# This call to egrep is essential, since checking a file with egrep
|
|
|
|
# is much faster than actually trying to fix it.
|
1992-03-18 06:21:50 +01:00
|
|
|
# It is also essential that most files *not* match!
|
|
|
|
# Thus, matching every #endif is unacceptable.
|
1992-02-29 19:29:37 +01:00
|
|
|
# But the argument to egrep must be kept small, or many versions of egrep
|
|
|
|
# won't be able to handle it.
|
1993-03-23 00:30:13 +01:00
|
|
|
#
|
|
|
|
# We use the pattern [!-.0-~] instead of [^/ ] to match a noncomment
|
|
|
|
# following #else or #endif because some buggy egreps think [^/] matches
|
|
|
|
# newline, and they thus think `#else ' matches `#e[ndiflse]*[ ]+[^/ ]'.
|
|
|
|
#
|
|
|
|
# We use the pattern [^a-zA-Z0-9_][_a-ce-km-z][a-z0-9] to match an identifier
|
|
|
|
# following #if or #elif that is not surrounded by __. The `a-ce-km-z'
|
|
|
|
# in this pattern lacks `d' and `l'; this means we don't worry about
|
|
|
|
# identifiers starting with `d' or `l'. This is OK, since none of the
|
|
|
|
# identifiers below start with `d' or `l'. It also greatly improves
|
|
|
|
# performance, since many files contain lines of the form `#if ... defined ...'
|
|
|
|
# or `#if lint'.
|
|
|
|
if egrep '//|[ _]_IO|CTRL|^#define.NULL|^#e[nl][ds][ief]*[ ]+[!-.0-~]|^#[el]*if.*[^a-zA-Z0-9_][_a-ce-km-z][a-z0-9]' $file >/dev/null; then
|
1992-02-29 19:29:37 +01:00
|
|
|
if [ -r $file ]; then
|
|
|
|
cp $file $2/$file >/dev/null 2>&1 \
|
|
|
|
|| echo "Can't copy $file"
|
|
|
|
chmod +w $2/$file
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r $2/$file
|
1993-03-28 09:46:33 +02:00
|
|
|
# Here is how the sed commands in braces work.
|
|
|
|
# (It doesn't work to put the comments inside the sed commands.)
|
|
|
|
# Surround each word with spaces, to simplify matching below.
|
|
|
|
# ANSIfy each pre-ANSI machine-dependent symbol
|
|
|
|
# by surrounding it with __ __.
|
|
|
|
# Remove the spaces that we inserted around each word.
|
1992-02-29 19:29:37 +01:00
|
|
|
sed -e '
|
|
|
|
:loop
|
|
|
|
/\\$/ N
|
|
|
|
/\\$/ b loop
|
1993-07-01 09:46:15 +02:00
|
|
|
s%^\([ ]*#[ ]*else\)[ ]*/[^*].*%\1%
|
|
|
|
s%^\([ ]*#[ ]*else\)[ ]*[^/ ].*%\1%
|
|
|
|
s%^\([ ]*#[ ]*endif\)[ ]*/[^*].*%\1%
|
1993-07-15 01:23:58 +02:00
|
|
|
s%^\([ ]*#[ ]*endif\)[ ]*\*[^/].*%\1%
|
|
|
|
s%^\([ ]*#[ ]*endif\)[ ]*[^/* ].*%\1%
|
1993-01-11 23:21:52 +01:00
|
|
|
/\/\/[^*]/ s|//\(.*\)$|/*\1*/|
|
1993-05-05 20:12:35 +02:00
|
|
|
/[ ]_IO[A-Z]*[ ]*(/ s/\(_IO[A-Z]*[ ]*(\)\(.\),/\1'\''\2'\'',/
|
1992-02-29 19:29:37 +01:00
|
|
|
/[ ]BSD43__IO[A-Z]*[ ]*(/ s/(\(.\),/('\''\1'\'',/
|
1993-10-10 03:46:12 +01:00
|
|
|
/#define._IO/ s/'\''\([cgxt]\)'\''/\1/g
|
1993-03-23 00:30:13 +01:00
|
|
|
/#define.BSD43__IO/ s/'\''\([cgx]\)'\''/\1/g
|
1993-05-20 21:06:46 +02:00
|
|
|
/[^A-Z0-9_]CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/
|
|
|
|
/[^A-Z0-9]_CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/
|
1993-10-21 09:36:14 +01:00
|
|
|
/#define[ ]*[ ]CTRL/ s/'\''\([cgx]\)'\''/\1/g
|
|
|
|
/#define[ ]*[ ]_CTRL/ s/'\''\([cgx]\)'\''/\1/g
|
1993-02-11 19:49:37 +01:00
|
|
|
/#define.BSD43_CTRL/ s/'\''\([cgx]\)'\''/\1/g
|
1993-03-23 00:30:13 +01:00
|
|
|
/#[el]*if/{
|
|
|
|
s/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g
|
|
|
|
|
|
|
|
s/ bsd4\([0-9]\) / __bsd4\1__ /g
|
|
|
|
s/ _*i386 / __i386__ /g
|
|
|
|
s/ is68k / __is68k__ /g
|
|
|
|
s/ m68k / __m68k__ /g
|
|
|
|
s/ mc680\([0-9]\)0 / __mc680\10__ /g
|
|
|
|
s/ news\([0-9]*\) / __news\1__ /g
|
|
|
|
s/ ns32000 / __ns32000__ /g
|
|
|
|
s/ pyr / __pyr__ /g
|
|
|
|
s/ sony_news / __sony_news__ /g
|
|
|
|
s/ sparc / __sparc__ /g
|
|
|
|
s/ sun\([a-z0-9]*\) / __sun\1__ /g
|
|
|
|
s/ unix / __unix__ /g
|
|
|
|
s/ vax / __vax__ /g
|
|
|
|
|
|
|
|
s/ \([a-zA-Z0-9_][a-zA-Z0-9_]*\) /\1/g
|
|
|
|
}
|
1992-06-12 01:15:09 +02:00
|
|
|
/^#define.NULL[ ]/ i\
|
1992-02-29 19:29:37 +01:00
|
|
|
#undef NULL
|
1993-05-18 21:32:56 +02:00
|
|
|
' $2/$file > $2/$file.
|
|
|
|
mv $2/$file. $2/$file
|
1992-02-29 19:29:37 +01:00
|
|
|
if cmp $file $2/$file >/dev/null 2>&1; then
|
|
|
|
rm $2/$file
|
1993-01-12 08:53:32 +01:00
|
|
|
else
|
|
|
|
echo Fixed $file
|
1993-10-12 20:51:26 +01:00
|
|
|
# Find any include directives that use "file".
|
|
|
|
for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $2/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
|
|
|
|
dir=`echo $file | sed -e s'|/[^/]*$||'`
|
|
|
|
required="$required $1 $dir/$include $2/$dir/$include"
|
|
|
|
done
|
1992-02-29 19:29:37 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
shift; shift
|
|
|
|
done
|
|
|
|
|
1993-10-12 20:51:26 +01:00
|
|
|
# Make sure that any include files referenced using double quotes
|
|
|
|
# exist in the fixed directory.
|
|
|
|
set x $required
|
|
|
|
shift
|
|
|
|
while [ $# != 0 ]; do
|
|
|
|
# $1 is the directory to copy from, $2 is the unfixed file,
|
|
|
|
# $3 is the fixed file name.
|
|
|
|
cd ${INPUT}
|
|
|
|
cd $1
|
|
|
|
if [ -r $2 ] && [ ! -r $3 ]; then
|
|
|
|
cp $2 $3 >/dev/null 2>&1 || echo "Can't copy $2"
|
|
|
|
chmod +w $3 2>/dev/null
|
|
|
|
chmod a+r $3 2>/dev/null
|
|
|
|
echo Copied $2
|
|
|
|
fi
|
|
|
|
shift; shift; shift
|
|
|
|
done
|
|
|
|
|
1992-02-29 19:29:37 +01:00
|
|
|
cd ${INPUT}
|
|
|
|
|
1993-02-18 00:21:42 +01:00
|
|
|
# Install the proper definition of size_t in header files that it comes from.
|
1993-07-21 23:04:54 +02:00
|
|
|
for file in sys/types.h stdlib.h sys/stdtypes.h; do
|
1993-02-18 00:21:42 +01:00
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file comment
|
1993-08-11 15:22:45 +02:00
|
|
|
# Get the definition of __SIZE_TYPE__, if any.
|
1993-02-18 00:21:42 +01:00
|
|
|
# (This file must be called something.c).
|
1993-08-11 15:22:45 +02:00
|
|
|
echo "__SIZE_TYPE__" > ${LIB}/types.c
|
|
|
|
foo=`${GCCCMD} -E -P ${LIB}/types.c`
|
1993-02-20 09:17:28 +01:00
|
|
|
rm -f ${LIB}/types.c
|
1993-02-18 00:21:42 +01:00
|
|
|
# Default to our preferred type.
|
1993-08-11 15:22:45 +02:00
|
|
|
if [ "$foo" = __SIZE_TYPE__ ]; then foo="unsigned long int"; fi
|
1993-02-18 00:21:42 +01:00
|
|
|
sed -e "s/typedef[ a-z_]*[ ]size_t/typedef $foo size_t/" ${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
1992-02-29 19:29:37 +01:00
|
|
|
# Fix one other error in this file: a mismatched quote not inside a C comment.
|
|
|
|
file=sundev/vuid_event.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
mkdir ${LIB}/sundev 2>/dev/null
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-02-29 19:29:37 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file comment
|
1993-01-04 22:55:03 +01:00
|
|
|
sed -e "s/doesn't/does not/" ${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
1992-02-29 19:29:37 +01:00
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1993-01-02 01:48:41 +01:00
|
|
|
# Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
|
|
|
|
file=sunwindow/win_cursor.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
# mkdir ${LIB}/sunwindow 2>/dev/null
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
|
|
|
fi
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file
|
|
|
|
sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
file=sunwindow/win_lock.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
# mkdir ${LIB}/sunwindow 2>/dev/null
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
|
|
|
fi
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file
|
|
|
|
sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1992-05-07 08:41:23 +02:00
|
|
|
# Fix this Sun file to avoid interfering with stddef.h.
|
1992-02-29 19:29:37 +01:00
|
|
|
file=sys/stdtypes.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-02-29 19:29:37 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file
|
1993-06-30 19:13:09 +02:00
|
|
|
sed -e '/[ ]size_t.*;/i\
|
1993-01-04 22:55:03 +01:00
|
|
|
#ifndef _GCC_SIZE_T\
|
|
|
|
#define _GCC_SIZE_T' \
|
1993-06-30 19:13:09 +02:00
|
|
|
-e '/[ ]size_t.*;/a\
|
1993-01-04 22:55:03 +01:00
|
|
|
#endif' \
|
1993-06-30 19:13:09 +02:00
|
|
|
-e '/[ ]ptrdiff_t.*;/i\
|
1993-01-04 22:55:03 +01:00
|
|
|
#ifndef _GCC_PTRDIFF_T\
|
|
|
|
#define _GCC_PTRDIFF_T' \
|
1993-06-30 19:13:09 +02:00
|
|
|
-e '/[ ]ptrdiff_t.*;/a\
|
1993-01-04 22:55:03 +01:00
|
|
|
#endif' \
|
1993-06-30 19:13:09 +02:00
|
|
|
-e '/[ ]wchar_t.*;/i\
|
1993-01-04 22:55:03 +01:00
|
|
|
#ifndef _GCC_WCHAR_T\
|
|
|
|
#define _GCC_WCHAR_T' \
|
1993-06-30 19:13:09 +02:00
|
|
|
-e '/[ ]wchar_t.*;/a\
|
1993-01-04 22:55:03 +01:00
|
|
|
#endif' ${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
1992-02-29 19:29:37 +01:00
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1992-12-03 07:40:00 +01:00
|
|
|
# Fix this file to avoid interfering with stddef.h, but don't mistakenly
|
|
|
|
# match e.g. ssize_t present in AIX for the ps/2.
|
1992-02-29 19:29:37 +01:00
|
|
|
file=sys/types.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-02-29 19:29:37 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file
|
1993-01-27 00:19:35 +01:00
|
|
|
sed -e '/[ ]size_t.*;/i\
|
1993-01-04 22:55:03 +01:00
|
|
|
#ifndef _GCC_SIZE_T\
|
|
|
|
#define _GCC_SIZE_T' \
|
1993-01-27 00:19:35 +01:00
|
|
|
-e '/[ ]size_t.*;/a\
|
1993-01-04 22:55:03 +01:00
|
|
|
#endif' ${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
1992-02-29 19:29:37 +01:00
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1993-09-29 22:25:02 +01:00
|
|
|
# Fix HP's use of ../machine/inline.h to refer to
|
|
|
|
# /usr/include/machine/inline.h
|
|
|
|
file=sys/spinlock.h
|
1993-10-10 03:50:18 +01:00
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
1993-09-29 22:25:02 +01:00
|
|
|
cp $file ${LIB}/$file
|
|
|
|
fi
|
|
|
|
if [ -r ${LIB}/$file ] ; then
|
|
|
|
echo Fixing $file
|
|
|
|
sed -e 's,"../machine/inline.h",<machine/inline.h>,' \
|
|
|
|
-e 's,"../machine/psl.h",<machine/psl.h>,' \
|
|
|
|
${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1992-12-05 01:49:52 +01:00
|
|
|
# Fix an error in this file: the #if says _cplusplus, not the double
|
|
|
|
# underscore __cplusplus that it should be
|
|
|
|
file=tinfo.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
mkdir ${LIB}/rpcsvc 2>/dev/null
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-12-05 01:49:52 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file, __cplusplus macro
|
|
|
|
sed -e 's/[ ]_cplusplus/ __cplusplus/' ${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1992-02-29 19:29:37 +01:00
|
|
|
# Fix an error in this file: a missing semi-colon at the end of the statsswtch
|
|
|
|
# structure definition.
|
|
|
|
file=rpcsvc/rstat.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
mkdir ${LIB}/rpcsvc 2>/dev/null
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-02-29 19:29:37 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file, definition of statsswtch
|
1993-01-04 22:55:03 +01:00
|
|
|
sed -e 's/boottime$/boottime;/' ${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
1992-02-29 19:29:37 +01:00
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Fix an error in this file: a missing semi-colon at the end of the nodeent
|
|
|
|
# structure definition.
|
|
|
|
file=netdnet/dnetdb.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
mkdir ${LIB}/netdnet 2>/dev/null
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-02-29 19:29:37 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file, definition of nodeent
|
1993-01-04 22:55:03 +01:00
|
|
|
sed -e 's/char.*na_addr *$/char *na_addr;/' ${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
1992-02-29 19:29:37 +01:00
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check for bad #ifdef line (in Ultrix 4.1)
|
|
|
|
file=sys/file.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-02-29 19:29:37 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file, bad \#ifdef line
|
1993-01-04 22:55:03 +01:00
|
|
|
sed -e 's/#ifdef KERNEL/#if defined(KERNEL)/' ${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
1992-02-29 19:29:37 +01:00
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check for superfluous `static' (in Ultrix 4.2)
|
|
|
|
file=machine/cpu.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
mkdir ${LIB}/machine 2>/dev/null
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-02-29 19:29:37 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file, superfluous static
|
1993-01-04 22:55:03 +01:00
|
|
|
sed -e 's/^static struct tlb_pid_state/struct tlb_pid_state/' ${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
1992-02-29 19:29:37 +01:00
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm ${LIB}/$file
|
|
|
|
else
|
|
|
|
# This file has an alternative name, mips/cpu.h. Fix that name, too.
|
1993-07-21 23:04:54 +02:00
|
|
|
if cmp machine/cpu.h mips/cpu.h > /dev/null 2>&1; then
|
1992-02-29 19:29:37 +01:00
|
|
|
mkdir ${LIB}/mips 2>&-
|
|
|
|
ln ${LIB}/$file ${LIB}/mips/cpu.h
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1992-03-07 21:39:54 +01:00
|
|
|
# Incorrect sprintf declaration in X11/Xmu.h
|
1992-02-29 19:29:37 +01:00
|
|
|
file=X11/Xmu.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
mkdir ${LIB}/X11 2>/dev/null
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-02-29 19:29:37 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file sprintf declaration
|
1993-01-04 22:55:03 +01:00
|
|
|
sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
|
|
|
|
extern char * sprintf();\
|
1993-01-06 04:01:33 +01:00
|
|
|
#endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.sed
|
1993-01-04 22:55:03 +01:00
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
1992-02-29 19:29:37 +01:00
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1992-07-25 10:34:46 +02:00
|
|
|
# Incorrect sprintf declaration in X11/Xmu/Xmu.h
|
|
|
|
# (It's not clear whether the right file name is this or X11/Xmu.h.)
|
|
|
|
file=X11/Xmu/Xmu.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
mkdir ${LIB}/X11/Xmu 2>/dev/null
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-07-25 10:34:46 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file sprintf declaration
|
1993-01-04 22:55:03 +01:00
|
|
|
sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
|
|
|
|
extern char * sprintf();\
|
1993-01-06 04:01:33 +01:00
|
|
|
#endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.sed
|
1993-01-04 22:55:03 +01:00
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
1992-07-25 10:34:46 +02:00
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1992-02-29 19:29:37 +01:00
|
|
|
# Check for missing ';' in struct
|
|
|
|
file=netinet/ip.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
mkdir ${LIB}/netinet 2>/dev/null
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-02-29 19:29:37 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file
|
|
|
|
sed -e '/^struct/,/^};/s/}$/};/' ${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm -f ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1992-03-07 21:39:54 +01:00
|
|
|
# Fix the CAT macro in SunOS memvar.h.
|
1992-02-29 19:29:37 +01:00
|
|
|
file=pixrect/memvar.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
mkdir ${LIB}/pixrect 2>/dev/null
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-02-29 19:29:37 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file
|
|
|
|
sed -e '/^#define.CAT(a,b)/ i\
|
|
|
|
#ifdef __STDC__ \
|
|
|
|
#define CAT(a,b) a##b\
|
|
|
|
#else
|
|
|
|
/^#define.CAT(a,b)/ a\
|
|
|
|
#endif
|
|
|
|
' ${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm -f ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check for yet more missing ';' in struct (in SunOS 4.0.x)
|
|
|
|
file=rpcsvc/rusers.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
mkdir ${LIB}/rpcsvc 2>/dev/null
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-02-29 19:29:37 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file
|
|
|
|
sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' ${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm -f ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Fix return type of exit and abort in <stdlib.h> on SunOS 4.1.
|
1993-07-15 01:15:19 +02:00
|
|
|
# Also wrap protection around size_t for m88k-sysv3 systems.
|
1992-02-29 19:29:37 +01:00
|
|
|
file=stdlib.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-02-29 19:29:37 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file
|
|
|
|
sed -e 's/int abort/void abort/g' \
|
1992-03-30 03:50:51 +02:00
|
|
|
-e 's/int free/void free/g' \
|
|
|
|
-e 's/char \* calloc/void \* calloc/g' \
|
|
|
|
-e 's/char \* malloc/void \* malloc/g' \
|
|
|
|
-e 's/char \* realloc/void \* realloc/g' \
|
1993-07-15 01:15:19 +02:00
|
|
|
-e 's/int exit/void exit/g' \
|
1993-07-15 19:05:38 +02:00
|
|
|
-e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/i\
|
1993-07-15 01:15:19 +02:00
|
|
|
#ifndef _GCC_SIZE_T\
|
|
|
|
#define _GCC_SIZE_T' \
|
1993-07-15 19:05:38 +02:00
|
|
|
-e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/a\
|
1993-07-15 01:15:19 +02:00
|
|
|
#endif' \
|
|
|
|
${LIB}/$file > ${LIB}/${file}.sed
|
1992-02-29 19:29:37 +01:00
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm -f ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1992-05-19 21:28:45 +02:00
|
|
|
# Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
|
|
|
|
file=malloc.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-05-19 21:28:45 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file
|
1992-05-29 00:48:16 +02:00
|
|
|
sed -e 's/typedef[ ]char \* malloc_t/typedef void \* malloc_t/g' \
|
1992-06-11 23:05:39 +02:00
|
|
|
-e 's/int[ ][ ]*free/void free/g' \
|
1992-05-19 21:28:45 +02:00
|
|
|
${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm -f ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1992-02-29 19:29:37 +01:00
|
|
|
# Fix bogus #ifdef in <hsfs/hsfs_spec.h> on SunOS 4.1.
|
|
|
|
file=hsfs/hsfs_spec.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
mkdir ${LIB}/hsfs 2>/dev/null
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-02-29 19:29:37 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file
|
|
|
|
sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
|
1993-05-18 21:32:56 +02:00
|
|
|
${LIB}/$file > ${LIB}/${file}.
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
|
1992-02-29 19:29:37 +01:00
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm -f ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Fix bogus #ifdef in <hsfs/hsnode.h> on SunOS 4.1.
|
|
|
|
file=hsfs/hsnode.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
mkdir ${LIB}/hsfs 2>/dev/null
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-02-29 19:29:37 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file
|
|
|
|
sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \
|
|
|
|
${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm -f ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Fix bogus #ifdef in <hsfs/iso_spec.h> on SunOS 4.1.
|
|
|
|
file=hsfs/iso_spec.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
mkdir ${LIB}/hsfs 2>/dev/null
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-02-29 19:29:37 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file
|
|
|
|
sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
|
|
|
|
${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm -f ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1992-03-07 21:39:54 +01:00
|
|
|
# Incorrect #include in Sony News-OS 3.2.
|
|
|
|
file=machine/machparam.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
mkdir ${LIB}/machine 2>/dev/null
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-03-07 21:39:54 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file, incorrect \#include
|
|
|
|
sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \
|
1993-05-18 21:32:56 +02:00
|
|
|
${LIB}/$file > ${LIB}/${file}.
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
|
1992-03-07 21:39:54 +01:00
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm -f ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Multiline comment after typedef on IRIX 4.0.1.
|
|
|
|
file=sys/types.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
mkdir ${LIB}/sys 2>/dev/null
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-03-07 21:39:54 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file, comment in the middle of \#ifdef
|
|
|
|
sed -e 's@type of the result@type of the result */@' \
|
|
|
|
-e 's@of the sizeof@/* of the sizeof@' \
|
|
|
|
${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm -f ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1993-05-05 20:12:35 +02:00
|
|
|
# Turning // comments into /* */ comments trashes this IRIX 4.0.1
|
|
|
|
# header file, which embeds // comments inside multi-line /* */
|
|
|
|
# comments. If this looks like the IRIX header file, we refix it by
|
|
|
|
# just throwing away the // comments.
|
|
|
|
file=fam.h
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
if egrep indigo.esd ${LIB}/$file > /dev/null; then
|
|
|
|
echo Fixing $file, overeager sed script
|
|
|
|
rm ${LIB}/$file
|
|
|
|
sed -e 's|//.*$||g' $file > ${LIB}/$file
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1993-05-06 21:59:56 +02:00
|
|
|
# Another IRIX 4.0.1 header file contains the string "//"
|
|
|
|
file=elf_abi.h
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file, overeager sed script
|
|
|
|
sed -e 's|"/\*"\*/|"//"|' ${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm -f ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1993-09-08 21:10:46 +02:00
|
|
|
# Same problem with a file from SunOS 4.1.3 : a header file containing
|
|
|
|
# the string "//" embedded in "/**/"
|
|
|
|
file=sbusdev/audiovar.h
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file, overeager sed script
|
|
|
|
rm ${LIB}/$file
|
|
|
|
sed -e 's|//.*$||g' $file > ${LIB}/$file
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
|
|
|
fi
|
|
|
|
|
1992-05-20 02:10:41 +02:00
|
|
|
# Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
|
|
|
|
# declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because
|
|
|
|
# many other systems have similar text but correct versions of the file.
|
|
|
|
# To ensure only Sun's is fixed, we grep for a likely unique string.
|
|
|
|
file=memory.h
|
1993-05-11 06:40:17 +02:00
|
|
|
if [ -r $file ] && egrep '/\* @\(#\)memory\.h 1\.[2-4] 8./../.. SMI; from S5R2 1\.2 \*/' $file > /dev/null; then
|
|
|
|
if [ ! -r ${LIB}/$file ]; then
|
1992-05-20 02:10:41 +02:00
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-05-20 02:10:41 +02:00
|
|
|
fi
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Replacing $file
|
|
|
|
cat > ${LIB}/$file << EOF
|
|
|
|
/* This file was generated by fixincludes */
|
|
|
|
#ifndef __memory_h__
|
|
|
|
#define __memory_h__
|
|
|
|
|
|
|
|
#ifdef __STDC__
|
|
|
|
extern void *memccpy();
|
|
|
|
extern void *memchr();
|
|
|
|
extern void *memcpy();
|
|
|
|
extern void *memset();
|
|
|
|
#else
|
|
|
|
extern char *memccpy();
|
|
|
|
extern char *memchr();
|
|
|
|
extern char *memcpy();
|
|
|
|
extern char *memset();
|
|
|
|
#endif /* __STDC__ */
|
|
|
|
|
|
|
|
extern int memcmp();
|
|
|
|
|
1993-03-24 22:10:11 +01:00
|
|
|
#endif /* __memory_h__ */
|
1992-05-20 02:10:41 +02:00
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1992-05-27 23:31:00 +02:00
|
|
|
# parameters not const on DECstation Ultrix V4.0.
|
|
|
|
file=stdio.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-05-27 23:31:00 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file, non-const arg
|
|
|
|
sed -e 's@perror( char \*__s );@perror( const char *__s );@' \
|
|
|
|
-e 's@fputs( char \*__s,@fputs( const char *__s,@' \
|
|
|
|
-e 's@fopen( char \*__filename, char \*__type );@fopen( const char *__filename, const char *__type );@' \
|
|
|
|
-e 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@' \
|
|
|
|
-e 's@fscanf( FILE \*__stream, char \*__format,@fscanf( FILE *__stream, const char *__format,@' \
|
|
|
|
-e 's@scanf( char \*__format,@scanf( const char *__format,@' \
|
|
|
|
-e 's@sscanf( char \*__s, char \*__format,@sscanf( const char *__s, const char *__format,@' \
|
|
|
|
${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm -f ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1993-01-07 23:35:20 +01:00
|
|
|
# parameters conflict with C++ new on rs/6000
|
1993-07-25 00:03:22 +02:00
|
|
|
for file in stdio.h unistd.h ; do
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file, parameter name conflicts
|
|
|
|
sed -e 's@rename(const char \*old, const char \*new)@rename(const char *_old, const char *_new)@' \
|
|
|
|
${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm -f ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# function class(double x) conflicts with C++ keyword on rs/6000
|
|
|
|
file=math.h
|
1993-01-07 23:35:20 +01:00
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1993-07-25 00:03:22 +02:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1993-01-07 23:35:20 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
1993-07-25 00:03:22 +02:00
|
|
|
if grep 'class[(]' ${LIB}/$file >/dev/null; then
|
|
|
|
echo Fixing $file
|
|
|
|
sed -e '/class[(]/i\
|
|
|
|
#ifndef __cplusplus' \
|
|
|
|
-e '/class[(]/a\
|
|
|
|
#endif' ${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# NeXT defines 'int wait(union wait*)', which conflicts with Posix.1.
|
|
|
|
file=sys/wait.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ] \
|
|
|
|
&& grep 'wait[(]union wait' ${LIB}/$file >/dev/null; then
|
|
|
|
echo Fixing $file, bad wait formal
|
|
|
|
sed -e 's@wait(union wait@wait(void@' ${LIB}/$file > ${LIB}/${file}.sed
|
1993-01-07 23:35:20 +01:00
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm -f ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1992-09-03 10:55:41 +02:00
|
|
|
# Don't use or define the name va_list in stdio.h.
|
|
|
|
# This is for ANSI and also to interoperate properly with gvarargs.h.
|
|
|
|
file=stdio.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-09-03 10:55:41 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file, use of va_list
|
|
|
|
# Arrange for stdio.h to use stdarg.h to define __gnuc_va_list
|
|
|
|
(echo "#define __need___va_list"
|
|
|
|
echo "#include <stdarg.h>") > ${LIB}/${file}.sed
|
|
|
|
# Use __gnuc_va_list in arg types in place of va_list.
|
1993-01-27 00:26:23 +01:00
|
|
|
# On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
|
|
|
|
# trailing parentheses and semicolon save all other systems from this.
|
1992-09-03 10:55:41 +02:00
|
|
|
# Define __va_list__ (something harmless and unused) instead of va_list.
|
|
|
|
# Don't claim to have defined va_list.
|
|
|
|
sed -e 's@ va_list @ __gnuc_va_list @' \
|
1993-02-21 01:14:46 +01:00
|
|
|
-e 's@ va_list)@ __gnuc_va_list)@' \
|
1993-01-27 00:26:23 +01:00
|
|
|
-e 's@ _VA_LIST_));@ __gnuc_va_list));@' \
|
1992-09-03 10:55:41 +02:00
|
|
|
-e 's@ va_list@ __va_list__@' \
|
1992-10-13 21:53:10 +01:00
|
|
|
-e 's@\*va_list@*__va_list__@' \
|
1993-06-28 20:58:14 +02:00
|
|
|
-e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \
|
1992-09-03 10:55:41 +02:00
|
|
|
-e 's@VA_LIST@DUMMY_VA_LIST@' \
|
1993-06-28 20:58:14 +02:00
|
|
|
-e 's@_NEED___Va_LIST@_NEED___VA_LIST@' \
|
1992-09-03 10:55:41 +02:00
|
|
|
${LIB}/$file >> ${LIB}/${file}.sed
|
|
|
|
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm -f ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1992-08-18 06:19:17 +02:00
|
|
|
# Cancel out ansi_compat.h on Ultrix. Replace it with empty file.
|
|
|
|
file=ansi_compat.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
if grep -s ULTRIX $file; then
|
|
|
|
echo "/* This file intentionally left blank. */" > $LIB/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1992-05-27 23:31:00 +02:00
|
|
|
# parameter to atof not const on DECstation Ultrix V4.0.
|
1992-11-21 00:26:34 +01:00
|
|
|
# also get rid of bogus inline definitions in HP-UX 8.0
|
1992-05-27 23:31:00 +02:00
|
|
|
file=math.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
1992-12-30 08:19:45 +01:00
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
1992-05-27 23:31:00 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file, non-const arg
|
|
|
|
sed -e 's@atof( char \*__nptr );@atof( const char *__nptr );@' \
|
1992-11-21 00:26:34 +01:00
|
|
|
-e 's@inline int abs(int d) { return (d>0)?d:-d; }@@' \
|
|
|
|
-e 's@inline double abs(double d) { return fabs(d); }@@' \
|
1992-05-27 23:31:00 +02:00
|
|
|
${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm -f ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1993-01-06 11:11:52 +01:00
|
|
|
# In limits.h, put #ifndefs around things that are supposed to be defined
|
|
|
|
# in float.h to avoid redefinition errors if float.h is included first.
|
1993-04-09 21:12:20 +02:00
|
|
|
# On HP/UX this patch does not work, because on HP/UX limits.h uses
|
|
|
|
# multi line comments and the inserted #endif winds up inside the
|
|
|
|
# comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if
|
|
|
|
# we find a #ifndef FLT_MIN we assume that all the required #ifndefs
|
|
|
|
# are there, and we do not add them ourselves.
|
1993-01-06 11:11:52 +01:00
|
|
|
file=limits.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
1993-04-09 21:12:20 +02:00
|
|
|
if egrep 'ifndef[ ]+FLT_MIN' ${LIB}/$file >/dev/null; then
|
|
|
|
true
|
|
|
|
else
|
|
|
|
echo Fixing $file
|
|
|
|
sed -e '/[ ]FLT_MIN[ ]/i\
|
1993-01-06 11:11:52 +01:00
|
|
|
#ifndef FLT_MIN'\
|
1993-04-09 21:12:20 +02:00
|
|
|
-e '/[ ]FLT_MIN[ ]/a\
|
1993-01-06 11:11:52 +01:00
|
|
|
#endif'\
|
1993-04-09 21:12:20 +02:00
|
|
|
-e '/[ ]FLT_MAX[ ]/i\
|
1993-01-06 11:11:52 +01:00
|
|
|
#ifndef FLT_MAX'\
|
1993-04-09 21:12:20 +02:00
|
|
|
-e '/[ ]FLT_MAX[ ]/a\
|
1993-01-06 11:11:52 +01:00
|
|
|
#endif'\
|
1993-04-09 21:12:20 +02:00
|
|
|
-e '/[ ]FLT_DIG[ ]/i\
|
1993-01-06 11:11:52 +01:00
|
|
|
#ifndef FLT_DIG'\
|
1993-04-09 21:12:20 +02:00
|
|
|
-e '/[ ]FLT_DIG[ ]/a\
|
1993-01-06 11:11:52 +01:00
|
|
|
#endif'\
|
1993-04-09 21:12:20 +02:00
|
|
|
-e '/[ ]DBL_MIN[ ]/i\
|
1993-01-06 11:11:52 +01:00
|
|
|
#ifndef DBL_MIN'\
|
1993-04-09 21:12:20 +02:00
|
|
|
-e '/[ ]DBL_MIN[ ]/a\
|
1993-01-06 11:11:52 +01:00
|
|
|
#endif'\
|
1993-04-09 21:12:20 +02:00
|
|
|
-e '/[ ]DBL_MAX[ ]/i\
|
1993-01-06 11:11:52 +01:00
|
|
|
#ifndef DBL_MAX'\
|
1993-04-09 21:12:20 +02:00
|
|
|
-e '/[ ]DBL_MAX[ ]/a\
|
1993-01-06 11:11:52 +01:00
|
|
|
#endif'\
|
1993-04-09 21:12:20 +02:00
|
|
|
-e '/[ ]DBL_DIG[ ]/i\
|
1993-01-06 11:11:52 +01:00
|
|
|
#ifndef DBL_DIG'\
|
1993-04-09 21:12:20 +02:00
|
|
|
-e '/[ ]DBL_DIG[ ]/a\
|
1993-01-06 11:11:52 +01:00
|
|
|
#endif'\
|
1993-04-09 21:12:20 +02:00
|
|
|
${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
fi
|
1993-01-06 11:11:52 +01:00
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
echo Deleting ${LIB}/$file\; no fixes were needed.
|
|
|
|
rm -f ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1993-09-28 23:41:21 +01:00
|
|
|
# In math.h, put #ifndefs around things that might be defined in a gcc
|
|
|
|
# specific math-*.h file.
|
|
|
|
file=math.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file
|
|
|
|
sed -e '/define[ ]HUGE_VAL[ ]/i\
|
|
|
|
#ifndef HUGE_VAL'\
|
|
|
|
-e '/define[ ]HUGE_VAL[ ]/a\
|
|
|
|
#endif'\
|
|
|
|
${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
echo Deleting ${LIB}/$file\; no fixes were needed.
|
|
|
|
rm -f ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1993-10-14 02:47:52 +01:00
|
|
|
# Remove erroneous parentheses in sym.h on Alpha OSF/1.
|
|
|
|
file=sym.h
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
echo Fixing $file
|
|
|
|
sed -e 's/#ifndef(__mips64)/#ifndef __mips64/' \
|
|
|
|
${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm -f ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1992-06-24 22:21:08 +02:00
|
|
|
# These two files on SunOS 4 are included by other files
|
|
|
|
# in the same directory, using "...". So we must make sure they exist
|
1992-06-25 06:03:11 +02:00
|
|
|
# in the same directory as the other fixed files.
|
|
|
|
if [ -r ${INPUT}/multimedia/audio_errno.h ]
|
1992-06-24 22:21:08 +02:00
|
|
|
then
|
1992-06-25 06:03:11 +02:00
|
|
|
ln -s ${INPUT}/multimedia/audio_errno.h ${LIB}/multimedia 2>/dev/null
|
1992-06-24 22:21:08 +02:00
|
|
|
fi
|
1992-06-25 06:03:11 +02:00
|
|
|
if [ -r ${INPUT}/multimedia/audio_hdr.h ]
|
1992-06-24 22:21:08 +02:00
|
|
|
then
|
1992-06-25 06:03:11 +02:00
|
|
|
ln -s ${INPUT}/multimedia/audio_hdr.h ${LIB}/multimedia 2>/dev/null
|
1992-06-24 22:21:08 +02:00
|
|
|
fi
|
|
|
|
|
1993-06-14 23:48:40 +02:00
|
|
|
# Determine if we're on Interactive Unix 2.2 or later, in which case we
|
|
|
|
# need to fix some additional files. This is the same test for ISC that
|
|
|
|
# Autoconf uses.
|
|
|
|
if test -d /etc/conf/kconfig.d \
|
|
|
|
&& grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1; then
|
|
|
|
echo "Fixing ISC __STDC__ goof in several files..."
|
|
|
|
for name in stdio.h math.h ctype.h sys/limits.h sys/fcntl.h sys/dirent.h; do
|
|
|
|
echo $name
|
|
|
|
if test -r ${LIB}/$name; then
|
|
|
|
file=${LIB}/$name
|
|
|
|
else
|
|
|
|
file=${INPUT}/$name
|
|
|
|
fi
|
|
|
|
# On Interactive 2.2, certain traditional Unix definitions
|
|
|
|
# (notably getc and putc in stdio.h) are omitted if __STDC__ is
|
|
|
|
# defined, not just if _POSIX_SOURCE is defined. This makes it
|
|
|
|
# impossible to compile any nontrivial program except with -posix.
|
|
|
|
sed \
|
|
|
|
's/!defined(__STDC__) && !defined(_POSIX_SOURCE)/!defined(_POSIX_SOURCE)/' \
|
|
|
|
< $file > ${LIB}/$name.
|
|
|
|
mv ${LIB}/$name. ${LIB}/$name
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "Fixing ISC fmod declaration"
|
|
|
|
# This one's already been fixed for other things.
|
|
|
|
file=${LIB}/math.h
|
|
|
|
sed 's/fmod(double)/fmod(double, double)/' <$file >$file.
|
|
|
|
mv $file. $file
|
|
|
|
|
|
|
|
echo "Fixing nested comments in ISC <sys/limits.h>"
|
|
|
|
file=sys/limits.h
|
|
|
|
sed '/CHILD_MAX/s,/\* Max, Max,' < ${INPUT}/$file >${LIB}/$file.
|
|
|
|
sed '/OPEN_MAX/s,/\* Max, Max,' < ${LIB}/$file. >${LIB}/$file
|
|
|
|
fi
|
|
|
|
|
1993-09-28 23:54:25 +01:00
|
|
|
# These files in Sun OS 4.x use /**/ to concatenate tokens.
|
|
|
|
for file in sparc/asm_linkage.h sun3/asm_linkage.h sun3x/asm_linkage.h \
|
|
|
|
sun4/asm_linkage.h sun4c/asm_linkage.h sun4m/asm_linkage.h \
|
|
|
|
sun4c/debug/asm_linkage.h sun4m/debug/asm_linkage.h;
|
|
|
|
do
|
|
|
|
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
|
|
|
|
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
|
|
|
|
chmod +w ${LIB}/$file 2>/dev/null
|
|
|
|
chmod a+r ${LIB}/$file 2>/dev/null
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r ${LIB}/$file ]; then
|
|
|
|
sed -e 's|/\*\*/|##|g' ${LIB}/$file > ${LIB}/${file}.sed
|
|
|
|
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
|
|
|
|
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
|
|
|
|
rm -f ${LIB}/$file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
1992-02-29 19:29:37 +01:00
|
|
|
echo 'Removing unneeded directories:'
|
|
|
|
cd $LIB
|
|
|
|
files=`find . -type d -print | sort -r`
|
|
|
|
for file in $files; do
|
|
|
|
rmdir $LIB/$file > /dev/null 2>&1
|
|
|
|
done
|
|
|
|
|
|
|
|
if $LINKS; then
|
|
|
|
echo 'Making internal symbolic non-directory links'
|
|
|
|
cd ${INPUT}
|
|
|
|
files=`find . -type l -print`
|
|
|
|
for file in $files; do
|
|
|
|
dest=`ls -ld $file | sed -n 's/.*-> //p'`
|
|
|
|
if expr "$dest" : '[^/].*' > /dev/null; then
|
|
|
|
target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
|
|
|
|
if [ -f $target ]; then
|
|
|
|
ln -s $dest ${LIB}/$file >/dev/null 2>&1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
1993-03-23 00:30:13 +01:00
|
|
|
echo 'Cleaning up DONE files.'
|
|
|
|
cd $LIB
|
1993-10-12 19:02:38 +01:00
|
|
|
find . -name DONE -exec rm -f '{}' ';'
|
1993-03-11 05:53:06 +01:00
|
|
|
|
1992-02-29 19:29:37 +01:00
|
|
|
exit 0
|