⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 include.sh

📁 ncbi源码
💻 SH
字号:
#! /bin/sh## $Id: include.sh,v 1000.0 2003/10/29 14:24:48 gouriano Exp $# ===========================================================================# #                            PUBLIC DOMAIN NOTICE#               National Center for Biotechnology Information# #  This software/database is a "United States Government Work" under the#  terms of the United States Copyright Act.  It was written as part of#  the author's official duties as a United States Government employee and#  thus cannot be copyrighted.  This software/database is freely available#  to the public for use. The National Library of Medicine and the U.S.#  Government have not placed any restriction on its use or reproduction.# #  Although all reasonable efforts have been taken to ensure the accuracy#  and reliability of the software and data, the NLM and the U.S.#  Government do not and cannot warrant the performance or results that#  may be obtained by using this software or data. The NLM and the U.S.#  Government disclaim all warranties, express or implied, including#  warranties of performance, merchantability or fitness for any particular#  purpose.# #  Please cite the author in any work or product based on this material.#  # ===========================================================================# # Author:  Anton Lavrentiev# # MSVC project file patcher. Patch include file paths when the nesting# directory level changes.## ===========================================================================include() {cat <<"EOF" >$1#!/bin/shif [ _$1 = _ -o _$2 = _ ]; then  echo "ERROR: Incorrect call. Stop."  exit 3elif [ \! -f $1 ]; then  echo "ERROR: File \"$1\" inexistent. Stop."  exit 2fiorig=$1shiftfor d in $* ; do  if [ _`echo $d | sed -e 's|^/.*||'` != _ ]; then    echo "ERROR: \"$d\" is not an absolute path. Stop."    exit 2  fidonefile=/tmp/$$_file# DOS-2-UNIX conversion (shouldn't be here, but just in case for sanity).#sed -e 's/
*$//' $orig >$file# Check signature.#cat <<-"EOF" >/tmp/$$_genusign	# Microsoft Developer Studio Project File	# Microsoft Developer Studio Generated Build File, Format Version 6.00	# ** DO NOT EDIT **	# TARGTYPE	EOFcat /dev/null >/tmp/$$_filesignhead -1 $file | sed -e 's/ -.*//' >>/tmp/$$_filesignhead -3 $file | tail +2 >>/tmp/$$_filesignhead -5 $file | tail +4 | sed -e 's/ *".*$//' >>/tmp/$$_filesigndiff /tmp/$$_filesign /tmp/$$_genusign >/dev/null 2>&1exit=$?rm -f /tmp/$$_filesign /tmp/$$_genusignif [ $exit != 0 ]; then  echo "ERROR: $orig doesn't look like MSVC++ Project File. Stop."  rm -f $file  exit 2fi# Generic project?#if [ `grep -c '^# ADD .*CPP ' $file` = 0 ]; then  echo "${orig}: Nothing to do!"  rm -f $file  exit 0fi# Find existing include paths in the project.#cat <<-EOF >/tmp/$$_inc.sed	/^# ADD .*CPP / {	  s|/I *|/I_|g	  s|\\\\|/|g	  p	}	d	EOFcat /dev/null >/tmp/$$_inclfor k in `sed -n -f /tmp/$$_inc.sed $file` ; do  if [ `echo "$k" | grep -c /I_` != 0 ]; then    inc=`echo "$k" | sed -e 's|/I_||' -e 's|"||g'`    ince=`echo "$inc" | sed -e 's|\\.|\\\\.|g'`    if [ `grep -c "^$ince\\\$" /tmp/$$_incl` = 0 ]; then      echo "$inc" >>/tmp/$$_incl    fi  fidonerm -f /tmp/$$_inc.sedif [ -s /tmp/$$_incl ]; then  echo "${orig}: The following include path(s) found:"  cat /tmp/$$_incl | sed -e 's/^/    /'fi# Build relative include paths, using current directory and given paths.#cat /dev/null >/tmp/$$_incfor d in $* ; do  dir=`echo $d | sed -e 's|/\$||'`  if [ _$dir = _ ]; then    dir='/'  fi  cwd=`pwd`  root=''  for i in `echo $cwd | tr '/' ' '` ; do    newroot=$root/$i    if [ _`echo $dir | sed -e "s|^$newroot||"` = _$dir ]; then      break;    fi    root=$newroot  done  if [ _$root = _ ]; then    root='/'  fi  #echo Common root of $dir and $cwd is $root  newdir=`echo $dir | sed -e "s|^$root||"`  newcwd=`echo $cwd | sed -e "s|^$root||"`  include='.'  for i in `echo $newcwd | tr '/' ' '` ; do    include="${include}/.."  done  for i in `echo $newdir | tr '/' ' '` ; do    include="${include}/$i"  done  #echo Path to include files is $include  echo "$include" >>/tmp/$$_incdone# Now replace original include paths, if they resemble calculated paths.# Preserve rest of original paths.#cat /dev/null >/tmp/$$_includefor i in `cat /tmp/$$_incl` ; do  replaced=0  for j in `cat /tmp/$$_inc` ; do    dir1=`echo $i | sed -e 's|^[/.]*||'`    dir2=`echo $j | sed -e 's|^[/.]*||'`    if [ _$dir1 = _$dir2 ]; then      if [ $i = $j ]; then        echo Unchanged directory "\"$i\""      else        echo Replacing directory "\"$i\"" with directory "\"$j\""      fi      inc="$j"      ince=`echo "$inc" | sed -e 's|\\.|\\\\.|g'`      grep -v "^$ince\$" /tmp/$$_inc >/tmp/$$_i      mv /tmp/$$_i /tmp/$$_inc      replaced=1      break    fi  done  if [ $replaced = 0 ]; then    echo Keeping directory "\"$i\""    inc="$i"  fi  inc=`echo "$inc" | sed -e 's|/|\\\\\\\\|g'`  echo '/I' "\"$inc\"" >>/tmp/$$_includedoneif [ -s /tmp/$$_inc ]; then  for i in `cat /tmp/$$_inc` ; do    echo Appending directory "\"$i\""    inc=`echo $i | sed -e 's|/|\\\\\\\\|g'`    echo '/I' "\"$inc\"" >>/tmp/$$_include  donefi#echo +++#cat /tmp/$$_include#echo ---rm -f /tmp/$$_incl /tmp/$$_inc# Form compiler "/I" options.#cat <<-EOF >/tmp/$$_inc.sed	s|\\\\|\\\\\\\\|g	/./ {	  H	  \$ !d	}	\$ {	  x	  s/\n/ /g	  s/^  *//	  s/  *\$//	  p	  q	}	EOFinc=`sed -n -f /tmp/$$_inc.sed /tmp/$$_include`rm -f /tmp/$$_inc.sed /tmp/$$_include#echo \"$inc\"# Incorporate compiler options into project file.# Output is always in UNIX text file format.#cat <<-EOF >/tmp/$$_comp.sed	/^# ADD .*CPP / s|/I  *"\{0,1\}[^ ]*"\{0,1\}|@I|g	/^# ADD CPP / {	  s|@I|$inc|	  t success	  s| /D| $inc&|	  t success	  s| /Y| $inc&|	  t success	  s| /F| $inc&|	  t success	  s| /c| $inc&|	  t success	  s| *\$| $inc|	  :success	  s| *@I||g	}	EOF#cat /tmp/$$_comp.sedmv $orig $orig.baksed -f /tmp/$$_comp.sed $file >$origrm -f /tmp/$$_comp.sed $filetouch -r $orig.bak $origexit 0EOF  chmod u+x $1}usage() {  echo 'Include path tracer for Microsoft Visual C++ Project File V 6.0'  echo 'Usage:'  echo `basename $0` "rel_path_to_include ..."  exit 1}dir=$*dir=${dir:-../../include}for d in "$dir" ; do  if [ _`echo "$d" | sed -e 's|^/.*||'` = _ ]; then    echo "ERROR: \"$d\" is not a relative path. Stop."    exit 2  fidonedirlist=''for d in "$dir" ; do  dir=`pwd`  for i in `echo "$d" | tr '/' ' '` ; do    if [ "$i" = ".." ]; then      dir=`echo "$dir" | sed -e 's|/[^/]*\$||'`    elif [ "$i" != "." ]; then      dir="${dir}/$i"    fi  done  if [ _$dir = _ ]; then    dir='/'  fi  dirlist="$dirlist $dir"doneinclude /tmp/$$_inc.shcat <<EOF >/tmp/$$_cmd.sh#!/bin/shfor i in * ; do  if [ -d \$i ]; then    cd \$i    /tmp/$$_cmd.sh \$1/\$i    cd ..  elif [ -f \$i -a \`echo \$i | grep -c '\\\\.dsp\$'\` != 0 ]; then    echo Analyzing \$1/\$i    /tmp/$$_inc.sh \$i $dirlist    exit=\$?    if [ \$exit != 0 ]; then      exit \$exit    fi    echo  fidoneexit 0EOFchmod u+x /tmp/$$_cmd.sh/tmp/$$_cmd.sh .exit=$?rm -f /tmp/$$_cmd.sh /tmp/$$_inc.shexit $exit# #  ===========================================================================#  PRODUCTION $Log: include.sh,v $#  PRODUCTION Revision 1000.0  2003/10/29 14:24:48  gouriano#  PRODUCTION PRODUCTION: IMPORTED [ORIGINAL] Dev-tree R1.6#  PRODUCTION#  ===========================================================================# 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -