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

📄 quote.test

📁 这是一个自动生成MAKEFILE的工具。一个很有用的库。在LINUX工程项目里是很好的帮手。希望对大家有点帮助。
💻 TEST
字号:
#! /bin/sh# quote.test - make sure that shell metacharacters do not blow up libtool# Test script header.need_prefix=noif test -z "$srcdir"; then  srcdir=`echo "$0" | sed 's%/[^/]*$%%'`  test "$srcdir" = "$0" && srcdir=.  test "${VERBOSE+set}" != "set" && VERBOSE=yesfi. $srcdir/defs || exit 1# Do the torture test.status=0echo=echoif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then :else  # The Solaris, AIX, and Digital Unix default echo programs unquote  # backslashes.  This makes it impossible to quote backslashes using  #   echo "$something" | sed 's/\\/\\\\/g'  #  # So, first we look for a working echo in the user's PATH.  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}:"  for dir in $PATH /usr/ucb; do    if test -f $dir/echo && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t'; then      echo="$dir/echo"      break    fi  done  IFS="$save_ifs"  if test "X$echo" = Xecho; then    # We didn't find a better echo, so look for alternatives.    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t'; then      # This shell has a builtin print -r that does the trick.      echo='print -r'    elif test -f /bin/ksh && test "X$CONFIG_SHELL" != X/bin/ksh; then      # If we have ksh, try running $0 again with it.      CONFIG_SHELL=/bin/ksh      export CONFIG_SHELL      exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"}    else      # Try using printf.      echo='printf %s\n'      if test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then :      else        # Oops.  We lost completely, so just stick with echo.        echo=echo      fi    fi  fififor mode in compile link install; do  $echo "== $mode mode"  # Unfortunately, without an array data type, it is nearly impossible  # to protect libtool from metacharacters in filenames.  So, we just  # try metacharacters in the options it needs to pass to other programs.  # preargs and postargs need to go through libtool unmodified.  case "$mode" in  compile)    preargs="$CC -c"    preflag=    flag="-DVAR="    postargs="foo.c"    ;;  link)    preargs="$CC -o hell -g -O"    preflag=-Wl,    flag="-someflag="    postargs="foo.o"    ;;  install)    preargs="install -c"    preflag=    flag="--something="    postargs="hell /usr/local/bin/hell"    ;;  esac  # Trivial.  $echo "= trying: no quoting"  result=`$libtool -n --mode=$mode $preargs ${preflag}"${flag}test" $postargs` || status=1  # We used to have the contents of $match in the case statement,  # without an intermediate variable, but it would fail on at least  # Solaris' and HP-UX's /bin/sh.  Ugh!  match="$preargs ${preflag}${flag}test "  case "$result" in  *"$match"*)    $echo "= passed: $result"    ;;  *)    $echo "= failed: $result"    status=1    ;;  esac  # Metacharacters that should be backslashified.  for mchar in \\ \" \` \$; do    $echo "= trying: \\$mchar quoting"    result=`$libtool -n --mode=$mode $preargs ${preflag}"${flag}${mchar}test${mchar}" $postargs` || status=1    match="$preargs ${preflag}${flag}\\${mchar}test\\${mchar} "    case "$result" in    *"$match"*)      $echo "= passed: $result"      ;;    *)      $echo "= failed: $result"      status=1      ;;    esac  done  # Metacharacters that should be double quoted.  for mchar in "[" "]" "~" "#" "^" "&" "*" "(" ")" "{" "}" "|" ";" "<" ">" "?" \      "'" " " "	"; do    $echo "= trying: \"$mchar\" quoting"    result=`$libtool -n --mode=$mode $preargs ${preflag}"${flag}${mchar}test${mchar}" $postargs` || status=1    match="$preargs ${preflag}\"${flag}${mchar}test${mchar}\" "    case "$result" in    *"$match"*)      $echo "= passed: $result"      ;;    *)      $echo "= failed: $result"      status=1      ;;    esac  donedoneexit $status

⌨️ 快捷键说明

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