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

📄 one2all.sh

📁 ncbi源码
💻 SH
📖 第 1 页 / 共 2 页
字号:
configcb(){  cat /dev/null >/tmp/$$_cmd.sed  # First replace config name wherever appropriate.  #  for p in Release Debug ; do    for q in DLL MT ; do      cat <<-EOF >>/tmp/$$_cmd.sed	s|$p *$q|$p|g	EOF    done    if [ $p != $2$3 ]; then      cat <<-EOF >>/tmp/$$_cmd.sed	s|$p|$2$3|g	EOF    fi  done  sed -f /tmp/$$_cmd.sed $1  rm -f /tmp/$$_cmd.sed}usage() {  echo 'Automatic multi config for Microsoft Visual C++ Project File V 6.0'  echo 'Usage:'  echo `basename $0` '[--without-dizzy] filename'  exit 1}if [ _$1 = _--without-dizzy ]; then  without_dizzy="$1"  shiftelse  without_dizzy=""fiif [ _$1 = _ ]; then  usageelif [ \! -f $1 ]; then  echo "ERROR: File \"$1\" must exist. Stop."  exit 3fiif [ _$2 != _ ]; then  if [ $2 != 4 -a $2 != 3 -a $2 != 2 ]; then    echo "ERROR: Unknown special parameter \"$2\". Stop."    exit 3  fi  if [ $2 = 2 ]; then    CFGSET='DLL'  elif [ $2 = 3 ]; then    CFGSET='MT'  else    CFGSET='DLL ""'  fielse  CFGSET='DLL MT ""'fifile=/tmp/$$_file# DOS-2-UNIX conversion (shouldn't be here, but just in case for sanity).#sed -e 's/
*$//' $1 >$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: $1 doesn't look like MSVC++ Project File. Stop."  rm -f $file  exit 2fi# Extract configuration part of the project file and count configurations.#cat <<-EOF >/tmp/$$_.sed	/^!IF /,/^!ENDIF/ {	  /^!ENDIF/ q	  p	}	d	EOFNCFG=`sed -n -f /tmp/$$_.sed $file | egrep -c '^[!ELS]+IF '`rm -f /tmp/$$_.sedif [ $NCFG -gt 1 ]; then  echo "ERROR: $1 contains more than one configuration ($NCFG). Stop."  rm -f $file  exit 2fi# Check for per-config dependencies, and warn if any.#DEP=`grep -c '^# PROP  *AllowPerConfigDependencies  *1' $file`cat <<-EOF >/tmp/$$_prop.sed	/^# Begin Target/,\$ p	d	EOFsed -n -f /tmp/$$_prop.sed $file | grep '^!IF ' >/dev/null 2>&1if [ $DEP != 0 -a $? = 0 ]; then  echo "WARNING: $1 contains per-configuration dependencies,"  echo 'which may or may not be handled correctly by this script.'firm -f /tmp/$$_prop.sed# Extract beginning of the file.#cat <<-EOF >/tmp/$$_head.sed	/^!MESSAGE "/ {	  w /tmp/$$_cmp	  q	}	p	d	EOFsed -n -f /tmp/$$_head.sed $file >/tmp/$$_headrm -f /tmp/$$_head.sedconfig /tmp/$$_head Release `echo $CFGSET | sed -e 's| .*||'` >/dev/null 2>&1sed -e 's/ "/ %/' -e 's/" /% /' /tmp/$$_cmp >/tmp/$$_compmv /tmp/$$_comp /tmp/$$_cmp# Extract the middle part.#cat <<-EOF >/tmp/$$_mid.sed	/^# Begin Project/,/^!IF / {	  /^# PROP  *AllowPerConfigDependencies / s/  *1/ 0/	  /^!IF / q	  /^# PROP BASE / {	    i\\	    q	  }	  p	}	d	EOFsed -n -f /tmp/$$_mid.sed $file >/tmp/$$_midrm -f /tmp/$$_mid.sed# Now extract configuration-dependent part, and make required configs.#cat <<-EOF >/tmp/$$_cut.sed	/^!IF /,/^!E/ {	  s/^!ELSEIF .*\$/!ENDIF /	  H	}	/^!ENDIF/ {	  x	  q	}	d	EOFsed -n -f /tmp/$$_cut.sed $file >/tmp/$$_cfgtmplif [ \! -s /tmp/$$_cfgtmpl ]; then  cat <<-EOF >/tmp/$$_cut.sed	/^# PROP BASE /,/^# Begin Target/ {	  /# Begin Target/ q	  p	}	d	EOF  echo "!IF  \"\$(CFG)\" == \"`sed -e 's/^.* %//' -e 's/% .*\$//' /tmp/$$_cmp`\"" >/tmp/$$_cfgtmpl  echo >>/tmp/$$_cfgtmpl  sed -n -f /tmp/$$_cut.sed $file >>/tmp/$$_cfgtmpl  echo >>/tmp/$$_cfgtmpl  echo '!ENDIF ' >>/tmp/$$_cfgtmplfirm -f /tmp/$$_cut.sedcat /dev/null >/tmp/$$_titlecat /dev/null >/tmp/$$_cfgcat /dev/null >/tmp/$$_messagefor i in Release Debug ; do  for j in $CFGSET ; do    if [ $j = '""' ]; then      j=""    fi    cp /tmp/$$_cfgtmpl /tmp/$$_cfg_$i$j    config $without_dizzy /tmp/$$_cfg_$i$j $i $j >>/tmp/$$_message    if [ $? != 0 ]; then      tail -1 /tmp/$$_message      rm -f /tmp/$$_*      exit 3    fi    grep '^!IF ' /tmp/$$_cfg_$i$j >>/tmp/$$_title    cat /tmp/$$_cfg_$i$j >>/tmp/$$_cfg    rm -f /tmp/$$_cfg_$i$j  donedoneecho "${1}:" `cat /tmp/$$_message`rm -f /tmp/$$_cfgtmpl /tmp/$$_message# Summarize configurations in the header and tail parts of the project.#sed -e 's/^!IF.*CFG)" == //' -e 'y/ "/~%/' /tmp/$$_title >/tmp/$$_tltmv /tmp/$$_tlt /tmp/$$_titlecat /dev/null >/tmp/$$_msgcat /dev/null >/tmp/$$_namefor i in `cat /tmp/$$_title` ; do  sed -e "s/ %.*% / $i /" -e 'y/~%/ "/' /tmp/$$_cmp >>/tmp/$$_msg  echo "# Name $i" | tr '~%' ' "' >>/tmp/$$_namedonesed -e 's/ .*$/ /' /tmp/$$_cmp >>/tmp/$$_msgecho >>/tmp/$$_msgrm -f /tmp/$$_title# Extract the tail part and modify name list on-the-fly.#cat <<-EOF >/tmp/$$_tail.sed	/^# Begin Target/,/^# End Project/ {	  /^# Name /  {	    r /tmp/$$_name	    d	  }	  /^!IF /,/^!ENDIF/ d	  p	}	d	EOFsed -n -f /tmp/$$_tail.sed $file >/tmp/$$_tailrm -f /tmp/$$_tail.sed /tmp/$$_name $file# Glue all parts but the tail.#cat /tmp/$$_head /tmp/$$_msg /tmp/$$_mid /tmp/$$_cfg >/tmp/$$_newheadmv /tmp/$$_newhead /tmp/$$_headrm -f /tmp/$$_msg /tmp/$$_mid /tmp/$$_cfg# Replace ENDIF..IF with ELSEIF.#cat <<-EOF >/tmp/$$_elseif.sed	/^!ENDIF/,/^!IF / {	  s/^!IF /!ELSEIF /	  /^!ELSEIF / !d	}	EOFsed -f /tmp/$$_elseif.sed /tmp/$$_head >/tmp/$$_newheadrm -f /tmp/$$_elseif.sedmv /tmp/$$_newhead /tmp/$$_headcat <<-EOF >>/tmp/$$_head	!ENDIF 	EOFgrep '^SOURCE=' $1 | sed 's/^SOURCE=//;s/[\\]/\\\\/g;s/[.]/[.]/g' >/tmp/$$_flistfor i in `cat /tmp/$$_flist | sed 's/[[]//g;s/]//g'`; do  file="/tmp/$$_`echo $i | sed 's/[./\\]/_/g'`"  cat <<-EOF >/tmp/$$_cbext.sed	/^SOURCE=$i\$/,/^SOURCE=/ {	  /^SOURCE=$i\$/ d	  /^[#] End Source File/ !H	  /^!ENDIF/ {	    x	    q	  }	  /^[#] End Custom Build/ {	    x	    q	  }	  d	}	d	EOF  sed -f /tmp/$$_cbext.sed $1 >$filedonerm -f /tmp/$$_cbext.sedcat /dev/null >/tmp/$$_cb.sedfor k in `cat /tmp/$$_flist | sed 's/[[]//g;s/]//g'`; do  file="/tmp/$$_`echo $k | sed 's/[./\\]/_/g'`"  test -s $file  ||  continue  if [ `readfirstln $file | grep -c '^[!]'` = 0 ]; then    echo "!IF  \"\$(CFG)\" == \"`sed -e 's/^.* %//' -e 's/% .*\$//' /tmp/$$_cmp`\"" >$file.1    echo           >>$file.1    cat $file      >>$file.1    echo           >>$file.1    echo '!ENDIF ' >>$file.1    mv $file.1 $file  fi  cat /dev/null >$file.new  for i in Release Debug ; do    for j in $CFGSET ; do      if [ $j = '""' ]; then        j=""      fi      configcb $file $i $j >>$file.new    done  done  echo >$file  # Replace ENDIF..IF with ELSEIF.  #  cat <<-EOF >/tmp/$$_elseif.sed	/^!ENDIF/,/^!IF / {	  s/^!IF /!ELSEIF /	  /^!ELSEIF / !d	}	EOF  sed -f /tmp/$$_elseif.sed $file.new >>$file  rm -f /tmp/$$_elseif.sed $file.new  cat <<-EOF >>$file	!ENDIF	EOF  cat <<-EOF >>/tmp/$$_cb.sed	/^SOURCE=$k\$/,/^[#] End Source File/ {	  /^SOURCE=$k\$/ {	    p	    r $file	    d	  }	  /^[#] End Source File/ p	  d	}	EOFdonesed -f /tmp/$$_cb.sed /tmp/$$_tail >/tmp/$$_tail.1# Final catenation of results to a single project file.#cat /tmp/$$_head /tmp/$$_tail.1 >/tmp/$$_projrm -f /tmp/$$_cmp /tmp/$$_head /tmp/$$_tail /tmp/$$_tail.1 /tmp/$$_cb.sedfor i in `cat /tmp/$$_flist | sed 's/[[]//g;s/]//g'`; do  file="/tmp/$$_`echo $i | sed 's/[./\\]/_/g'`"  rm -f $filedonerm -f /tmp/$$_flist# Remove consequent empty lines (could occur earlier in substitutions)# and replace original project file (backup kept in .bak).# Make the output file to be a DOS (CR/LF) text file.#cat <<-EOF >/tmp/$$_pretty.sed	/./ {	  p	  d	}	/^\$/ p	:Empty	/^\$/ {	  N	  s/.//	  b Empty	}	p	EOFmv $1 $1.bakPATH=$PATH:/usr/sbin:/sbindoser='sed -e s/$/
/'if [ `echo $OSTYPE   2>&1 | grep -c -i cygwin` -ge 1 -o  \     `echo $MACHTYPE 2>&1 | grep -c -i cygwin` -ge 1 -o  \     `mount          2>&1 | grep -c -i cygwin` -ge 1 ]; then  echo >$1  test "`ls -l $1 | tr '\t' ' ' | sed 's/  */ /g' | cut -f5 -d' '`" != "1"  && \    doser='sed -n p'fised -n -f /tmp/$$_pretty.sed /tmp/$$_proj | $doser >$1rm -f /tmp/$$_pretty.sed /tmp/$$_projtouch -r $1.bak $1exit 0# #  ===========================================================================#  PRODUCTION $Log: one2all.sh,v $#  PRODUCTION Revision 1000.0  2003/10/29 14:25:04  gouriano#  PRODUCTION PRODUCTION: IMPORTED [ORIGINAL] Dev-tree R1.40#  PRODUCTION#  ===========================================================================# 

⌨️ 快捷键说明

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