#!/bin/sh # $Id: stty-canon,v 1.9 2018/11/26 23:46:08 friedman Exp $ # Public domain. stty=${STTY-stty} #stty_canon() { # These are issued as a series of separate commands in case some of # them aren't recognized; stty might not evaluate the rest of the # arguments. $stty icanon tabs $stty intr '^C' kill '^U' quit '^\\' eof '^D' $stty susp '^Z' $stty -ixon -ixoff -ixany $stty onlcr -ocrnl -onlret case $1 in -safe ) shift ;; # these settings can make some terminals unusable. * ) $stty cs8 -istrip -iexten -parenb ;; esac case ${INSIDE_EMACS+t}${EMACS+t}:$TERM in *:xterm* ) $stty erase '^?' $stty opost 2> /dev/null ;; *:eterm* ) # M-x term, M-x ansi-term $stty -icrnl -inlcr onlcr echo ;; t* | *:emacs* ) $stty -icrnl -inlcr -onlcr -echo ;; esac case $# in 0 ) : ;; * ) $stty ${1+"$@"} ;; esac } #stty_canon ${1+"$@"} # eof