📄 fixinc.svr4
字号:
chmod a+r ${LIB}/$file fi rm -f /tmp/$basefi# Convert functions to prototype form, and fix arg names in <sys/stat.h>.file=sys/stat.hbase=`basename $file`if [ -r ${LIB}/$file ]; then file_to_fix=${LIB}/$fileelse if [ -r ${INPUT}/$file ]; then file_to_fix=${INPUT}/$file else file_to_fix="" fifiif [ \! -z "$file_to_fix" ]; then echo Checking $file_to_fix cp $file_to_fix /tmp/$base chmod +w /tmp/$base sed -e '/^stat([ ]*[^c]/{NNs/(.*)\n/( /s/;\n/, /s/;$/)/}' \ -e '/^lstat([ ]*[^c]/{NNs/(.*)\n/( /s/;\n/, /s/;$/)/}' \ -e '/^fstat([ ]*[^i]/{NNs/(.*)\n/( /s/;\n/, /s/;$/)/}' \ -e '/^mknod([ ]*[^c]/{NNNs/(.*)\n/( /s/;\n/, /gs/;$/)/}' \ -e '1,$s/\([^A-Za-z]\)path\([^A-Za-z]\)/\1__path\2/g' \ -e '1,$s/\([^A-Za-z]\)buf\([^A-Za-z]\)/\1__buf\2/g' \ -e '1,$s/\([^A-Za-z]\)fd\([^A-Za-z]\)/\1__fd\2/g' \ -e '1,$s/ret\([^u]\)/__ret\1/g' \ -e '1,$s/\([^_]\)mode\([^_]\)/\1__mode\2/g' \ -e '1,$s/\([^_r]\)dev\([^_]\)/\1__dev\2/g' /tmp/$base > /tmp/$base.sed if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \ true else echo Fixed $file_to_fix rm -f ${LIB}/$file cp /tmp/$base.sed ${LIB}/$file chmod a+r ${LIB}/$file fi rm -f /tmp/$base /tmp/$base.sedfi# Sony NEWSOS 5.0 does not support the complete ANSI C standard.if [ -x /bin/sony ]; then if /bin/sony; then # Change <stdio.h> to not define __filbuf, __flsbuf, and __iob file=stdio.h base=`basename $file` if [ -r ${LIB}/$file ]; then file_to_fix=${LIB}/$file else if [ -r ${INPUT}/$file ]; then file_to_fix=${INPUT}/$file else file_to_fix="" fi fi if [ \! -z "$file_to_fix" ]; then echo Checking $file_to_fix cp $file_to_fix /tmp/$base chmod +w /tmp/$base sed -e ' s/__filbuf/_filbuf/g s/__flsbuf/_flsbuf/g s/__iob/_iob/g ' /tmp/$base > /tmp/$base.sed mv /tmp/$base.sed /tmp/$base if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then true else echo Fixed $file_to_fix rm -f ${LIB}/$file cp /tmp/$base ${LIB}/$file chmod a+r ${LIB}/$file fi rm -f /tmp/$base fi # Change <ctype.h> to not define __ctype file=ctype.h base=`basename $file` if [ -r ${LIB}/$file ]; then file_to_fix=${LIB}/$file else if [ -r ${INPUT}/$file ]; then file_to_fix=${INPUT}/$file else file_to_fix="" fi fi if [ \! -z "$file_to_fix" ]; then echo Checking $file_to_fix cp $file_to_fix /tmp/$base chmod +w /tmp/$base sed -e ' s/__ctype/_ctype/g ' /tmp/$base > /tmp/$base.sed mv /tmp/$base.sed /tmp/$base if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then true else echo Fixed $file_to_fix rm -f ${LIB}/$file cp /tmp/$base ${LIB}/$file chmod a+r ${LIB}/$file fi rm -f /tmp/$base fi fifi# 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.# Solaris 2.1 has this problem.file=limits.hbase=`basename $file`if [ -r ${LIB}/$file ]; then file_to_fix=${LIB}/$fileelse if [ -r ${INPUT}/$file ]; then file_to_fix=${INPUT}/$file else file_to_fix="" fifiif [ \! -z "$file_to_fix" ]; then echo Checking $file_to_fix 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' $file_to_fix > /tmp/$base if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \ true else echo Fixed $file_to_fix rm -f ${LIB}/$file cp /tmp/$base ${LIB}/$file chmod a+r ${LIB}/$file fi rm -f /tmp/$basefi# Completely replace <sys/varargs.h> with a file that includes gcc's# stdarg.h or varargs.h files as appropriate.file=sys/varargs.hif [ -r ${INPUT}/$file ]; then echo Replacing $file cat > ${LIB}/$file << EOF/* This file was generated by fixincludes. */#ifndef _SYS_VARARGS_H#define _SYS_VARARGS_H#ifdef __STDC__#include <stdarg.h>#else#include <varargs.h>#endif#endif /* _SYS_VARARGS_H */EOF chmod a+r ${LIB}/$filefi# In math.h, put #ifndefs around things that might be defined in a gcc# specific math-*.h file.file=math.hbase=`basename $file`if [ -r ${LIB}/$file ]; then file_to_fix=${LIB}/$fileelse if [ -r ${INPUT}/$file ]; then file_to_fix=${INPUT}/$file else file_to_fix="" fifiif [ \! -z "$file_to_fix" ]; then echo Checking $file_to_fix sed -e '/define[ ]HUGE_VAL[ ]/i\#ifndef HUGE_VAL'\ -e '/define[ ]HUGE_VAL[ ]/a\#endif' $file_to_fix > /tmp/$base if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \ true else echo Fixed $file_to_fix rm -f ${LIB}/$file cp /tmp/$base ${LIB}/$file chmod a+r ${LIB}/$file fi rm -f /tmp/$basefi# Solaris math.h and floatingpoint.h define __P without protection,# which conflicts with the fixproto definition. The fixproto# definition and the Solaris definition are used the same way.for file in math.h floatingpoint.h; do base=`basename $file` if [ -r ${LIB}/$file ]; then file_to_fix=${LIB}/$file else if [ -r ${INPUT}/$file ]; then file_to_fix=${INPUT}/$file else file_to_fix="" fi fi if [ \! -z "$file_to_fix" ]; then echo Checking $file_to_fix sed -e '/^#define[ ]*__P/i\#ifndef __P'\ -e '/^#define[ ]*__P/a\#endif' $file_to_fix > /tmp/$base if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \ true else echo Fixed $file_to_fix rm -f ${LIB}/$file cp /tmp/$base ${LIB}/$file chmod a+r ${LIB}/$file fi rm -f /tmp/$base fidone# The Solaris math.h defines struct exception, which conflicts with# the class exception defined in the C++ file std/stdexcept.h. We# redefine it to __math_exception. This is not a great fix, but I# haven't been able to think of anything better.file=math.hbase=`basename $file`if [ -r ${LIB}/$file ]; then file_to_fix=${LIB}/$fileelse if [ -r ${INPUT}/$file ]; then file_to_fix=${INPUT}/$file else file_to_fix="" fifiif [ \! -z "$file_to_fix" ]; then echo Checking $file_to_fix sed -e '/struct exception/i\#ifdef __cplusplus\#define exception __math_exception\#endif'\ -e '/struct exception/a\#ifdef __cplusplus\#undef exception\#endif' $file_to_fix > /tmp/$base if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \ true else echo Fixed $file_to_fix rm -f ${LIB}/$file cp /tmp/$base ${LIB}/$file chmod a+r ${LIB}/$file fi rm -f /tmp/$basefi# Similarly for struct queue in sys/stream.h.file=sys/stream.hbase=`basename $file`if [ -r ${LIB}/$file ]; then file_to_fix=${LIB}/$fileelse if [ -r ${INPUT}/$file ]; then file_to_fix=${INPUT}/$file else file_to_fix="" fifiif [ \! -z "$file_to_fix" ]; then echo Checking $file_to_fix sed -e '/struct[ ]*queue/i\#ifdef __cplusplus\#define queue __stream_queue\#endif'\ -e '/struct[ ]*queue/a\#ifdef __cplusplus\#undef queue\#endif' $file_to_fix > /tmp/$base if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \ true else echo Fixed $file_to_fix mkdir -p $LIB/`dirname $file` rm -f ${LIB}/$file cp /tmp/$base ${LIB}/$file chmod a+r ${LIB}/$file fi rm -f /tmp/$basefi# If arpa/inet.h prototypes are incompatible with the ones we just# installed in <sys/byteorder.h>, just remove the protos.set -xfile=arpa/inet.hbase=`basename $file`if [ -r ${LIB}/$file ]; then file_to_fix=${LIB}/$fileelse if [ -r ${INPUT}/$file ]; then file_to_fix=${INPUT}/$file else file_to_fix="" fifiif [ \! -z "$file_to_fix" ]; then echo Checking $file_to_fix sed -e '/^extern.*htons.*(in_port_t)/d' \ -e '/^extern.*ntohs.*(in_port_t)/d' \ $file_to_fix > /tmp/$base if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \ true else echo Fixed $file_to_fix mkdir -p $LIB/`dirname $file` rm -f ${LIB}/$file cp /tmp/$base ${LIB}/$file chmod a+r ${LIB}/$file fi rm -f /tmp/$basefiecho 'Removing unneeded directories:'cd $LIBfiles=`find . -type d \! -name '.' -print | sort -r`for file in $files; do rmdir $LIB/$file > /dev/null 2>&1doneif $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 doneficd ${ORIG_DIR}echo 'Replacing <sys/byteorder.h>'if [ \! -d $LIB/sys ]; then mkdir $LIB/sysfirm -f ${LIB}/sys/byteorder.hcat <<'__EOF__' >${LIB}/sys/byteorder.h#ifndef _SYS_BYTEORDER_H#define _SYS_BYTEORDER_H/* Functions to convert `short' and `long' quantities from host byte order to (internet) network byte order (i.e. big-endian). Written by Ron Guilmette (rfg@ncd.com). This isn't actually used by GCC. It is installed by fixinc.svr4. For big-endian machines these functions are essentially no-ops. For little-endian machines, we define the functions using specialized asm sequences in cases where doing so yields better code (e.g. i386). */#if !defined (__GNUC__) && !defined (__GNUG__)#error You lose! This file is only useful with GNU compilers.#endif#ifndef __BYTE_ORDER__/* Byte order defines. These are as defined on UnixWare 1.1, but with double underscores added at the front and back. */#define __LITTLE_ENDIAN__ 1234#define __BIG_ENDIAN__ 4321#define __PDP_ENDIAN__ 3412#endif#ifdef __STDC__static __inline__ unsigned long htonl (unsigned long);static __inline__ unsigned short htons (unsigned int);static __inline__ unsigned long ntohl (unsigned long);static __inline__ unsigned short ntohs (unsigned int);#endif /* defined (__STDC__) */#if defined (__i386__)#ifndef __BYTE_ORDER__#define __BYTE_ORDER__ __LITTLE_ENDIAN__#endif/* Convert a host long to a network long. *//* We must use a new-style function definition, so that this will also be valid for C++. */static __inline__ unsigned longhtonl (unsigned long __arg){ register unsigned long __result; __asm__ ("xchg%B0 %b0,%h0\n\ ror%L0 $16,%0\n\ xchg%B0 %b0,%h0" : "=q" (__result) : "0" (__arg)); return __result;}/* Convert a host short to a network short. */static __inline__ unsigned shorthtons (unsigned int __arg){ register unsigned short __result; __asm__ ("xchg%B0 %b0,%h0" : "=q" (__result) : "0" (__arg)); return __result;}#elif ((defined (__i860__) && !defined (__i860_big_endian__)) \ || defined (__ns32k__) || defined (__vax__) \ || defined (__spur__) || defined (__arm__))#ifndef __BYTE_ORDER__#define __BYTE_ORDER__ __LITTLE_ENDIAN__#endif/* For other little-endian machines, using C code is just as efficient as using assembly code. *//* Convert a host long to a network long. */static __inline__ unsigned longhtonl (unsigned long __arg){ register unsigned long __result; __result = (__arg >> 24) & 0x000000ff; __result |= (__arg >> 8) & 0x0000ff00; __result |= (__arg << 8) & 0x00ff0000; __result |= (__arg << 24) & 0xff000000; return __result;}/* Convert a host short to a network short. */static __inline__ unsigned shorthtons (unsigned int __arg){ register unsigned short __result; __result = (__arg << 8) & 0xff00; __result |= (__arg >> 8) & 0x00ff; return __result;}#else /* must be a big-endian machine */#ifndef __BYTE_ORDER__#define __BYTE_ORDER__ __BIG_ENDIAN__#endif/* Convert a host long to a network long. */static __inline__ unsigned longhtonl (unsigned long __arg){ return __arg;}/* Convert a host short to a network short. */static __inline__ unsigned shorthtons (unsigned int __arg){ return __arg;}#endif /* big-endian *//* Convert a network long to a host long. */static __inline__ unsigned longntohl (unsigned long __arg){ return htonl (__arg);}/* Convert a network short to a host short. */static __inline__ unsigned shortntohs (unsigned int __arg){ return htons (__arg);}__EOF__if [ -r ${INPUT}/sys/byteorder.h ]; then if grep BYTE_ORDER ${INPUT}/sys/byteorder.h >/dev/null 2>/dev/null; then cat <<'__EOF__' >>${LIB}/sys/byteorder.h#ifndef BYTE_ORDER#define LITTLE_ENDIAN __LITTLE_ENDIAN__#define BIG_ENDIAN __BIG_ENDIAN__#define PDP_ENDIAN __PDP_ENDIAN__#define BYTE_ORDER __BYTE_ORDER__#endif__EOF__ fificat <<'__EOF__' >>${LIB}/sys/byteorder.h#endif /* !defined (_SYS_BYTEORDER_H) */__EOF__chmod a+r ${LIB}/sys/byteorder.hdoneif [ x${INSTALL_ASSERT_H} != x ]then cd ${ORIG_DIR} rm -f include/assert.h cp ${srcdir}/assert.h include/assert.h || exit 1 chmod a+r include/assert.hfiexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -