📄 fixinc.dgux
字号:
#!/bin/sh## modified for dgux by hassey@dg-rtp.dg.com based on## fixinc.svr4 written by Ron Guilmette (rfg@ncd.com).## This file is part of GNU CC.# # GNU CC is free software; you can 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.# # GNU CC 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 GNU CC; see the file COPYING. If not, write to# the Free Software Foundation, 59 Temple Place - Suite 330,# Boston, MA 02111-1307, USA.### See README-fixinc for more information.# Fail if no arg to specify a directory for the output.if [ x$1 = x ]then echo fixincludes: no output directory specifiedexit 1fi# Directory in which to store the results.LIB=${1?"fixincludes: output directory not specified"}# Make sure it exists.if [ ! -d $LIB ]; then mkdir $LIB || exit 1fiORIG_DIR=`${PWDCMD-pwd}`# Make LIB absolute if it is relative.# Don't do this if not necessary, since may screw up automounters.case $LIB in/*) ;;*) cd $LIB; LIB=`${PWDCMD-pwd}` ;;esacecho 'Building fixincludes in ' ${LIB}# Determine whether this filesystem has symbolic links.if ln -s X $LIB/ShouldNotExist 2>/dev/null; then rm -f $LIB/ShouldNotExist LINKS=trueelse LINKS=falsefiecho 'Making directories:'# Directory containing the original header files.shiftif [ $# -eq 0 ] ; then set /usr/includefiINLIST="$@"for INPUT in ${INLIST} ; docd ${ORIG_DIR}cd ${INPUT}if $LINKS; then files=`ls -LR | sed -n s/:$//p`else files=`find . -type d -print | sed '/^.$/d'`fifor file in $files; do rm -rf $LIB/$file if [ ! -d $LIB/$file ] then mkdir $LIB/$file fidone# 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 internal symbolic directory links' for file in $files; do dest=`ls -ld $file | sed -n 's/.*-> //p'` if [ "$dest" ]; then cwd=`pwd` # 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=`pwd` # If link leads back into ${INPUT}, # make a similar link here. if expr $x : "${INPUT}/.*" > /dev/null; then # Y gets the actual target dir name, relative to ${INPUT}. y=`echo $x | sed -n "s&${INPUT}/&&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 outside ${INPUT}, # treat this directory as if it actually contained the files.# This line used to have $dest instead of $x.# $dest seemed to be wrong for links found in subdirectories# of ${INPUT}. Does this change break anything? treetops="$treetops $x ${LIB}/$file" fi fi cd $cwd fi donefi# Completely replace <_int_varargs.h> with a file that defines# va_list and gnuc_va_listfile=_int_varargs.hif [ -r ${INPUT}/$file ]; then echo Replacing $file cat > ${LIB}/$file << EOF/* This file was generated by fixinc.dgux. */#ifndef __INT_VARARGS_H#define __INT_VARARGS_H#if defined(__m88k__) && defined (__DGUX__)#ifndef __GNUC_VA_LIST#define __GNUC_VA_LISTtypedef struct{ int __va_arg; /* argument number */ int *__va_stk; /* start of args passed on stack */ int *__va_reg; /* start of args passed in regs */} __gnuc_va_list;#endif /* not __GNUC_VA_LIST */#endif /* 88k && dgux */#ifndef _VA_LIST_#define _VA_LIST_typedef __gnuc_va_list va_list;#endif /* _VA_LIST_ */#endif /* __INT_VARARGS_H */EOF chmod a+r ${LIB}/$filefiecho '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 donefidoneif [ 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 + -