1# SHOPT_* option probe 2 3tst cross{ 4 : check for shell magic #! 5 cat > /tmp/file$$ <<! 6 #! /bin/echo 7 exit 1 8 ! 9 chmod 755 /tmp/file$$ 10 if /tmp/file$$ > /dev/null 11 then echo "#define SHELLMAGIC 1" 12 fi 13 rm -f /tmp/file$$ 14 15 option() # name value 16 { 17 case $2 in 18 0) echo "#ifndef SHOPT_$1" 19 echo "# define SHOPT_$1 1" 20 echo "#endif" 21 ;; 22 *) echo "#undef SHOPT_$1" 23 ;; 24 esac 25 } 26 27 ls /dev/fd/9 9<&0 >/dev/null 2>&1 28 option DEVFD $? 29 exec 9<&- 30 case `echo a | tr a '\012' | wc -l` in 31 *1*) option MULTIBYTE 0 ;; 32 esac 33 test -x /bin/pfexec -o -x /usr/bin/pfexec 34 option PFSH $? 35 /bin/test ! -l . 2> /dev/null 36 option TEST_L $? 37 test -f /etc/ksh.kshrc -o -f /etc/bash.bashrc && 38 option SYSRC 0 39 test -f /bin/universe && univ=`/bin/universe` > /dev/null 2>&1 -a ucb = "$univ" 40 option UCB $? 41}end 42 43cat{ 44 #if !_PACKAGE_ast && ( (MB_LEN_MAX-1)<=0 || !defined(_lib_mbtowc) ) 45 # undef SHOPT_MULTIBYTE 46 #endif 47}end 48