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