mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-27 19:05:47 +08:00
2932 lines
67 KiB
Bash
2932 lines
67 KiB
Bash
|
#!/bin/sh -p
|
||
|
#
|
||
|
# DO NOT EDIT THIS FILE (inclhack.sh)
|
||
|
#
|
||
|
# It has been autogen-ed Thursday March 19, 1998 at 08:26:10 AM PST
|
||
|
# From the definitions inclhack.def
|
||
|
# and the template file inclhack.tpl
|
||
|
#
|
||
|
# 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.
|
||
|
#
|
||
|
# This script contains 101 fixup scripts.
|
||
|
#
|
||
|
# See README-fixinc for more information.
|
||
|
#
|
||
|
# inclhack is free software.
|
||
|
#
|
||
|
# You may redistribute it and/or modify it under the terms of the
|
||
|
# GNU General Public License, as published by the Free Software
|
||
|
# Foundation; either version 2, or (at your option) any later version.
|
||
|
#
|
||
|
# inclhack is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||
|
# See the GNU General Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with inclhack. See the file "COPYING". If not,
|
||
|
# write to: The Free Software Foundation, Inc.,
|
||
|
# 59 Temple Place - Suite 330,
|
||
|
# Boston, MA 02111-1307, USA.
|
||
|
#
|
||
|
# # # # # # # # # # # # # # # # # # # # #
|
||
|
#
|
||
|
# Directory containing the original header files.
|
||
|
# (This was named INCLUDES, but that conflicts with a name in Makefile.in.)
|
||
|
#
|
||
|
INPUT=${2-${INPUT-/usr/include}}
|
||
|
|
||
|
( \cd ${INPUT} > /dev/null 2>&1 ) || {
|
||
|
echo 'fixincludes: input dir `'$INPUT"' is an invalid directory"
|
||
|
exit 1
|
||
|
}
|
||
|
|
||
|
# # # # # # # # # # # # # # # # # # # # #
|
||
|
#
|
||
|
# Directory in which to store the results.
|
||
|
# 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
|
||
|
|
||
|
LIB=${1}
|
||
|
|
||
|
# Make sure it exists.
|
||
|
if [ ! -d $LIB ]; then
|
||
|
mkdir $LIB || {
|
||
|
echo fixincludes: output dir '`'$LIB"' cannot be created"
|
||
|
exit 1
|
||
|
}
|
||
|
else
|
||
|
( \cd $LIB && touch DONE && rm DONE ) || {
|
||
|
echo fixincludes: output dir '`'$LIB"' is an invalid directory"
|
||
|
exit 1
|
||
|
}
|
||
|
fi
|
||
|
|
||
|
# Define what target system we're fixing.
|
||
|
#
|
||
|
if test -r ./Makefile; then
|
||
|
target_canonical="`sed -n -e 's,^target[ ]*=[ ]*\(.*\)$,\1,p' < Makefile`"
|
||
|
fi
|
||
|
|
||
|
# If not from the Makefile, then try config.guess
|
||
|
#
|
||
|
if test -z "${target_canonical}" ; then
|
||
|
if test -x ./config.guess ; then
|
||
|
target_canonical="`config.guess`" ; fi
|
||
|
test -z "${target_canonical}" && target_canonical=unknown
|
||
|
fi
|
||
|
|
||
|
# # # # # # # # # # # # # # # # # # # # #
|
||
|
#
|
||
|
# Define PWDCMD as a command to use to get the working dir
|
||
|
# in the form that we want.
|
||
|
PWDCMD=pwd
|
||
|
|
||
|
case "`$PWDCMD`" in
|
||
|
//*)
|
||
|
# On an Apollo, discard everything before `/usr'.
|
||
|
PWDCMD="eval pwd | sed -e 's,.*/usr/,/usr/,'"
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
# Original directory.
|
||
|
ORIGDIR=`${PWDCMD}`
|
||
|
|
||
|
# Make LIB absolute only if needed to avoid problems with the amd.
|
||
|
case $LIB in
|
||
|
/*)
|
||
|
;;
|
||
|
*)
|
||
|
cd $LIB; LIB=`${PWDCMD}`
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
echo Building fixed headers in ${LIB}
|
||
|
|
||
|
# Determine whether this system has symbolic links.
|
||
|
if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
|
||
|
rm -f $LIB/ShouldNotExist
|
||
|
LINKS=true
|
||
|
elif ln -s X /tmp/ShouldNotExist 2>/dev/null; then
|
||
|
rm -f /tmp/ShouldNotExist
|
||
|
LINKS=true
|
||
|
else
|
||
|
LINKS=false
|
||
|
fi
|
||
|
|
||
|
# # # # # # # # # # # # # # # # # # # # #
|
||
|
#
|
||
|
echo Finding directories and links to directories
|
||
|
cd ${INPUT}
|
||
|
# Find all directories and all symlinks that point to directories.
|
||
|
# 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="."
|
||
|
levels=2
|
||
|
while [ -n "$dirs" ] && [ $levels -gt 0 ]
|
||
|
do
|
||
|
levels=`expr $levels - 1`
|
||
|
newdirs=
|
||
|
for d in $dirs
|
||
|
do
|
||
|
echo " Searching $INPUT/$d"
|
||
|
|
||
|
# Find all directories under $d, relative to $d, excluding $d itself.
|
||
|
# (The /. is needed after $d in case $d is a symlink.)
|
||
|
files="$files `find $d/. -type d -print | \
|
||
|
sed -e '/\/\.$/d' -e 's@/./@/@g'`"
|
||
|
# 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=
|
||
|
$LINKS && \
|
||
|
theselinks=`find $d/. -type l -print | sed -e 's@/./@/@g'`
|
||
|
for d1 in $theselinks --dummy--
|
||
|
do
|
||
|
# If the link points to a directory,
|
||
|
# add that dir to $newdirs
|
||
|
if [ -d $d1 ]
|
||
|
then
|
||
|
files="$files $d1"
|
||
|
if [ "`ls -ld $d1 | sed -n 's/.*-> //p'`" != "." ]
|
||
|
then
|
||
|
newdirs="$newdirs $d1"
|
||
|
fi
|
||
|
fi
|
||
|
done
|
||
|
done
|
||
|
|
||
|
dirs="$newdirs"
|
||
|
done
|
||
|
|
||
|
# # # # # # # # # # # # # # # # # # # # #
|
||
|
#
|
||
|
dirs=
|
||
|
echo "All directories (including links to directories):"
|
||
|
echo $files
|
||
|
|
||
|
for file in $files; do
|
||
|
rm -rf $LIB/$file
|
||
|
if [ ! -d $LIB/$file ]
|
||
|
then mkdir $LIB/$file
|
||
|
fi
|
||
|
done
|
||
|
mkdir $LIB/root
|
||
|
|
||
|
# # # # # # # # # # # # # # # # # # # # #
|
||
|
#
|
||
|
# treetops gets an alternating list
|
||
|
# of old directories to copy
|
||
|
# and the new directories to copy to.
|
||
|
treetops="${INPUT} ${LIB}"
|
||
|
|
||
|
if $LINKS; then
|
||
|
echo 'Making symbolic directory links'
|
||
|
for file in $files; do
|
||
|
dest=`ls -ld $file | sed -n 's/.*-> //p'`
|
||
|
if [ "$dest" ]; then
|
||
|
cwd=`${PWDCMD}`
|
||
|
# 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.
|
||
|
x=`${PWDCMD}`
|
||
|
# Canonicalize ${INPUT} now to minimize the time an
|
||
|
# automounter has to change the result of ${PWDCMD}.
|
||
|
cinput=`cd ${INPUT}; ${PWDCMD}`
|
||
|
# If a link points to ., make a similar link to .
|
||
|
if [ $x = ${cinput} ]; then
|
||
|
echo $file '->' . ': Making link'
|
||
|
rm -fr ${LIB}/$file > /dev/null 2>&1
|
||
|
ln -s . ${LIB}/$file > /dev/null 2>&1
|
||
|
# If link leads back into ${INPUT},
|
||
|
# make a similar link here.
|
||
|
elif expr $x : "${cinput}/.*" > /dev/null; then
|
||
|
# Y gets the actual target dir name, relative to ${INPUT}.
|
||
|
y=`echo $x | sed -n "s&${cinput}/&&p"`
|
||
|
# DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
|
||
|
dots=`echo "$file" |
|
||
|
sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
|
||
|
echo $file '->' $dots$y ': Making link'
|
||
|
rm -fr ${LIB}/$file > /dev/null 2>&1
|
||
|
ln -s $dots$y ${LIB}/$file > /dev/null 2>&1
|
||
|
else
|
||
|
# If the link is to a dir $target outside ${INPUT},
|
||
|
# repoint the link at ${INPUT}/root$target
|
||
|
# and process $target into ${INPUT}/root$target
|
||
|
# treat this directory as if it actually contained the files.
|
||
|
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
|
||
|
# Duplicate directory structure created in ${LIB}/$file in new
|
||
|
# root area.
|
||
|
for file2 in $files; do
|
||
|
case $file2 in
|
||
|
$file/*)
|
||
|
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
|
||
|
;;
|
||
|
*)
|
||
|
;;
|
||
|
esac
|
||
|
done
|
||
|
# Get the path from ${LIB} to $file, accounting for symlinks.
|
||
|
parent=`echo "$file" | sed -e 's@/[^/]*$@@'`
|
||
|
libabs=`cd ${LIB}; ${PWDCMD}`
|
||
|
file2=`cd ${LIB}; cd $parent; ${PWDCMD} | sed -e "s@^${libabs}@@"`
|
||
|
# DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
|
||
|
dots=`echo "$file2" | sed -e 's@/[^/]*@../@g'`
|
||
|
rm -fr ${LIB}/$file > /dev/null 2>&1
|
||
|
ln -s ${dots}root$x ${LIB}/$file > /dev/null 2>&1
|
||
|
treetops="$treetops $x ${LIB}/root$x"
|
||
|
fi
|
||
|
fi
|
||
|
cd $cwd
|
||
|
fi
|
||
|
done
|
||
|
fi
|
||
|
|
||
|
# # # # # # # # # # # # # # # # # # # # #
|
||
|
#
|
||
|
required=
|
||
|
set x $treetops
|
||
|
shift
|
||
|
while [ $# != 0 ]; do
|
||
|
# $1 is an old directory to copy, and $2 is the new directory to copy to.
|
||
|
#
|
||
|
SRCDIR=`cd ${INPUT} ; cd $1 ; ${PWDCMD}`
|
||
|
export SRCDIR
|
||
|
shift
|
||
|
|
||
|
DESTDIR=`cd $1;${PWDCMD}`
|
||
|
export DESTDIR
|
||
|
shift
|
||
|
|
||
|
# The same dir can appear more than once in treetops.
|
||
|
# There's no need to scan it more than once.
|
||
|
#
|
||
|
if [ -f ${DESTDIR}/DONE ]
|
||
|
then continue ; fi
|
||
|
|
||
|
touch ${DESTDIR}/DONE
|
||
|
echo Fixing directory ${SRCDIR} into ${DESTDIR}
|
||
|
|
||
|
# 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.
|
||
|
#
|
||
|
cd ${SRCDIR}
|
||
|
|
||
|
if $LINKS; then
|
||
|
files=`find . -name '*.h' \( -type f -o -type l \) -print`
|
||
|
else
|
||
|
files=`find . -name '*.h' -type f -print`
|
||
|
fi
|
||
|
echo Checking header files
|
||
|
for file in $files; do
|
||
|
|
||
|
if ( test ! -r $file -o \
|
||
|
-n "`fgrep 'This file is part of the GNU C Library' $file`" )
|
||
|
then continue ; fi
|
||
|
|
||
|
fixlist=""
|
||
|
|
||
|
# Aix_Syswait fix
|
||
|
#
|
||
|
case "$file" in ./sys/wait.h )
|
||
|
if ( test -n "`egrep 'bos325,' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
aix_syswait"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/^extern pid_t wait3();$/i\
|
||
|
struct rusage;
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Aix_Volatile fix
|
||
|
#
|
||
|
case "$file" in ./sys/signal.h )
|
||
|
if ( test -n "`egrep 'typedef volatile int sig_atomic_t' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
aix_volatile"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/typedef volatile int sig_atomic_t/typedef int sig_atomic_t/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Alpha_Getopt fix
|
||
|
#
|
||
|
case "$file" in ./stdio.h | \
|
||
|
./stdlib.h )
|
||
|
if ( test -n "`egrep 'getopt\\(int, char \\*\\[' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
alpha_getopt"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/getopt(int, char \*\[\],[ ]*char \*)/getopt(int, char *const[], const char *)/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Alpha_Parens fix
|
||
|
#
|
||
|
case "$file" in ./sym.h )
|
||
|
if ( test -n "`egrep '#ifndef\\(__mips64\\)' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
alpha_parens"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/#ifndef(__mips64)/#ifndef __mips64/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Alpha_Sbrk fix
|
||
|
#
|
||
|
case "$file" in ./unistd.h )
|
||
|
if ( test -n "`egrep 'char[ ]*\\*[ ]*sbrk[ ]*\\(' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
alpha_sbrk"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/char\([ ]*\*[ ]*sbrk[ ]*(\)/void\1/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Arm_Norcroft_Hint fix
|
||
|
#
|
||
|
case "$file" in ./X11/Intrinsic.h )
|
||
|
fixlist="${fixlist}
|
||
|
arm_norcroft_hint"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/___type p_type/p_type/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Arm_Wchar fix
|
||
|
#
|
||
|
case "$file" in ./stdlib.h )
|
||
|
if ( test -n "`egrep '#[ ]*define[ ]*__wchar_t' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
arm_wchar"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/\(#[ ]*ifndef[ ]*\)__wchar_t/\1_GCC_WCHAR_T/' \
|
||
|
-e 's/\(#[ ]*define[ ]*\)__wchar_t/\1_GCC_WCHAR_T/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Aux_Asm fix
|
||
|
#
|
||
|
case "$file" in ./sys/param.h )
|
||
|
if ( test -n "`egrep '#ifndef NOINLINE' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
aux_asm"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's|#ifndef NOINLINE|#if !defined(NOINLINE) \&\& !defined(__GNUC__)|' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Avoid_Bool fix
|
||
|
#
|
||
|
case "$file" in ./curses.h )
|
||
|
fixlist="${fixlist}
|
||
|
avoid_bool"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/i\
|
||
|
#ifndef __cplusplus
|
||
|
' \
|
||
|
-e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/a\
|
||
|
#endif
|
||
|
' \
|
||
|
-e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/i\
|
||
|
#ifndef __cplusplus
|
||
|
' \
|
||
|
-e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/a\
|
||
|
#endif
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Bad_Malloc_Decl fix
|
||
|
#
|
||
|
case "$file" in ./rpc/types.h )
|
||
|
if ( test -z "`egrep '\"C\"' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
bad_malloc_decl"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '1i\
|
||
|
#ifdef __cplusplus\
|
||
|
extern "C" {\
|
||
|
#endif\
|
||
|
|
||
|
' \
|
||
|
-e '$a\
|
||
|
#ifdef __cplusplus\
|
||
|
}\
|
||
|
#endif
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Bad_Struct_Term fix
|
||
|
#
|
||
|
case "$file" in ./curses.h )
|
||
|
if ( test -n "`egrep '^[ ]*typedef[ ]+struct[ ]+term[ ]*;' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
bad_struct_term"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/^[ ]*typedef[ ][ ]*\(struct[ ][ ]*term[ ]*;[ ]*\)$/\1/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Badquote fix
|
||
|
#
|
||
|
case "$file" in ./sundev/vuid_event.h )
|
||
|
fixlist="${fixlist}
|
||
|
badquote"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/doesn'\''t/does not/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Broken_Assert_Stdio fix
|
||
|
#
|
||
|
case "$file" in ./assert.h )
|
||
|
if ( test -n "`egrep 'stderr' $file`" -a \
|
||
|
-z "`egrep 'include.*stdio.h' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
broken_assert_stdio"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '1i\
|
||
|
#include <stdio.h>
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Broken_Assert_Stdlib fix
|
||
|
#
|
||
|
case "$file" in ./assert.h )
|
||
|
if ( test -n "`egrep 'exit *\\(|abort *\\(' $file`" -a \
|
||
|
-z "`egrep 'include.*stdlib.h' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
broken_assert_stdlib"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '1i\
|
||
|
#ifdef __cplusplus\
|
||
|
#include <stdlib.h>\
|
||
|
#endif
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Bsd43_Io_Macros fix
|
||
|
#
|
||
|
if ( test -n "`egrep 'BSD43__IO' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
bsd43_io_macros"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/[ ]BSD43__IO[A-Z]*[ ]*(/s/(\(.\),/('\''\1'\'',/' \
|
||
|
-e '/#[ ]*define[ ]*[ ]BSD43__IO/s/'\''\([cgx]\)'\''/\1/g' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi
|
||
|
|
||
|
|
||
|
# Cxx_Cmnt_Hpux fix
|
||
|
#
|
||
|
case "$file" in ./sys/pci.h )
|
||
|
if ( test -n "`egrep 'System Private Structures' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
cxx_cmnt_hpux"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's|//.*$||g' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Cxx_Cmnt_Irix fix
|
||
|
#
|
||
|
case "$file" in ./fam.h )
|
||
|
if ( test -n "`egrep 'indigo.esd' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
cxx_cmnt_irix"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's|//.*$||g' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Cxx_Cmnt_Sunos fix
|
||
|
#
|
||
|
case "$file" in ./sbusdev/audiovar.h | \
|
||
|
./sys/audiovar.h )
|
||
|
fixlist="${fixlist}
|
||
|
cxx_cmnt_sunos"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's|//.*$||g' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Cxx_Cmnt_Vxworks fix
|
||
|
#
|
||
|
case "$file" in ./drv/netif/if_med.h )
|
||
|
if ( test -n "`egrep 'Wind River' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
cxx_cmnt_vxworks"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's|//.*$||g' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Ecd_Cursor fix
|
||
|
#
|
||
|
case "$file" in ./sunwindow/win_lock.h | \
|
||
|
./sunwindow/win_cursor.h )
|
||
|
fixlist="${fixlist}
|
||
|
ecd_cursor"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/ecd.cursor/ecd_cursor/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Else_Label fix
|
||
|
#
|
||
|
if ( test -n "`egrep '^[ ]*#[ ]*else[ ]+[!-.0-~]' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
else_label"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e ':loop
|
||
|
/\\$/N
|
||
|
s/\\$/\\+++fixinc_eol+++/
|
||
|
/\\$/b loop
|
||
|
s/\\+++fixinc_eol+++/\\/g
|
||
|
s%^\([ ]*#[ ]*else\)[ ]*/[^*].*%\1%
|
||
|
s%^\([ ]*#[ ]*else\)[ ]*[^/ ].*%\1%' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi
|
||
|
|
||
|
|
||
|
# Endif_Label fix
|
||
|
#
|
||
|
if ( test -n "`egrep '^[ ]*#[ ]*endif[ ]+[!-.0-~]' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
endif_label"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e ':loop
|
||
|
/\\$/N
|
||
|
s/\\$/\\+++fixinc_eol+++/
|
||
|
/\\$/b loop
|
||
|
s/\\+++fixinc_eol+++/\\/g
|
||
|
s%^\([ ]*#[ ]*endif\)[ ]*/[^*].*%\1%
|
||
|
s%^\([ ]*#[ ]*endif\)[ ]*\*[^/].*%\1%
|
||
|
s%^\([ ]*#[ ]*endif\)[ ]*[^/* ].*%\1%' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi
|
||
|
|
||
|
|
||
|
# Hp_Inline fix
|
||
|
#
|
||
|
case "$file" in ./sys/spinlock.h )
|
||
|
if ( test -n "`egrep 'include.*\"\\.\\./machine/' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
hp_inline"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's,"../machine/inline.h",<machine/inline.h>,' \
|
||
|
-e 's,"../machine/psl.h",<machine/psl.h>,' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Hp_Sysfile fix
|
||
|
#
|
||
|
case "$file" in ./sys/file.h )
|
||
|
if ( test -n "`egrep 'HPUX_SOURCE' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
hp_sysfile"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/(\.\.\.)/(struct file * ...)/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Hpux_Cxx_Unready fix
|
||
|
#
|
||
|
case "$file" in ./assert.h | \
|
||
|
./sys/mman.h )
|
||
|
if ( test -z "`egrep '\"C\"|__BEGIN_DECLS' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
hpux_cxx_unready"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '1i\
|
||
|
#ifdef __cplusplus\
|
||
|
extern "C" {\
|
||
|
#endif\
|
||
|
|
||
|
' \
|
||
|
-e '$a\
|
||
|
#ifdef __cplusplus\
|
||
|
}\
|
||
|
#endif
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Hpux_Maxint fix
|
||
|
#
|
||
|
case "$file" in ./sys/param.h )
|
||
|
fixlist="${fixlist}
|
||
|
hpux_maxint"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/^#[ ]*define[ ]*MAXINT[ ]/i\
|
||
|
#ifndef MAXINT
|
||
|
' \
|
||
|
-e '/^#[ ]*define[ ]*MAXINT[ ]/a\
|
||
|
#endif
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Hpux_Systime fix
|
||
|
#
|
||
|
case "$file" in ./sys/time.h )
|
||
|
if ( test -n "`egrep '^extern struct sigevent;' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
hpux_systime"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/^extern struct sigevent;/struct sigevent;/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Interactv_Add1 fix
|
||
|
#
|
||
|
case "$file" in ./stdio.h | \
|
||
|
./math.h | \
|
||
|
./ctype.h | \
|
||
|
./sys/limits.h | \
|
||
|
./sys/fcntl.h | \
|
||
|
./sys/dirent.h )
|
||
|
if ( test '(' -d /etc/conf/kconfig.d ')' -a \
|
||
|
'(' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`" ')'
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
interactv_add1"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/!defined(__STDC__) && !defined(_POSIX_SOURCE)/!defined(_POSIX_SOURCE)/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Interactv_Add2 fix
|
||
|
#
|
||
|
case "$file" in ./math.h )
|
||
|
if ( test '(' -d /etc/conf/kconfig.d ')' -a \
|
||
|
'(' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`" ')'
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
interactv_add2"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/fmod(double)/fmod(double, double)/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Interactv_Add3 fix
|
||
|
#
|
||
|
case "$file" in ./sys/limits.h )
|
||
|
if ( test '(' -d /etc/conf/kconfig.d ')' -a \
|
||
|
'(' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`" ')'
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
interactv_add3"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/CHILD_MAX/s,/\* Max, Max,' \
|
||
|
-e '/OPEN_MAX/s,/\* Max, Max,' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Io_Def_Quotes fix
|
||
|
#
|
||
|
if ( test -n "`egrep '[ ]_IO[A-Z]*[ ]*\\([A-Za-z]' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
io_def_quotes"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/\([ ]_IO[A-Z]*[ ]*(\)\([A-Za-z]\),/\1'\''\2'\'',/' \
|
||
|
-e '/#[ ]*define[ ]*[ ]_IO/s/'\''\([cgxtf]\)'\''/\1/g' \
|
||
|
-e '/#[ ]*define[ ]*[ ]DESIOC/s/'\''\([cdgx]\)'\''/\1/g' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi
|
||
|
|
||
|
|
||
|
# Ioctl_Fix_Ctrl fix
|
||
|
#
|
||
|
if ( test -n "`egrep 'CTRL[ ]' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
ioctl_fix_ctrl"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/[^A-Z0-9_]CTRL[ ]*(/s/\([^'\'']\))/'\''\1'\'')/' \
|
||
|
-e '/[^A-Z0-9]_CTRL[ ]*(/s/\([^'\'']\))/'\''\1'\'')/' \
|
||
|
-e '/#[ ]*define[ ]*[ ]CTRL/s/'\''\([cgx]\)'\''/\1/g' \
|
||
|
-e '/#[ ]*define[ ]*[ ]_CTRL/s/'\''\([cgx]\)'\''/\1/g' \
|
||
|
-e '/#[ ]*define[ ]*[ ]BSD43_CTRL/s/'\''\([cgx]\)'\''/\1/g' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi
|
||
|
|
||
|
|
||
|
# Ip_Missing_Semi fix
|
||
|
#
|
||
|
case "$file" in ./netinet/ip.h )
|
||
|
fixlist="${fixlist}
|
||
|
ip_missing_semi"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/^struct/,/^};/s/}$/};/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Irix_Bogus_Cxx_Cmnt fix
|
||
|
#
|
||
|
case "$file" in ./elf_abi.h | \
|
||
|
./elf.h )
|
||
|
fixlist="${fixlist}
|
||
|
irix_bogus_cxx_cmnt"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's@"/\*"\*/@"//"@' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Irix_Multiline_Cmnt fix
|
||
|
#
|
||
|
case "$file" in ./sys/types.h )
|
||
|
fixlist="${fixlist}
|
||
|
irix_multiline_cmnt"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's@type of the result@type of the result */@' \
|
||
|
-e 's@of the sizeof@/* of the sizeof@' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Irix_Sockaddr fix
|
||
|
#
|
||
|
case "$file" in ./rpc/auth.h )
|
||
|
if ( test -n "`egrep 'authdes_create.*struct sockaddr' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
irix_sockaddr"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/authdes_create.*struct sockaddr/i\
|
||
|
struct sockaddr;
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Irix_Struct__File fix
|
||
|
#
|
||
|
case "$file" in ./rpc/xdr.h )
|
||
|
fixlist="${fixlist}
|
||
|
irix_struct__file"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/xdrstdio_create.*struct __file_s/i\
|
||
|
struct __file_s;
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Isc_Fmod fix
|
||
|
#
|
||
|
case "$file" in ./math.h )
|
||
|
if ( test -n "`egrep 'fmod\\(double\\)' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
isc_fmod"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/fmod(double)/fmod(double, double)/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Isc_Sys_Limits fix
|
||
|
#
|
||
|
case "$file" in ./sys/limits.h )
|
||
|
if ( test -n "`egrep 'CHILD_MAX' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
isc_sys_limits"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/CHILD_MAX/s,/\* Max, Max,' \
|
||
|
-e '/OPEN_MAX/s,/\* Max, Max,' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Kandr_Concat fix
|
||
|
#
|
||
|
case "$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 | \
|
||
|
./arm/as_support.h | \
|
||
|
./arm/mc_type.h | \
|
||
|
./arm/xcb.h | \
|
||
|
./dev/chardefmac.h | \
|
||
|
./dev/ps_irq.h | \
|
||
|
./dev/screen.h | \
|
||
|
./dev/scsi.h | \
|
||
|
./sys/tty.h | \
|
||
|
./Xm.acorn/XmP.h | \
|
||
|
./bsd43/bsd43_.h )
|
||
|
if ( test -n "`egrep '/\\*\\*/' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
kandr_concat"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's|/\*\*/| ## |g' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Limits_Ifndefs fix
|
||
|
#
|
||
|
case "$file" in ./limits.h )
|
||
|
if ( test -z "`egrep 'ifndef[ ]+FLT_MIN' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
limits_ifndefs"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/[ ]FLT_MIN[ ]/i\
|
||
|
#ifndef FLT_MIN
|
||
|
' \
|
||
|
-e '/[ ]FLT_MIN[ ]/a\
|
||
|
#endif
|
||
|
' \
|
||
|
-e '/[ ]FLT_MAX[ ]/i\
|
||
|
#ifndef FLT_MAX
|
||
|
' \
|
||
|
-e '/[ ]FLT_MAX[ ]/a\
|
||
|
#endif
|
||
|
' \
|
||
|
-e '/[ ]FLT_DIG[ ]/i\
|
||
|
#ifndef FLT_DIG
|
||
|
' \
|
||
|
-e '/[ ]FLT_DIG[ ]/a\
|
||
|
#endif
|
||
|
' \
|
||
|
-e '/[ ]DBL_MIN[ ]/i\
|
||
|
#ifndef DBL_MIN
|
||
|
' \
|
||
|
-e '/[ ]DBL_MIN[ ]/a\
|
||
|
#endif
|
||
|
' \
|
||
|
-e '/[ ]DBL_MAX[ ]/i\
|
||
|
#ifndef DBL_MAX
|
||
|
' \
|
||
|
-e '/[ ]DBL_MAX[ ]/a\
|
||
|
#endif
|
||
|
' \
|
||
|
-e '/[ ]DBL_DIG[ ]/i\
|
||
|
#ifndef DBL_DIG
|
||
|
' \
|
||
|
-e '/[ ]DBL_DIG[ ]/a\
|
||
|
#endif
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Lynx_Void_Int fix
|
||
|
#
|
||
|
case "$file" in ./curses.h )
|
||
|
if ( test -n "`egrep '#[ ]*define[ ]+void[ ]+int' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
lynx_void_int"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/#[ ]*define[ ][ ]*void[ ]int/d' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Lynxos_Fcntl_Proto fix
|
||
|
#
|
||
|
case "$file" in ./fcntl.h )
|
||
|
fixlist="${fixlist}
|
||
|
lynxos_fcntl_proto"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/\(fcntl.*(int, int, \)int)/\1...)/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# M88k_Bad_Hypot_Opt fix
|
||
|
#
|
||
|
case "$file" in ./math.h )
|
||
|
fixlist="${fixlist}
|
||
|
m88k_bad_hypot_opt"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/extern double floor(), ceil(), fmod(), fabs();/extern double floor(), ceil(), fmod(), fabs _PARAMS((double));/' \
|
||
|
-e '/^extern double hypot();$/a\
|
||
|
\/* Workaround a stupid Motorola optimization if one\
|
||
|
of x or y is 0.0 and the other is negative! *\/\
|
||
|
#ifdef __STDC__\
|
||
|
static __inline__ double fake_hypot (double x, double y)\
|
||
|
#else\
|
||
|
static __inline__ double fake_hypot (x, y)\
|
||
|
double x, y;\
|
||
|
#endif\
|
||
|
{\
|
||
|
return fabs (hypot (x, y));\
|
||
|
}\
|
||
|
#define hypot fake_hypot
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# M88k_Bad_S_If fix
|
||
|
#
|
||
|
case "$file" in ./sys/stat.h )
|
||
|
if ( test -n "`egrep '#define[ ]+S_IS[A-Z]*(m)[ ]' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
m88k_bad_s_if"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/^\(#define[ ]*S_IS[A-Z]*(m)\)[ ]*(m[ ]*&[ ]*\(S_IF[A-Z][A-Z][A-Z][A-Z]*\)[ ]*)/\1 (((m)\&S_IFMT)==\2)/' \
|
||
|
-e 's/^\(#define[ ]*S_IS[A-Z]*(m)\)[ ]*(m[ ]*&[ ]*\(0[0-9]*\)[ ]*)/\1 (((m)\&S_IFMT)==\2)/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# M88k_Multi_Incl fix
|
||
|
#
|
||
|
case "$file" in ./time.h )
|
||
|
if ( test -z "`egrep '#ifndef' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
m88k_multi_incl"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
( echo Fixing $file, to protect against multiple inclusion. >&2
|
||
|
cpp_wrapper=`echo $file | sed -e 's,\.,_,g' -e 's,/,_,g'`
|
||
|
sed -e "1i\
|
||
|
#ifndef __GCC_GOT_${cpp_wrapper}_\
|
||
|
#define __GCC_GOT_${cpp_wrapper}_\
|
||
|
" \
|
||
|
-e "$a\
|
||
|
#endif /* ! __GCC_GOT_${cpp_wrapper}_ */
|
||
|
" ) <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
# Shell scripts have the potential of removing the output
|
||
|
#
|
||
|
if test ! -f ${DESTDIR}/$file.
|
||
|
then continue ; fi
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Machine_Name fix
|
||
|
#
|
||
|
if ( test -n "`egrep '^#[ ]*(if|elif).*[^a-zA-Z0-9_](_*[MSRrhim]|[Mbimnpstuv])[a-zA-Z0-9_]' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
machine_name"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e ':loop
|
||
|
/\\$/N
|
||
|
s/\\$/\\+++fixinc_eol+++/
|
||
|
/\\$/b loop
|
||
|
s/\\+++fixinc_eol+++/\\/g
|
||
|
/#[ ]*[el]*if/ {
|
||
|
s/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g
|
||
|
s/ M32 / __M32__ /g
|
||
|
s/ _*MIPSE\([LB]\) / __MIPSE\1__ /g
|
||
|
s/ _*SYSTYPE_\([A-Z0-9]*\) / __SYSTYPE_\1__ /g
|
||
|
s/ _*\([Rr][34]\)000 / __\1000__ /g
|
||
|
s/ _*host_mips / __host_mips__ /g
|
||
|
s/ _*i386 / __i386__ /g
|
||
|
s/ _*mips / __mips__ /g
|
||
|
s/ bsd4\([0-9]\) / __bsd4\1__ /g
|
||
|
s/ is68k / __is68k__ /g
|
||
|
s/ m68k / __m68k__ /g
|
||
|
s/ m88k / __m88k__ /g
|
||
|
s/ mc680\([0-9]\)0 / __mc680\10__ /g
|
||
|
s/ news\([0-9]*\) / __news\1__ /g
|
||
|
s/ ns32000 / __ns32000__ /g
|
||
|
s/ pdp11 / __pdp11__ /g
|
||
|
s/ pyr / __pyr__ /g
|
||
|
s/ sel / __sel__ /g
|
||
|
s/ sony_news / __sony_news__ /g
|
||
|
s/ sparc / __sparc__ /g
|
||
|
s/ sun\([a-z0-9]*\) / __sun\1__ /g
|
||
|
s/ tahoe / __tahoe__ /g
|
||
|
s/ tower\([_0-9]*\) / __tower\1__ /g
|
||
|
s/ u370 / __u370__ /g
|
||
|
s/ u3b\([0-9]*\) / __u3b\1__ /g
|
||
|
s/ unix / __unix__ /g
|
||
|
s/ vax / __vax__ /g
|
||
|
s/ \([a-zA-Z0-9_][a-zA-Z0-9_]*\) /\1/g
|
||
|
}' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi
|
||
|
|
||
|
|
||
|
# Math_Exception fix
|
||
|
#
|
||
|
case "$file" in ./math.h )
|
||
|
if ( test -n "`egrep 'struct exception' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
math_exception"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/struct exception/i\
|
||
|
#ifdef __cplusplus\
|
||
|
#define exception __math_exception\
|
||
|
#endif
|
||
|
' \
|
||
|
-e '/struct exception/a\
|
||
|
#ifdef __cplusplus\
|
||
|
#undef exception\
|
||
|
#endif
|
||
|
' \
|
||
|
-e '/matherr/i\
|
||
|
#ifdef __cplusplus\
|
||
|
#define exception __math_exception\
|
||
|
#endif
|
||
|
' \
|
||
|
-e '/matherr/a\
|
||
|
#ifdef __cplusplus\
|
||
|
#undef exception\
|
||
|
#endif
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Math_Gcc_Ifndefs fix
|
||
|
#
|
||
|
case "$file" in ./math.h )
|
||
|
fixlist="${fixlist}
|
||
|
math_gcc_ifndefs"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
( dbl_max_def="`egrep 'define[ ]+DBL_MAX[ ]+.*' ${SRCDIR}/float.h 2>/dev/null`"
|
||
|
|
||
|
if ( test -n "${dbl_max_def}" \
|
||
|
-a -n "`egrep '#define[ ]*HUGE_VAL[ ]+DBL_MAX' $file`" \
|
||
|
-a -z "`egrep '#define[ ]+DBL_MAX[ ]+' $file`"
|
||
|
) > /dev/null 2>&1
|
||
|
then sed -e '/define[ ]HUGE_VAL[ ]/i\
|
||
|
#ifndef HUGE_VAL
|
||
|
' \
|
||
|
-e '/define[ ]HUGE_VAL[ ]/a\
|
||
|
#endif
|
||
|
'\
|
||
|
-e "/define[ ]HUGE_VAL[ ]DBL_MAX/s/DBL_MAX/$dbl_max_def/"
|
||
|
else sed -e '/define[ ]HUGE_VAL[ ]/i\
|
||
|
#ifndef HUGE_VAL
|
||
|
' \
|
||
|
-e '/define[ ]HUGE_VAL[ ]/a\
|
||
|
#endif
|
||
|
'
|
||
|
fi ) <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
# Shell scripts have the potential of removing the output
|
||
|
#
|
||
|
if test ! -f ${DESTDIR}/$file.
|
||
|
then continue ; fi
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Motorola_Stupid_Opt fix
|
||
|
#
|
||
|
case "$file" in ./math.h )
|
||
|
if ( test -n "`egrep '^extern double hypot();$' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
motorola_stupid_opt"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/^extern double hypot();$/a\
|
||
|
\/* Workaround a stupid Motorola optimization if one\
|
||
|
of x or y is 0.0 and the other is negative! *\/\
|
||
|
#ifdef __STDC__\
|
||
|
static __inline__ double fake_hypot (double x, double y)\
|
||
|
#else\
|
||
|
static __inline__ double fake_hypot (x, y)\
|
||
|
double x, y;\
|
||
|
#endif\
|
||
|
{\
|
||
|
return fabs (hypot (x, y));\
|
||
|
}\
|
||
|
#define hypot fake_hypot
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Nested_Comment fix
|
||
|
#
|
||
|
case "$file" in ./rpc/rpc.h )
|
||
|
fixlist="${fixlist}
|
||
|
nested_comment"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# News_Os_Recursion fix
|
||
|
#
|
||
|
case "$file" in ./stdlib.h )
|
||
|
if ( test -n "`egrep '#include <stdlib.h>' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
news_os_recursion"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/^#include <stdlib.h>/i\
|
||
|
#ifdef BOGUS_RECURSION
|
||
|
' \
|
||
|
-e '/^#include <stdlib.h>/a\
|
||
|
#endif
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Next_Math_Prefix fix
|
||
|
#
|
||
|
case "$file" in ./ansi/math.h )
|
||
|
if ( test -n "`egrep '^extern.*double.*__const__.*' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
next_math_prefix"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/^extern.*double.*__const__.*sqrt(/s/__const__//' \
|
||
|
-e '/^extern.*double.*__const__.*fabs(/s/__const__//' \
|
||
|
-e '/^extern.*double.*__const__.*cos(/s/__const__//' \
|
||
|
-e '/^extern.*double.*__const__.*hypot(/s/__const__//' \
|
||
|
-e '/^extern.*double.*__const__.*sin(/s/__const__//' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Next_Template fix
|
||
|
#
|
||
|
case "$file" in ./bsd/libc.h )
|
||
|
if ( test -n "`egrep 'template' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
next_template"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/\(.*template\)/s/template//' \
|
||
|
-e '/extern.*volatile.*void.*abort/s/volatile//' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Next_Volitile fix
|
||
|
#
|
||
|
case "$file" in ./ansi/stdlib.h )
|
||
|
if ( test -n "`egrep 'volatile' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
next_volitile"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/extern.*volatile.*void.*exit/s/volatile//' \
|
||
|
-e '/extern.*volatile.*void.*abort/s/volatile//' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Next_Wait_Union fix
|
||
|
#
|
||
|
case "$file" in ./sys/wait.h )
|
||
|
if ( test -n "`egrep 'wait\\(union wait' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
next_wait_union"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's@wait(union wait@wait(void@' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# No_Double_Slash fix
|
||
|
#
|
||
|
if ( test -n "`egrep '//[^*]' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
no_double_slash"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/\/\/[^*]/s|//\(.*\)$|/* \1 */|' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi
|
||
|
|
||
|
|
||
|
# Nodeent_Syntax fix
|
||
|
#
|
||
|
case "$file" in ./netdnet/dnetdb.h )
|
||
|
fixlist="${fixlist}
|
||
|
nodeent_syntax"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/char.*na_addr *$/char *na_addr;/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Osf_Namespace_A fix
|
||
|
#
|
||
|
case "$file" in ./reg_types.h | \
|
||
|
./sys/lc_core.h )
|
||
|
if ( test '(' -r reg_types.h-a -r sys/lc_core.h-a -n "`grep '} regex_t;' reg_types.h`"-a -z "`grep __regex_t regex.h`" ')'
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
osf_namespace_a"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/regex_t/__regex_t/g' \
|
||
|
-e 's/regoff_t/__regoff_t/g' \
|
||
|
-e 's/regmatch_t/__regmatch_t/g' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Osf_Namespace_B fix
|
||
|
#
|
||
|
case "$file" in ./regex.h )
|
||
|
if ( test '(' -r reg_types.h-a -r sys/lc_core.h-a -n "`grep '} regex_t;' reg_types.h`"-a -z "`grep __regex_t regex.h`" ')'
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
osf_namespace_b"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/#include <reg_types.h>/a\
|
||
|
typedef __regex_t regex_t;\
|
||
|
typedef __regoff_t regoff_t;\
|
||
|
typedef __regmatch_t regmatch_t;
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Pthread_Page_Size fix
|
||
|
#
|
||
|
case "$file" in ./pthread.h )
|
||
|
if ( test -n "`egrep '^int __page_size' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
pthread_page_size"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/^int __page_size/extern int __page_size/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Rs6000_Double fix
|
||
|
#
|
||
|
case "$file" in ./math.h )
|
||
|
if ( test -n "`egrep '[^a-zA-Z_]class\\(' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
rs6000_double"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/class[(]/i\
|
||
|
#ifndef __cplusplus
|
||
|
' \
|
||
|
-e '/class[(]/a\
|
||
|
#endif
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Rs6000_Fchmod fix
|
||
|
#
|
||
|
case "$file" in ./sys/stat.h )
|
||
|
if ( test -n "`egrep 'fchmod\\(char' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
rs6000_fchmod"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/fchmod(char \*/fchmod(int/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Rs6000_Param fix
|
||
|
#
|
||
|
case "$file" in ./stdio.h | \
|
||
|
./unistd.h )
|
||
|
fixlist="${fixlist}
|
||
|
rs6000_param"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's@rename(const char \*old, const char \*new)@rename(const char *_old, const char *_new)@' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Sony_Include fix
|
||
|
#
|
||
|
case "$file" in ./machine/machparam.h )
|
||
|
if ( test -n "`egrep '\"\\.\\./machine/endian.h\"' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
sony_include"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's@"../machine/endian.h"@<machine/endian.h>@' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Statsswtch fix
|
||
|
#
|
||
|
case "$file" in ./rpcsvc/rstat.h )
|
||
|
if ( test -n "`egrep 'boottime$' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
statsswtch"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/boottime$/boottime;/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Stdio_Va_List fix
|
||
|
#
|
||
|
case "$file" in ./stdio.h )
|
||
|
fixlist="${fixlist}
|
||
|
stdio_va_list"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
( if ( egrep "__need___va_list" $file ) > /dev/null 2>&1 ; then
|
||
|
:
|
||
|
else
|
||
|
echo "#define __need___va_list"
|
||
|
echo "#include <stdarg.h>"
|
||
|
fi
|
||
|
|
||
|
sed -e 's@ va_list @ __gnuc_va_list @' \
|
||
|
-e 's@ va_list)@ __gnuc_va_list)@' \
|
||
|
-e 's@ _BSD_VA_LIST_));@ __gnuc_va_list));@' \
|
||
|
-e 's@ _VA_LIST_));@ __gnuc_va_list));@' \
|
||
|
-e 's@ va_list@ __va_list__@' \
|
||
|
-e 's@\*va_list@*__va_list__@' \
|
||
|
-e 's@ __va_list)@ __gnuc_va_list)@' \
|
||
|
-e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \
|
||
|
-e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \
|
||
|
-e 's@VA_LIST@DUMMY_VA_LIST@' \
|
||
|
-e 's@_Va_LIST@_VA_LIST@' ) <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
# Shell scripts have the potential of removing the output
|
||
|
#
|
||
|
if test ! -f ${DESTDIR}/$file.
|
||
|
then continue ; fi
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Sun_Bogus_Ifdef fix
|
||
|
#
|
||
|
case "$file" in ./hsfs/hsfs_spec.h | \
|
||
|
./hsfs/iso_spec.h )
|
||
|
if ( test -n "`egrep '#ifdef __i386__ || __vax__' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
sun_bogus_ifdef"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Sun_Bogus_Ifdef_Sun4c fix
|
||
|
#
|
||
|
case "$file" in ./hsfs/hsnode.h )
|
||
|
if ( test -n "`egrep '#ifdef __i386__ || __sun4c__' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
sun_bogus_ifdef_sun4c"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Sun_Catmacro fix
|
||
|
#
|
||
|
case "$file" in ./pixrect/memvar.h )
|
||
|
if ( test -n "`egrep '^#define[ ]+CAT(a,b)' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
sun_catmacro"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/^#define[ ]CAT(a,b)/ i\
|
||
|
#ifdef __STDC__ \
|
||
|
#define CAT(a,b) a##b\
|
||
|
#else
|
||
|
' \
|
||
|
-e '/^#define[ ]CAT(a,b)/ a\
|
||
|
#endif
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Sun_Malloc fix
|
||
|
#
|
||
|
case "$file" in ./malloc.h )
|
||
|
fixlist="${fixlist}
|
||
|
sun_malloc"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/typedef[ ]char \* malloc_t/typedef void \* malloc_t/g' \
|
||
|
-e 's/int[ ][ ]*free/void free/g' \
|
||
|
-e 's/char\([ ]*\*[ ]*malloc\)/void\1/g' \
|
||
|
-e 's/char\([ ]*\*[ ]*realloc\)/void\1/g' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Sun_Memcpy fix
|
||
|
#
|
||
|
case "$file" in ./memory.h )
|
||
|
if ( test -n "`egrep '/\\* @\\(#\\)(head/memory.h 50.1 |memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2 )\\*/' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
sun_memcpy"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '1i\
|
||
|
/* 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();\
|
||
|
\
|
||
|
#endif /* __memory_h__ */
|
||
|
' \
|
||
|
-e '1,$d' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Sun_Rusers_Semi fix
|
||
|
#
|
||
|
case "$file" in ./rpcsvc/rusers.h )
|
||
|
if ( test -n "`egrep '_cnt$' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
sun_rusers_semi"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Sun_Signal fix
|
||
|
#
|
||
|
case "$file" in ./sys/signal.h | \
|
||
|
./signal.h )
|
||
|
if ( test -n "`egrep '^void \\(\\*signal\\(\\)\\)\\(\\);' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
sun_signal"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/^void (\*signal())();$/i\
|
||
|
#ifdef __cplusplus\
|
||
|
void (*signal(...))(...);\
|
||
|
#else
|
||
|
' \
|
||
|
-e '/^void (\*signal())();$/a\
|
||
|
#endif
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Sun_Xdr_Proto fix
|
||
|
#
|
||
|
case "$file" in ./rpc/xdr.h )
|
||
|
fixlist="${fixlist}
|
||
|
sun_xdr_proto"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/^\(.*\)\*\(x_.*\)();\(.*\)/\
|
||
|
#ifdef __cplusplus\
|
||
|
\1*\2(...);\3\
|
||
|
#else\
|
||
|
\1*\2();\3\
|
||
|
#endif/g' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Sunos_Large_Macro fix
|
||
|
#
|
||
|
case "$file" in ./sundev/ipi_error.h )
|
||
|
fixlist="${fixlist}
|
||
|
sunos_large_macro"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
( echo "Removing incorrect fix to SunOS <sundev/ipi_error.h>" >&2
|
||
|
rm -f ${DESTDIR}/$file ${DESTDIR}/$file.
|
||
|
cat > /dev/null ) <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
# Shell scripts have the potential of removing the output
|
||
|
#
|
||
|
if test ! -f ${DESTDIR}/$file.
|
||
|
then continue ; fi
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Sunos_Matherr_Decl fix
|
||
|
#
|
||
|
case "$file" in ./math.h )
|
||
|
if ( test '(' "`fgrep 'struct exception' $file | line`" != 'struct exception {' ')'
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
sunos_matherr_decl"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/matherr/i\
|
||
|
struct exception;
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Sunos_Strlen fix
|
||
|
#
|
||
|
case "$file" in ./strings.h )
|
||
|
fixlist="${fixlist}
|
||
|
sunos_strlen"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/int[ ]*strlen();/__SIZE_TYPE__ strlen();/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Systypes fix
|
||
|
#
|
||
|
case "$file" in ./sys/types.h | \
|
||
|
./stdlib.h | \
|
||
|
./sys/stdtypes.h | \
|
||
|
./stddef.h | \
|
||
|
./memory.h | \
|
||
|
./unistd.h )
|
||
|
if ( test -n "`egrep 'typedef[ ]+[a-z_][ a-z_]*[ ](size|ptrdiff|wchar)_t' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
systypes"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/^[ ]**[ ]*typedef unsigned int size_t;/N' \
|
||
|
-e 's/^\([ ]*\*[ ]*typedef unsigned int size_t;\n[ ]*\*\/\)/\1\
|
||
|
#ifndef __SIZE_TYPE__\
|
||
|
#define __SIZE_TYPE__ long unsigned int\
|
||
|
#endif\
|
||
|
typedef __SIZE_TYPE__ size_t;\
|
||
|
/' \
|
||
|
-e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/i\
|
||
|
#ifndef __SIZE_TYPE__\
|
||
|
#define __SIZE_TYPE__ long unsigned int\
|
||
|
#endif
|
||
|
' \
|
||
|
-e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/typedef __SIZE_TYPE__ size_t/' \
|
||
|
-e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/i\
|
||
|
#ifndef __PTRDIFF_TYPE__\
|
||
|
#define __PTRDIFF_TYPE__ long int\
|
||
|
#endif
|
||
|
' \
|
||
|
-e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/typedef __PTRDIFF_TYPE__ ptrdiff_t/' \
|
||
|
-e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/i\
|
||
|
#ifndef __WCHAR_TYPE__\
|
||
|
#define __WCHAR_TYPE__ int\
|
||
|
#endif\
|
||
|
#ifndef __cplusplus
|
||
|
' \
|
||
|
-e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/a\
|
||
|
#endif
|
||
|
' \
|
||
|
-e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/typedef __WCHAR_TYPE__ wchar_t/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Systypes_For_Aix fix
|
||
|
#
|
||
|
case "$file" in ./sys/types.h )
|
||
|
if ( test -n "`egrep 'typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
systypes_for_aix"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/i\
|
||
|
#ifndef _GCC_SIZE_T\
|
||
|
#define _GCC_SIZE_T
|
||
|
' \
|
||
|
-e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/a\
|
||
|
#endif
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Sysv68_String fix
|
||
|
#
|
||
|
case "$file" in ./string.h )
|
||
|
fixlist="${fixlist}
|
||
|
sysv68_string"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/extern[ ]*int[ ]*strlen();/extern unsigned int strlen();/' \
|
||
|
-e 's/extern[ ]*int[ ]*ffs[ ]*(long);/extern int ffs(int);/' \
|
||
|
-e 's/strdup(char \*s1);/strdup(const char *s1);/' \
|
||
|
-e '/^extern char$/N' \
|
||
|
-e 's/^extern char\(\n \*memccpy(),\)$/extern void\1/' \
|
||
|
-e '/^ strncmp(),$/N' \
|
||
|
-e 's/^\( strncmp()\),\n\( strlen(),\)$/\1;\
|
||
|
extern unsigned int\
|
||
|
\2/' \
|
||
|
-e '/^extern int$/N' \
|
||
|
-e 's/^extern int\(\n strlen(),\)/extern size_t\1/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Sysz_Stdlib_For_Sun fix
|
||
|
#
|
||
|
case "$file" in ./stdlib.h )
|
||
|
fixlist="${fixlist}
|
||
|
sysz_stdlib_for_sun"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/int abort/void abort/g' \
|
||
|
-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' \
|
||
|
-e 's/int[ ][ ]*exit/void exit/g' \
|
||
|
-e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/i\
|
||
|
#ifndef _GCC_SIZE_T\
|
||
|
#define _GCC_SIZE_T
|
||
|
' \
|
||
|
-e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/a\
|
||
|
#endif
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Sysz_Stdtypes_For_Sun fix
|
||
|
#
|
||
|
case "$file" in ./sys/stdtypes.h )
|
||
|
fixlist="${fixlist}
|
||
|
sysz_stdtypes_for_sun"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/[ ]size_t.*;/i\
|
||
|
#ifndef _GCC_SIZE_T\
|
||
|
#define _GCC_SIZE_T
|
||
|
' \
|
||
|
-e '/[ ]size_t.*;/a\
|
||
|
#endif
|
||
|
' \
|
||
|
-e '/[ ]ptrdiff_t.*;/i\
|
||
|
#ifndef _GCC_PTRDIFF_T\
|
||
|
#define _GCC_PTRDIFF_T
|
||
|
' \
|
||
|
-e '/[ ]ptrdiff_t.*;/a\
|
||
|
#endif
|
||
|
' \
|
||
|
-e '/[ ]wchar_t.*;/i\
|
||
|
#ifndef _GCC_WCHAR_T\
|
||
|
#define _GCC_WCHAR_T
|
||
|
' \
|
||
|
-e '/[ ]wchar_t.*;/a\
|
||
|
#endif
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Tinfo_Cplusplus fix
|
||
|
#
|
||
|
case "$file" in ./tinfo.h )
|
||
|
fixlist="${fixlist}
|
||
|
tinfo_cplusplus"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/[ ]_cplusplus/ __cplusplus/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Ultrix_Ansi_Compat fix
|
||
|
#
|
||
|
case "$file" in ./ansi_compat.h )
|
||
|
if ( test -n "`egrep 'ULTRIX' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
ultrix_ansi_compat"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '1i\
|
||
|
/* This file intentionally left blank. */
|
||
|
' \
|
||
|
-e '1,$d' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Ultrix_Atof_Param fix
|
||
|
#
|
||
|
case "$file" in ./math.h )
|
||
|
fixlist="${fixlist}
|
||
|
ultrix_atof_param"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's@atof(\([ ]*char[ ]*\*[^)]*\))@atof(const \1)@' \
|
||
|
-e 's@inline int abs(int [a-z][a-z]*) {.*}@extern "C" int abs(int);@' \
|
||
|
-e 's@inline double abs(double [a-z][a-z]*) {.*}@@' \
|
||
|
-e 's@inline int sqr(int [a-z][a-z]*) {.*}@@' \
|
||
|
-e 's@inline double sqr(double [a-z][a-z]*) {.*}@@' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Ultrix_Const fix
|
||
|
#
|
||
|
case "$file" in ./stdio.h )
|
||
|
fixlist="${fixlist}
|
||
|
ultrix_const"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
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,@' \
|
||
|
-e 's@popen(char \*, char \*);@popen(const char *, const char *);@' \
|
||
|
-e 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Ultrix_Ifdef fix
|
||
|
#
|
||
|
case "$file" in ./sys/file.h )
|
||
|
if ( test -n "`egrep '#ifdef KERNEL' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
ultrix_ifdef"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/#ifdef KERNEL/#if defined(KERNEL)/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Ultrix_Nested_Cmnt fix
|
||
|
#
|
||
|
case "$file" in ./rpc/svc.h )
|
||
|
fixlist="${fixlist}
|
||
|
ultrix_nested_cmnt"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's@^\( \* int protocol; \)/\*@\1*/ /*@' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Ultrix_Static fix
|
||
|
#
|
||
|
case "$file" in ./machine/cpu.h )
|
||
|
if ( test -n "`egrep '#include \"r[34]_cpu' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
ultrix_static"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/^static struct tlb_pid_state/struct tlb_pid_state/' \
|
||
|
-e 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/' \
|
||
|
-e 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Undefine_Null fix
|
||
|
#
|
||
|
if ( test -n "`egrep '^#[ ]*define[ ]*[ ]NULL[ ]' $file`" -a \
|
||
|
-z "`egrep '#[ ]*(ifn|un)def[ ]*[ ]NULL($|[ ])' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
undefine_null"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/^#[ ]*define[ ][ ]*NULL[ ]/i\
|
||
|
#undef NULL
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi
|
||
|
|
||
|
|
||
|
# Va_I960_Macro fix
|
||
|
#
|
||
|
case "$file" in ./arch/i960/archI960.h )
|
||
|
if ( test -n "`egrep '__(vsiz|vali|vpad|alignof__)' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
va_i960_macro"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/__vsiz/__vxvsiz/' \
|
||
|
-e 's/__vali/__vxvali/' \
|
||
|
-e 's/__vpad/__vxvpad/' \
|
||
|
-e 's/__alignof__/__vxalignof__/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Void_Null fix
|
||
|
#
|
||
|
case "$file" in ./curses.h | \
|
||
|
./dbm.h | \
|
||
|
./locale.h | \
|
||
|
./stdio.h | \
|
||
|
./stdlib.h | \
|
||
|
./string.h | \
|
||
|
./time.h | \
|
||
|
./unistd.h | \
|
||
|
./sys/dir.h | \
|
||
|
./sys/param.h | \
|
||
|
./sys/types.h )
|
||
|
if ( test -n "`egrep '#[ ]*define[ ][ ]*NULL[ ].*void' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
void_null"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/^#[ ]*define[ ]*NULL[ ]*((void[ ]*\*)0)/#define NULL 0/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Vxworks_Gcc_Problem fix
|
||
|
#
|
||
|
case "$file" in ./types/vxTypesBase.h )
|
||
|
if ( test -n "`egrep '__GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
vxworks_gcc_problem"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/#if 1/' \
|
||
|
-e '/[ ]size_t/i\
|
||
|
#ifndef _GCC_SIZE_T\
|
||
|
#define _GCC_SIZE_T
|
||
|
' \
|
||
|
-e '/[ ]size_t/a\
|
||
|
#endif
|
||
|
' \
|
||
|
-e '/[ ]ptrdiff_t/i\
|
||
|
#ifndef _GCC_PTRDIFF_T\
|
||
|
#define _GCC_PTRDIFF_T
|
||
|
' \
|
||
|
-e '/[ ]ptrdiff_t/a\
|
||
|
#endif
|
||
|
' \
|
||
|
-e '/[ ]wchar_t/i\
|
||
|
#ifndef _GCC_WCHAR_T\
|
||
|
#define _GCC_WCHAR_T
|
||
|
' \
|
||
|
-e '/[ ]wchar_t/a\
|
||
|
#endif
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Vxworks_Needs_Vxtypes fix
|
||
|
#
|
||
|
case "$file" in ./time.h )
|
||
|
if ( test -n "`egrep 'uint_t[ ][ ]*_clocks_per_sec' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
vxworks_needs_vxtypes"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/uint_t/unsigned int/' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Vxworks_Needs_Vxworks fix
|
||
|
#
|
||
|
case "$file" in ./sys/stat.h )
|
||
|
if ( test -n "`egrep '#[ ]define[ ][ ]*__INCstath' $file`" -a \
|
||
|
'(' -r types/vxTypesOld.h ')' -a \
|
||
|
'(' -n "`fgrep '#include' $file`" ')' -a \
|
||
|
'(' -n "`fgrep ULONG $file`" ')'
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
vxworks_needs_vxworks"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/#[ ]define[ ][ ]*__INCstath/a\
|
||
|
#include <types/vxTypesOld.h>
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# Vxworks_Time fix
|
||
|
#
|
||
|
case "$file" in ./time.h )
|
||
|
if ( test -n "`egrep 'VOIDFUNCPTR' $file`" -a \
|
||
|
'(' -r vxWorks.h ')'
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
vxworks_time"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/VOIDFUNCPTR/i\
|
||
|
#ifndef __gcc_VOIDFUNCPTR_defined\
|
||
|
#ifdef __cplusplus\
|
||
|
typedef void (*__gcc_VOIDFUNCPTR) (...);\
|
||
|
#else\
|
||
|
typedef void (*__gcc_VOIDFUNCPTR) ();\
|
||
|
#endif\
|
||
|
#define __gcc_VOIDFUNCPTR_defined\
|
||
|
#endif
|
||
|
' \
|
||
|
-e 's/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# X11_Class fix
|
||
|
#
|
||
|
case "$file" in ./X11/ShellP.h )
|
||
|
if ( test -z "`egrep '__cplusplus' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
x11_class"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/char [*]class;/i\
|
||
|
#ifdef __cplusplus\
|
||
|
char *c_class;\
|
||
|
#else
|
||
|
' \
|
||
|
-e '/char [*]class;/a\
|
||
|
#endif
|
||
|
' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# X11_Class_Usage fix
|
||
|
#
|
||
|
case "$file" in ./Xm/BaseClassI.h )
|
||
|
if ( test -z "`egrep '__cplusplus' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
x11_class_usage"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's/ class[)]/ c_class)/g' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# X11_New fix
|
||
|
#
|
||
|
case "$file" in ./Xm/Traversal.h )
|
||
|
if ( test -z "`egrep '__cplusplus' $file`"
|
||
|
) > /dev/null 2>&1 ; then
|
||
|
fixlist="${fixlist}
|
||
|
x11_new"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e '/Widget old, new;/i\
|
||
|
#ifdef __cplusplus\
|
||
|
Widget old, c_new;\
|
||
|
#else
|
||
|
' \
|
||
|
-e '/Widget old, new;/a\
|
||
|
#endif
|
||
|
' \
|
||
|
-e 's/Widget new,/Widget c_new,/g' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file
|
||
|
fi ;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
# X11_Sprintf fix
|
||
|
#
|
||
|
case "$file" in ./X11*/Xmu.h )
|
||
|
fixlist="${fixlist}
|
||
|
x11_sprintf"
|
||
|
if [ ! -r ${DESTDIR}/$file ]
|
||
|
then exec 4< $file
|
||
|
else exec 4< ${DESTDIR}/$file ; fi
|
||
|
if test $? -ne 0
|
||
|
then continue ; fi
|
||
|
|
||
|
sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
|
||
|
extern char * sprintf();\
|
||
|
#endif /* !defined __STDC__ */,' <&4 > ${DESTDIR}/$file.
|
||
|
exec 4<&-
|
||
|
|
||
|
mv -f ${DESTDIR}/$file. ${DESTDIR}/$file ;;
|
||
|
esac
|
||
|
|
||
|
# IF the output has been removed OR it is unchanged,
|
||
|
# THEN ensure the output is gone
|
||
|
# ELSE look for local directory include syntax
|
||
|
#
|
||
|
if ( test ! -f ${DESTDIR}/$file || \
|
||
|
cmp $file ${DESTDIR}/$file ) > /dev/null 2>&1
|
||
|
then
|
||
|
rm -f ${DESTDIR}/$file
|
||
|
else
|
||
|
echo "Fixed $file:${fixlist}"
|
||
|
|
||
|
# Find any include directives that use "file".
|
||
|
#
|
||
|
for include in `
|
||
|
egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${DESTDIR}/$file |
|
||
|
sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`
|
||
|
do
|
||
|
dir=`echo $file | sed -e s'|/[^/]*$||'`
|
||
|
required="$required ${SRCDIR} $dir/$include ${DESTDIR}/$dir/$include"
|
||
|
done
|
||
|
fi
|
||
|
done # for file in $files
|
||
|
done
|
||
|
|
||
|
## Make sure that any include files referenced using double quotes
|
||
|
## exist in the fixed directory. This comes last since otherwise
|
||
|
## we might end up deleting some of these files "because they don't
|
||
|
## need any change."
|
||
|
set x `echo $required`
|
||
|
shift
|
||
|
while [ $# != 0 ]; do
|
||
|
newreq=
|
||
|
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" >&2
|
||
|
chmod +w $3 2>/dev/null
|
||
|
chmod a+r $3 2>/dev/null
|
||
|
echo Copied $2
|
||
|
for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 |
|
||
|
sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`
|
||
|
do
|
||
|
dir=`echo $2 | sed -e s'|/[^/]*$||'`
|
||
|
dir2=`echo $3 | sed -e s'|/[^/]*$||'`
|
||
|
newreq="$newreq $1 $dir/$include $dir2/$include"
|
||
|
done
|
||
|
fi
|
||
|
shift; shift; shift
|
||
|
done
|
||
|
set x $newreq
|
||
|
shift
|
||
|
done
|
||
|
|
||
|
echo 'Cleaning up DONE files.'
|
||
|
cd $LIB
|
||
|
find . -name DONE -exec rm -f '{}' ';'
|
||
|
|
||
|
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
|