Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Sep 1997 13:06:14 -0700
From:      Ken McGlothlen <mcglk@yang.cpac.washington.edu>
To:        "Jay D. Nelson" <jdn@qiv.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: tcsh, stty, and other oddities.
Message-ID:  <199709072006.NAA04343@yang.cpac.washington.edu>
References:  <199709070921.CAA16958@yang.cpac.washington.edu> <Pine.BSF.3.96.970907102215.277A-100000@acp.qiv.com>

next in thread | previous in thread | raw e-mail | index | archive | help
jdn@qiv.com (Jay D. Nelson) writes:

| This is a WAG -- but it sounds like a termcap problem. It might be worth
| adding the cons25 tc entries to the Sun's termcap (potentially xterm, too --
| I can't remember whether SunOS had an xterm entry or not.) Make sure $TERM is
| set to something reasonable on the Sun when you log in.

I'm assuming that you actually mean adding the cons25 tc entries to FreeBSD's
termcap, since that's the one that's being strange (at least from my
perspective), and since I don't see a cons25 in Sun's /etc/termcap.  :)

I really have to apologize for the length of this message, but I'm gonna try to
break down the termcap entries, because so far, I've been unable to figure out
why setting -oxtabs makes everything work, sort of.

SunOS most definitely does have an xterm entry.  I've included the actual
relevant termcap entries from both the SunOS and FreeBSD (2.2.1-RELEASE)
systems at the end of the message if you want to compare them.  But I'm going
to do some rearranging here and only highlight the actual differences between
the systems, and then only for one terminal type:  vt100.  I've been trying to
narrow down the problem, and it occurs even in vt100 mode on the FreeBSD
systems, so I'll just stick with that.  I'll still include the termcap entries
at the end of this message for all the relevant terminal types, though.

SunOS has a single vt100 entry.  FreeBSD has a couple relevant ones, but I'll
start with the basic one.  Here are the differences between them:

Terminal name: Both have "vt100|vt100-am|vt100am|dec-vt100|dec vt100", but
SunOS adds the name "d0".  FreeBSD also has a non-padded version of vt100
called "vt100-np|dec-vt100-np|vt100 with no padding (for psl games)" which is
used as the basis for xterm.  In general, the FreeBSD vt100 entries add a
few-millisecond delay, while vt100-np strips those off.  We'll deal with that
later.

First, there are some termcap functions which are completely unknown to me, and
undocumented in "man 5 termcap".  These exist only in FreeBSD:

	VT100
	Function	FreeBSD
	@7		\E[4~
	F1		\E[23~
	F2		\E[24~
	ac		llmmkkjjuuttvvwwqqxxnnpprr``aa
	k;		\E[21~
	ut		[true]

I assume that "@7", "F1", "F2" and "k;" are sent by some function keys, but I
don't know what they are.  "ac" and "ut" I'm completely in the dark about.  I
have to assume that these aren't really relevant to the discussion (except for
possibly "ut").

Then there are a bunch of things that exist only in the FreeBSD version.  The
(*) at the end shows that a vt100-np replacement exists without the delay
values:

	VT100
	Function				FreeBSD
	ae (end alt charset)			2\E(B		(*)
	as (start alt charset)			2\E(0		(*)
	bl (bell char)				^G
	cr (return char)			^M
	ct (clear all tabs)			2\E[3g		(*)
	DO (down %d lines)			2\E[%dB		(*)
	eo (can erase overstrikes with blank)	[true]
	if (init string file)			/usr/share/tabset/vt100
	it (tabs initially every N positions)	#8
	k0 (sent by function key 0)		\E[10~
	k5 (sent by function key 5)		\E[15~
	k6 (sent by function key 6)		\E[17~
	k7 (sent by function key 7)		\E[18~
	k8 (sent by function key 8)		\E[19~
	k9 (sent by function key 9)		\E[20~
	kD (sent by delete key)			\E[3~
	kI (sent by insert-char key)		\E[2~
	kN (sent by next-page key)		\E[6~
	kP (sent by prev-page key)		\E[5~
	kh (sent by home key)			\E[1~
	LE (move left %d positions)		2\E[%dD		(*)
	ms (safe to move in standout)		[true]
	nw (newline)				2\EE		(*)
	RI (right %d positions)			2\E[%dC		(*)
	st (set tab at curpos in all rows)	2\EH		(*)
	ta (tab)				^I
	UP (up %d lines)			2\E[%dA		(*)

Here again, I'm not sure if there's anything relevant, except for the remote
possibility of "ms".  Next, let's go through things that are the same.  Again,
the (*) indicates that vt100-np removes the delay.  (**) indicates that SunOS
has no delay.  (**=n) indicates that SunOS has a different delay of n.

	VT100
	Function				FreeBSD
	am (auto margins)			[true]
	bs (can backspace with ^H)		[true]
	cd (clear to end of display)		50\E[J		(*)
	ce (clear to eol)			3\E[K		(*)
	cm (screen-relative cursor motion)	5\E[%i%d;%dH	(*)
	co (columns)				#80
	cs (change scroll region)		5\E[%i%d;%dr	(*) (**)
	ho (home cursor)			\E[H
	k1 (sent by function key 1)		\EOP
	k2 (sent by function key 2)		\EOQ
	k3 (sent by function key 3)		\EOR
	k4 (sent by function key 4)		\EOS
	kd (sent by down arrow)			\EOB
	ke (out of keypad-transmit mode)	\E[?1l\E>
	kl (sent by left arrow)			\EOD
	kr (sent by right arrow)		\EOC
	ks (into keypad-transmit mode)		\E[?1h\E=
	ku (sent by up arrow)			\EOA
	le (move cursor left one position)	^H
	li (lines on screen)			#24
	mb (turn on blink)			2\E[5m		(*)
	md (turn on bold)			2\E[1m		(*)
	me (turn off all attributes)		2\E[m		(*)
	mr (turn on reverse video)		2\E[7m		(*)
	nd (move cursor right one position)	2\E[C		(*)
	pt (has hardware tabs)			[true]
	rc (restore cursor to last sc)		2\E8		(*) (**)
	sc (save cursor position)		2\E7		(*) (**)
	se (end standout mode)			2\E[m		(*)
	sf (scroll text up)			2*\ED		(*) (**=5)
	so (begin standout mode)		2\E[7m		(*)
	sr (scroll text down)			2*\EM		(*) (**=5)
	ue (end underscore mode)		2\E[m		(*)
	up (move cursor up one line)		2\E[A		(*)
	us (start underscore mode)		2\E[4m		(*)
	vt (virtual terminal number)		#3
	xn (newline ignored after 80 cols)	[true]

That leaves the following things that are different.  (Again, (*) indicates
that vt100-np removes the delay):

	VT100
	Function				FreeBSD		SunOS
	cl (clear/home)			(*)	50\E[H\E[J	50\E[;H\E[2J
	do (move down one line)		(*)	2\E[B		^J
	kb (sent by backspace key)		\177		^H

Also, the initialization and reset strings are different:

	is (SunOS)	\E[1;24r\E[24;1H
	is (FreeBSD)	\E>\E[?1;3;4;5l\E[?7;8h\E[1;24r\E[24;1H
	rs (SunOS)	\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h
	rs (FreeBSD)	\E>\E[?1;3;4;5l\E[?7;8h

Finally, SunOS has one thing that FreeBSD doesn't have:  The reset code file:

	rf (SunOS)	/usr/share/lib/tabset/vt100

The thing is, I can't see anything between the vt100 defined by SunOS and the
vt100s defined by FreeBSD that would result in such weird behavior.  So I don't
think it's the termcap entries for vt100.  I *could* be wrong, and I'd love to
know how, but so far. . . .

The actual termcap entries are included at the bottom of this message, along
with the original message.

Thanks.  Again, I'm not on the freebsd-questions list, so please reply directly
to one of the following addresses:

				---Ken McGlothlen
				   mcglk@serv.net
				   mcglk@cpac.washington.edu


Here are the actual termcap entries.  First, the SunOS 4.1.1 system:

vs|xterm|vs100|xterm terminal emulator (X window system):\
	:cr=^M:do=^J:nl=^J:bl=^G:le=^H:ho=\E[H:\
	:co#80:li#65:cl=\E[H\E[2J:bs:am:cm=\E[%i%d;%dH:nd=\E[C:up=\E[A:\
	:ce=\E[K:cd=\E[J:so=\E[7m:se=\E[m:us=\E[4m:ue=\E[m:\
	:md=\E[1m:mr=\E[7m:me=\E[m:\
	:ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\
	:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:ta=^I:pt:sf=\n:sr=\EM:\
	:al=\E[L:dl=\E[M:ic=\E[@:dc=\E[P:\
	:MT:ks=\E[?1h\E=:ke=\E[?1l\E>:\
	:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l:\
	:rs=\E[r\E<\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l:xn:\
	:AL=\E[%dL:DL=\E[%dM:IC=\E[%d@:DC=\E[%dP:\
	:vs=\E7\E[?47h:ve=\E[2J\E[?47l\E8:\
	:hs:ts=\E[?E\E[?%i%dT:fs=\E[?F:es:ds=\E[?E:
dl|vt200|vt220|vt200-js|vt220-js|dec-vt220|dec vt200 series with jump scroll:\
	:im=\E[4h:ei=\E[4l:mi:dc=\E[P:dm=:ed=:al=\E[L:dl=\E[M:\
	:cs=\E[%i%d;%dr:sf=\ED:sr=\EM:sb=\EM:\
	:ce=\E[K:cl=\E[H\E[J:cd=\E[J:cm=\E[%i%d;%dH:nd=\E[C:up=\E[A:\
	:so=\E[7m:se=\E[27m:us=\E[4m:ue=\E[24m:\
	:md=\E[1m:mr=\E[7m:mb=\E[5m:me=\E[m:\
	:is=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H:\
	:rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:\
	:tc=vt100:
d0|vt100|vt100-am|vt100am|dec-vt100|dec vt100:\
	:do=^J:co#80:li#24:cl=50\E[;H\E[2J:sf=5\ED:\
	:le=^H:bs:am:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A:\
	:ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\
	:md=2\E[1m:mr=2\E[7m:mb=2\E[5m:me=2\E[m:is=\E[1;24r\E[24;1H:\
	:rf=/usr/share/lib/tabset/vt100:\
	:rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:ks=\E[?1h\E=:ke=\E[?1l\E>:\
	:ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\
	:ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sr=5\EM:vt#3:xn:\
	:sc=\E7:rc=\E8:cs=\E[%i%d;%dr:

Here are the equivalent entries in FreeBSD-2.2.1-RELEASE:

xterm|vs100|xterm terminal emulator (X window system):\
	:li#65:\
	:kh=\EOH:@7=\EOF:\
	:hs:km:ts=\E[?E\E[?%i%dT:fs=\E[?F:es:ds=\E[?E:\
	:is=\E>\E[?1;3;4;5l\E[?7;8h\E[1;65r\E[65;1H:\
	:rs=\E>\E[?1;3;4;5l\E[?7;8h:\
	:tc=vt220:
vt200|vt220|vt220am|dec-vt220|dec vt200 series with jump scroll:\
	:@7=\E[4~:kh=\E[1~:kI=\E[2~:k0=\E[10~:\
	:kD=\E[3~:k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:\
	:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:F1=\E[23~:\
	:F2=\E[24~:kP=\E[5~:kN=\E[6~:\
	:K1=\EOw:K2=\EOy:K3=\EOu:K4=\EOq:K5=\EOs:\
	:tc=vt102:
vt102|dec-vt102-am|vt102am|vt100 w/adv. video:\
	:al=\E[L:dl=\E[M:im=\E[4h:ei=\E[4l:mi:dc=\E[P:\
	:k0=\EOp:k1=\EOq:k2=\EOr:k3=\EOs:k4=\EOt:k5=\EOu:\
	:k6=\EOv:k7=\EOw:k8=\EOx:k9=\EOy:k;=\EOm:F1=\EOl:F2=\EOM:\
	:@7=\E[K:kh=\E[H:kN=\E[Oq:kP=\E[Or:kI=\EOn:kD=\ED:\
	:AL=\E[%dL:DL=\E[%dM:DC=\E[%dP:tc=vt100-np:
vt100-np|dec-vt100-np|vt100 with no padding (for psl games):\
	:do=\E[B:cl=\E[H\E[J:sf=\ED:as=\E(0:ae=\E(B:\
	:cm=\E[%i%d;%dH:nd=\E[C:up=\E[A:nw=\EE:\
	:ce=\E[K:cd=\E[J:so=\E[7m:se=\E[m:us=\E[4m:ue=\E[m:\
	:md=\E[1m:mr=\E[7m:mb=\E[5m:me=\E[m:sr=\EM:\
	:sc=\E7:rc=\E8:cs=\E[%i%d;%dr:UP=\E[%dA:DO=\E[%dB:RI=\E[%dC:\
	:LE=\E[%dD:ct=\E[3g:st=\EH:tc=vt100-am:
vt100|dec-vt100|vt100-am|vt100am|dec vt100:\
	:do=2\E[B:co#80:li#24:cl=50\E[H\E[J:sf=2*\ED:\
	:le=^H:bs:am:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A:\
	:ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\
	:md=2\E[1m:mr=2\E[7m:mb=2\E[5m:me=2\E[m:\
	:is=\E>\E[?1;3;4;5l\E[?7;8h\E[1;24r\E[24;1H:\
	:if=/usr/share/tabset/vt100:nw=2\EE:\
	:as=2\E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B:kl=\E[D:kr=\E[C:le=^H:eo:sf=\E[S:\
	:sr=\E[T:kN=\E[G:kP=\E[I:@7=\E[F:kI=\E[L:kD=\177:kB=\E[Z:\
	:IC=\E[%d@:DC=\E[%dP:SF=\E[%dS:SR=\E[%dT:AL=\E[%dL:DL=\E[%dM:\
	:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:cv=\E[%i%dd:ch=\E[%i%d`:bw:\
	:mb=\E[5m:md=\E[1m:mh=\E[30;1m:mr=\E[7m:me=\E[m:bl=^G:ut:it#8:km:

| On Sun, 7 Sep 1997, Ken McGlothlen wrote:
| 
| > Pardon the length of this message, but I'd rather include everything the
| > first time.
| > 
| > I'm making the switch from a SunOS system to a FreeBSD solution.  Frankly,
| > it's a switch that, theoretically, I'd be wildly happy about except for one
| > thing.
| > 
| > It's my terminal.  I think.
| > 
| > The SunOS system I'm currently using it an old reliable SunOS 4.1.1---none
| > of this Solaris stuff---and it is running tcsh 6.01.00.  I access it mostly
| > from a Macintosh running NCSA Telnet 2.7b4, but also from a FreeBSD 2.2.1
| > system running XFree86.  Everything works---tcsh supports file completion
| > with the <TAB> key, ^C works as an interrupt, ^Z suspends, and so on.
| > 
| > Unfortunately, when I use the same software on a FreeBSD 2.1.7.1-RELEASE
| > system, or a FreeBSD 2.2.1-RELEASE system, I don't get filename completion;
| > instead, the terminal beeps and nothing happens.  Furthermore, on occasion,
| > ^C doesn't interrupt a process---instead, it suspends it.  ^Z does nothing
| > on those occasions.  Emacs completely freaks out---keys quit working unless
| > I hit a <CR>, which occasionally gets the proper results, but screen
| > updates are difficult at best, and ^Z doesn't work, and ^X^C only suspends
| > the process, and so on.  Both of the systems are running tcsh 6.06.00, but
| > I don't think there's anything substantially different in the operations.
| > 
| > Identical setups.  Different results.
| > 
| > Now, granted, they both have different versions of stty.  The SunOS system
| > is currently using (with stty -a):
| > 
| > speed 38400 baud, 71 rows, 80 columns
| > parenb -parodd cs7 -cstopb -hupcl cread -clocal -crtscts 
| > -ignbrk brkint ignpar -parmrk -inpck istrip -inlcr -igncr icrnl -iuclc 
| > ixon -ixany -ixoff imaxbel 
| > isig iexten icanon -xcase echo echoe echok -echonl -noflsh -tostop 
| > echoctl -echoprt echoke 
| > opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel 
| > erase  kill   werase rprnt  flush  lnext  susp   intr   quit   stop   eof
| > ^?     ^U     ^W     ^R     ^O     ^V     ^Z/^Y  ^C     ^\     ^S/^Q  ^D
| > 
| > The FreeBSD 2.1.7.1-RELEASE system has (with stty -a):
| > 
| > speed 9600 baud; 24 rows; 80 columns;
| > lflags: icanon isig iexten echo echoe echok echoke -echonl echoctl
| >         -echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo
| >         extproc
| > iflags: -istrip icrnl -inlcr -igncr ixon -ixoff -ixany imaxbel -ignbrk
| >         brkint -inpck -ignpar -parmrk
| > oflags: opost onlcr oxtabs
| > cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
| >         -dtrflow -mdmbuf
| > cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
| >         eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
| >         min = 1; quit = ^\; reprint = ^R; start = ^Q; status = <undef>;
| >         stop = ^S; susp = ^Z; time = 0; werase = ^W;
| > 
| > and the FreeBSD 2.2.1-RELEASE system has exactly the same, except that
| > extproc has been changed to -extproc.  (But then, the 2.1.7 system is at my
| > ISP, and the 2.2.1 system is at my home.)
| > 
| > The curious thing is that if I set -oxtabs on the FreeBSD systems, file
| > completion works fine (which doesn't make sense to me, since that's the
| > *output* of the tabs), but occasionally, ^Z and ^C don't work, and also on
| > occasion, <TAB> starts echoing as ^I rather than as some number of spaces.
| > 
| > Anyone ever heard of this?  Until I get this behavior fixed, I'm reluctant
| > to make the switch, but I have a limited time before I have no choice but
| > to make the switch.
| > 
| > I'm not on the freebsd-questions list, so please E-mail me directly at one
| > of the addresses below:
| > 
| > 				---Ken McGlothlen
| > 				   mcglk@serv.net
| > 				   mcglk@cpac.washington.edu
| > 
| 
| -- Jay



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199709072006.NAA04343>