From john@starfire.mn.org  Fri Jun 27 09:09:08 1997
Received: from starfire.mn.org (root@starfire.skypoint.net [199.86.32.187])
          by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id JAA29155
          for <FreeBSD-gnats-submit@freebsd.org>; Fri, 27 Jun 1997 09:09:05 -0700 (PDT)
Received: (from john@localhost)
	by starfire.mn.org (8.8.5/1.1)  id LAA06577; Fri, 27 Jun 1997 11:09:03 -0500 (CDT)
Message-Id: <199706271609.LAA06577@starfire.mn.org>
Date: Fri, 27 Jun 1997 11:09:03 -0500 (CDT)
From: john@starfire.mn.org
Reply-To: john@starfire.mn.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: termcap vt100 ku, kd, kr, kl don't match observed behavior
X-Send-Pr-Version: 3.2

>Number:         3972
>Category:       bin
>Synopsis:       termcap vt100 ku, kd, kr, kl don't match observed behavior
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 27 09:10:00 PDT 1997
>Closed-Date:    Fri Jun 27 20:41:37 MEST 1997
>Last-Modified:  Fri Jun 27 11:50:01 PDT 1997
>Originator:     John Lind
>Release:        FreeBSD 2.2.1-RELEASE i386
>Organization:
Starfire Consulting Services
>Environment:

	FreeBSD cons25, XFree86 xterm, rxvt, EWAN, many terminal
	emulators and telnet clients using vt100-like control
	sequences

>Description:

	The termcap ku, kd, kr, and kl entries don't match
	what the keys actually send, causing programs which
	rely on those entries to not recognize the keypresses
	correctly.  In termcap language
	name	ku	kd	kr	kl
	termcap	\EOA	\EOB	\EOC	\EOD
	sent	\E[A	\E[B	\E[C	\E[D

	UnixWare 2.1 and SCO ODT 5.0.2, among others, have the
	"sent" values in their termcaps.  Solaris / SunOS have
	more or less the same as ours.  I suspect that this may
	have something to do with the different keypad modes that
	a real VT100 has, but I'm only guessing at the history.

>How-To-Repeat:

	cat > /dev/null
	(press arrow keys, observe system echo, press ENTER/RETURN)
	^D (control D to end cat)

	or, more sophisticated
	cat > foo
	(press arrow keys, then ENTER/RETURN)
	^D
	od -c foo

	compare results to termcap file

>Fix:
	
	Edit termcap file, change associated entries as describe in
	table above.

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: joerg 
State-Changed-When: Fri Jun 27 20:41:37 MEST 1997 
State-Changed-Why:  
You ought to initialize the keyboard correctly with the value of the 
`ks' capability. 
`cons25' ain't VT100-compatible at all, so don't use a vt100 TERM 
value for it. 

From: j@uriah.heep.sax.de (J Wunsch)
To: john@starfire.mn.org
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/3972: termcap vt100 ku, kd, kr, kl don't match observed behavior
Date: Fri, 27 Jun 1997 20:38:01 +0200

 As john@starfire.mn.org wrote:
 
 > >Environment:
 > 
 > 	FreeBSD cons25, XFree86 xterm, rxvt, EWAN, many terminal
 > 	emulators and telnet clients using vt100-like control
 > 	sequences
 
 cons25 is not VT100-compatible.
 
 xterm, rxvt etc. are, but...
 
 > 	name	ku	kd	kr	kl
 > 	termcap	\EOA	\EOB	\EOC	\EOD
 > 	sent	\E[A	\E[B	\E[C	\E[D
 
 ...the correct (\EOA etc.) values are only being sent after
 initializing the tty correctly, using the `ks' capability.
 
 j@uriah 242% echo $TERM
 xterm
 j@uriah 243% echo "$TERMCAP" | tr : '\012' | grep '^k[se]'
 ks=\E[?1h\E=
 ke=\E[?1l\E>
 j@uriah 244% cat
 ^[[A^[[B           (this is the initial mode)
            (this is the initial mode)
 
 
 ^[[?1h^[=
 
 
 
 ^[OA^[OB^[OA^[OB  (now we are in ``keypad transmit'' mode)
 AABBAABB  (now we are in ``keypad transmit'' mode)
 
 
 ^[[?1l^[>
 
 ^[[A^[[B   (back again)
    (back again)
 
 
 
 ^D
 
 -- 
 cheers, J"org
 
 joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
 Never trust an operating system you don't have sources for. ;-)
>Unformatted:
