📄 fixincludes
字号:
# sed -e 's/#endif.*/#endif/' ${LIB}/$file > ${LIB}/${file}.sed# rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file# if cmp $file ${LIB}/$file >/dev/null 2>&1; then# echo Deleting ${LIB}/$file\; no fixes were needed.# rm -f ${LIB}/$file# fi#fi# Check for superfluous `static' (in Ultrix 4.2)file=machine/cpu.hif [ -r $file ] && [ ! -r ${LIB}/$file ]; then mkdir ${LIB}/machine 2>/dev/null cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" chmod +w ${LIB}/$file 2>/dev/nullfiif [ -r ${LIB}/$file ]; then echo Fixing $file, superfluous static ex ${LIB}/$file <<EOF g/^static struct tlb_pid_state/ s/static// wqEOF if cmp $file ${LIB}/$file >/dev/null 2>&1; then echo Deleting ${LIB}/$file\; no fixes were needed. rm ${LIB}/$file else# This file has an alternative name, mips/cpu.h. Fix that name, too. if cmp machine/cpu.h mips/cpu.h > /dev/null 2>& 1; then mkdir ${LIB}/mips 2>&- ln ${LIB}/$file ${LIB}/mips/cpu.h fi fifi# Incorrect sprintf declaration in X11/Xmu.hfile=X11/Xmu.hif [ -r $file ] && [ ! -r ${LIB}/$file ]; then mkdir ${LIB}/X11 2>/dev/null cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" chmod +w ${LIB}/$file 2>/dev/nullfiif [ -r ${LIB}/$file ]; then echo Fixing $file sprintf declaration ex ${LIB}/$file <<EOF /^extern char \* sprintf();$/c#ifndef __STDC__extern char * sprintf();#endif /* !defined __STDC__ */. wqEOF if cmp $file ${LIB}/$file >/dev/null 2>&1; then echo Deleting ${LIB}/$file\; no fixes were needed. rm ${LIB}/$file fifi# Incorrect sprintf declaration in X11/Xmu/Xmu.h# (It's not clear whether the right file name is this or X11/Xmu.h.)file=X11/Xmu/Xmu.hif [ -r $file ] && [ ! -r ${LIB}/$file ]; then mkdir ${LIB}/X11/Xmu 2>/dev/null cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" chmod +w ${LIB}/$file 2>/dev/nullfiif [ -r ${LIB}/$file ]; then echo Fixing $file sprintf declaration ex ${LIB}/$file <<EOF /^extern char \* sprintf();$/c#ifndef __STDC__extern char * sprintf();#endif /* !defined __STDC__ */. wqEOF if cmp $file ${LIB}/$file >/dev/null 2>&1; then echo Deleting ${LIB}/$file\; no fixes were needed. rm ${LIB}/$file fifi# Check for missing ';' in structfile=netinet/ip.hif [ -r $file ] && [ ! -r ${LIB}/$file ]; then mkdir ${LIB}/netinet 2>/dev/null cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" chmod +w ${LIB}/$file 2>/dev/nullfiif [ -r ${LIB}/$file ]; then echo Fixing $file sed -e '/^struct/,/^};/s/}$/};/' ${LIB}/$file > ${LIB}/${file}.sed rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file if cmp $file ${LIB}/$file >/dev/null 2>&1; then echo Deleting ${LIB}/$file\; no fixes were needed. rm -f ${LIB}/$file fifi# Fix the CAT macro in SunOS memvar.h.file=pixrect/memvar.hif [ -r $file ] && [ ! -r ${LIB}/$file ]; then mkdir ${LIB}/pixrect 2>/dev/null cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" chmod +w ${LIB}/$file 2>/dev/nullfiif [ -r ${LIB}/$file ]; then echo Fixing $file sed -e '/^#define.CAT(a,b)/ i\#ifdef __STDC__ \#define CAT(a,b) a##b\#else/^#define.CAT(a,b)/ a\#endif' ${LIB}/$file > ${LIB}/${file}.sed rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file if cmp $file ${LIB}/$file >/dev/null 2>&1; then echo Deleting ${LIB}/$file\; no fixes were needed. rm -f ${LIB}/$file fifi# Check for yet more missing ';' in struct (in SunOS 4.0.x)file=rpcsvc/rusers.hif [ -r $file ] && [ ! -r ${LIB}/$file ]; then mkdir ${LIB}/rpcsvc 2>/dev/null cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" chmod +w ${LIB}/$file 2>/dev/nullfiif [ -r ${LIB}/$file ]; then echo Fixing $file sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' ${LIB}/$file > ${LIB}/${file}.sed rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file if cmp $file ${LIB}/$file >/dev/null 2>&1; then echo Deleting ${LIB}/$file\; no fixes were needed. rm -f ${LIB}/$file fifi# Fix return type of exit and abort in <stdlib.h> on SunOS 4.1.file=stdlib.hif [ -r $file ] && [ ! -r ${LIB}/$file ]; then cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" chmod +w ${LIB}/$file 2>/dev/nullfiif [ -r ${LIB}/$file ]; then echo Fixing $file 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' ${LIB}/$file > ${LIB}/${file}.sed rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file if cmp $file ${LIB}/$file >/dev/null 2>&1; then echo Deleting ${LIB}/$file\; no fixes were needed. rm -f ${LIB}/$file fifi# Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.file=malloc.hif [ -r $file ] && [ ! -r ${LIB}/$file ]; then cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" chmod +w ${LIB}/$file 2>/dev/nullfiif [ -r ${LIB}/$file ]; then echo Fixing $file sed -e 's/typedef[ ]char \* malloc_t/typedef void \* malloc_t/g' \ -e 's/int[ ][ ]*free/void free/g' \ ${LIB}/$file > ${LIB}/${file}.sed rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file if cmp $file ${LIB}/$file >/dev/null 2>&1; then echo Deleting ${LIB}/$file\; no fixes were needed. rm -f ${LIB}/$file fifi# Fix bogus comment in <locale.h> on SunOS 4.1.file=locale.hif [ -r $file ] && [ ! -r ${LIB}/$file ]; then cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" chmod +w ${LIB}/$file 2>/dev/nullfiif [ -r ${LIB}/$file ]; then echo Fixing $file sed -e 's%#endif / \*%#endif /\* %g' ${LIB}/$file > ${LIB}/${file}.sed rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file if cmp $file ${LIB}/$file >/dev/null 2>&1; then echo Deleting ${LIB}/$file\; no fixes were needed. rm -f ${LIB}/$file fifi# Fix bogus #ifdef in <hsfs/hsfs_spec.h> on SunOS 4.1.file=hsfs/hsfs_spec.hif [ -r $file ] && [ ! -r ${LIB}/$file ]; then mkdir ${LIB}/hsfs 2>/dev/null cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" chmod +w ${LIB}/$file 2>/dev/nullfiif [ -r ${LIB}/$file ]; then echo Fixing $file sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \ ${LIB}/$file > ${LIB}/${file}.sed rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file if cmp $file ${LIB}/$file >/dev/null 2>&1; then echo Deleting ${LIB}/$file\; no fixes were needed. rm -f ${LIB}/$file fifi# Fix bogus #ifdef in <hsfs/hsnode.h> on SunOS 4.1.file=hsfs/hsnode.hif [ -r $file ] && [ ! -r ${LIB}/$file ]; then mkdir ${LIB}/hsfs 2>/dev/null cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" chmod +w ${LIB}/$file 2>/dev/nullfiif [ -r ${LIB}/$file ]; then echo Fixing $file sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \ ${LIB}/$file > ${LIB}/${file}.sed rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file if cmp $file ${LIB}/$file >/dev/null 2>&1; then echo Deleting ${LIB}/$file\; no fixes were needed. rm -f ${LIB}/$file fifi# Fix bogus #ifdef in <hsfs/iso_spec.h> on SunOS 4.1.file=hsfs/iso_spec.hif [ -r $file ] && [ ! -r ${LIB}/$file ]; then mkdir ${LIB}/hsfs 2>/dev/null cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" chmod +w ${LIB}/$file 2>/dev/nullfiif [ -r ${LIB}/$file ]; then echo Fixing $file sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \ ${LIB}/$file > ${LIB}/${file}.sed rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file if cmp $file ${LIB}/$file >/dev/null 2>&1; then echo Deleting ${LIB}/$file\; no fixes were needed. rm -f ${LIB}/$file fifi# Incorrect #include in Sony News-OS 3.2.file=machine/machparam.hif [ -r $file ] && [ ! -r ${LIB}/$file ]; then mkdir ${LIB}/machine 2>/dev/null cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" chmod +w ${LIB}/$file 2>/dev/nullfiif [ -r ${LIB}/$file ]; then echo Fixing $file, incorrect \#include sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \ ${LIB}/$file > ${LIB}/${file}.sed rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file if cmp $file ${LIB}/$file >/dev/null 2>&1; then echo Deleting ${LIB}/$file\; no fixes were needed. rm -f ${LIB}/$file fifi# Multiline comment after typedef on IRIX 4.0.1.file=sys/types.hif [ -r $file ] && [ ! -r ${LIB}/$file ]; then mkdir ${LIB}/sys 2>/dev/null cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" chmod +w ${LIB}/$file 2>/dev/nullfiif [ -r ${LIB}/$file ]; then echo Fixing $file, comment in the middle of \#ifdef sed -e 's@type of the result@type of the result */@' \ -e 's@of the sizeof@/* of the sizeof@' \ ${LIB}/$file > ${LIB}/${file}.sed rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file if cmp $file ${LIB}/$file >/dev/null 2>&1; then echo Deleting ${LIB}/$file\; no fixes were needed. rm -f ${LIB}/$file fifi# Fix non-ANSI memcpy declaration that conflicts with gcc's builtin# declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because# many other systems have similar text but correct versions of the file.# To ensure only Sun's is fixed, we grep for a likely unique string.file=memory.hif egrep '/\* @\(#\)memory\.h 1\.[2-4] 8./../.. SMI; from S5R2 1\.2 \*/' $file > /dev/null; then if [ -r $file ] && [ ! -r ${LIB}/$file ]; then cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" chmod +w ${LIB}/$file 2>/dev/null fi if [ -r ${LIB}/$file ]; then echo Replacing $file cat > ${LIB}/$file << EOF/* This file was generated by fixincludes */#ifndef __memory_h__#define __memory_h__#ifdef __STDC__extern void *memccpy();extern void *memchr();extern void *memcpy();extern void *memset();#elseextern char *memccpy();extern char *memchr();extern char *memcpy();extern char *memset();#endif /* __STDC__ */extern int memcmp();#endif __memory_h__EOF fifi# parameters not const on DECstation Ultrix V4.0.file=stdio.hif [ -r $file ] && [ ! -r ${LIB}/$file ]; then cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" chmod +w ${LIB}/$file 2>/dev/nullfiif [ -r ${LIB}/$file ]; then echo Fixing $file, non-const arg sed -e 's@perror( char \*__s );@perror( const char *__s );@' \ -e 's@fputs( char \*__s,@fputs( const char *__s,@' \ -e 's@fopen( char \*__filename, char \*__type );@fopen( const char *__filename, const char *__type );@' \ -e 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@' \ -e 's@fscanf( FILE \*__stream, char \*__format,@fscanf( FILE *__stream, const char *__format,@' \ -e 's@scanf( char \*__format,@scanf( const char *__format,@' \ -e 's@sscanf( char \*__s, char \*__format,@sscanf( const char *__s, const char *__format,@' \ ${LIB}/$file > ${LIB}/${file}.sed rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file if cmp $file ${LIB}/$file >/dev/null 2>&1; then echo Deleting ${LIB}/$file\; no fixes were needed. rm -f ${LIB}/$file fifi# Don't use or define the name va_list in stdio.h.# This is for ANSI and also to interoperate properly with gvarargs.h.file=stdio.hif [ -r $file ] && [ ! -r ${LIB}/$file ]; then cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" chmod +w ${LIB}/$file 2>/dev/nullfiif [ -r ${LIB}/$file ]; then echo Fixing $file, use of va_list # Arrange for stdio.h to use stdarg.h to define __gnuc_va_list (echo "#define __need___va_list" echo "#include <stdarg.h>") > ${LIB}/${file}.sed # Use __gnuc_va_list in arg types in place of va_list. # Define __va_list__ (something harmless and unused) instead of va_list. # Don't claim to have defined va_list. sed -e 's@ va_list @ __gnuc_va_list @' \ -e 's@ va_list@ __va_list__@' \ -e 's@\*va_list@*__va_list__@' \ -e 's@VA_LIST@DUMMY_VA_LIST@' \ ${LIB}/$file >> ${LIB}/${file}.sed rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file if cmp $file ${LIB}/$file >/dev/null 2>&1; then echo Deleting ${LIB}/$file\; no fixes were needed. rm -f ${LIB}/$file fifi# Cancel out ansi_compat.h on Ultrix. Replace it with empty file.file=ansi_compat.hif [ -r $file ] && [ ! -r ${LIB}/$file ]; then if grep -s ULTRIX $file; then echo "/* This file intentionally left blank. */" > $LIB/$file fifi# parameter to atof not const on DECstation Ultrix V4.0.# also get rid of bogus inline definitions in HP-UX 8.0file=math.hif [ -r $file ] && [ ! -r ${LIB}/$file ]; then cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" chmod +w ${LIB}/$file 2>/dev/nullfiif [ -r ${LIB}/$file ]; then echo Fixing $file, non-const arg sed -e 's@atof( char \*__nptr );@atof( const char *__nptr );@' \ -e 's@inline int abs(int d) { return (d>0)?d:-d; }@@' \ -e 's@inline double abs(double d) { return fabs(d); }@@' \ ${LIB}/$file > ${LIB}/${file}.sed rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file if cmp $file ${LIB}/$file >/dev/null 2>&1; then echo Deleting ${LIB}/$file\; no fixes were needed. rm -f ${LIB}/$file fifi# These two files on SunOS 4 are included by other files# in the same directory, using "...". So we must make sure they exist# in the same directory as the other fixed files.if [ -r ${INPUT}/multimedia/audio_errno.h ]then ln -s ${INPUT}/multimedia/audio_errno.h ${LIB}/multimedia 2>/dev/nullfiif [ -r ${INPUT}/multimedia/audio_hdr.h ]then ln -s ${INPUT}/multimedia/audio_hdr.h ${LIB}/multimedia 2>/dev/nullfiecho 'Removing unneeded directories:'cd $LIBfiles=`find . -type d -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 donefiexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -