resetting terminal modes

Charles Hedrick hedrick at aramis.rutgers.edu
Sun May 29 11:49:59 AEST 1988


Somebody asked how to turn on wrap at end of line, in case it somehow
got turned off.  The major cause of reboots on my system is that the
console gets into a wierd mode and I can't figure out how to get it
out.  So I've been collecting ways of getting out of things.  Every
time I find a funny mode I put the command to get out of it into is2
(the termcap string for resetting the terminal).  I have a script
"reset" that undoes everything I know how to undo, including stuff you
can set with stty and terminal modes.  I include below both my termcap
entry for the console and the reset script.  To use the termcap entry,
you have to be root and do "tic xxx" where xxx is the file you put
this into.  I'm fairly sure that one of the magic strings in is2 turns
on wrap mode again.  One thing I don't know how to get out of is when
the special function keys stop doing their special functions.  This
happens when you use ESC c, which is the documented way of returning
the terminal to its power-up state.  I find it somewhat mysterious
that uport is unable to come up with a set of escape sequences to
reset the terminal.  I know they plan to do something about all of
this for the next release, so maybe that means it is imminent.


Here's the termcap entry:

ansi|ansi-24|ansi-s-bot|ansi-bot-s|ansi with bottom status line (for sysline),
	am, hs, mir, msgr, eslok, xon, cols#80, lines#24, wsl#80, 
	cbt=\E[Z, bel=^G, cr=\r, csr=\E[%i%p1%d;%p2%dr, 
	clear=\E[H\E[J\E[3;2m, el=\E[K, ed=\E[J, hpa=\E[%i%p1%dG, 
	cup=\E[%i%p1%d;%p2%dH, cud1=\n, home=\E[H, civis=\E[25;27m, 
	cub1=\b, cnorm=\E[23;27m, cuf1=\E[C, cuu1=\E[A, dch1=\E[P, 
	dl1=\E[M, dsl=\E7\E[?6l\E[25;1H\E[K\E8, smacs=\E[12m, 
	blink=\E[5;3;1m, bold=\E[1m, smir=\E[4h, invis=\E[8m, rev=\E[7m, 
	smso=\E[42m, smul=\E[4m, ech=\E[%p1%dX, rmacs=\E[10m, sgr0=\E[0;47m, 
	rmir=\E[4l, rmso=\E[47m, rmul=\E[m, fsl=\E8, is1=\E[=h, 
	is2=\E7\E[1;24r\E8\E[4l\E[?6l\E[?7l\E[A\n, il1=\E[L, kbs=\b, kdch1=\E[P, 
	kdl1=\E[M, kcud1=\E[B, kf1=\EOP, kf10=\EOY, kf2=\EOQ, kf3=\EOR, 
	kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, kf9=\EOX, 
	khome=\E[H, kich1=\E[@, kil1=\E[L, kcub1=\E[D, knp=\E[V, 
	kpp=\E[U, kcuf1=\E[C, kcuu1=\E[A, dch=\E[%p1%dP, dl=\E[%p1%dM, 
	cud=\E[%p1%dB, ich=\E[%p1%d@, indn=\E[%p1%dS, il=\E[%p1%dL, 
	cub=\E[%p1%dD, cuf=\E[%p1%dC, rin=\E[%p1%dT, cuu=\E[%p1%dA, 
	pfkey=\E[%p1%d;%p2%l%dq%p2%s, pfx=\E[%p1%d;%p2%l%dq%p2%s, 
	rc=\E8, vpa=\E[%p1%dd, sc=\E7, ind=\ED, ri=\EM, ht=\t, 
	tsl=\E7\E[?6l\E[25;%p1%dH\E[7;1;55m\E[K, 

Here's reset:

#!
stty sane
stty clocal
stty intr '^c' erase '^?' kill '^u' eof '^d' eol '^`'
stty icrnl ixon -ixany onlcr
stty isig icanon echo echoe echok
tput rs1
tput rs2
tput rs3
# should also print contents of file `tput rf`
tput is1
tput is2
tput is3
# should also print contents of file `tput if`



More information about the Comp.unix.microport mailing list