delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/06/07/05:32:09

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:to:from:subject:date:message-id:references
:mime-version:content-type:content-transfer-encoding; q=dns; s=
default; b=cmDPKqB/Rxn3iNDWzsvPkHGrTwyScS++8vS9rsorjAfKxi+wYxrOu
iUUPLzyjNtibLUHks/gP4qMxyD5z2yn9D4Q2HPog1DHrQ0vVjoVRioYx4sa3jqa1
C6BoqoYq9ahdqx1PWYIr+4QtvsGJMnKsuZ9znA0y//PTAYkn5YjuNM=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:to:from:subject:date:message-id:references
:mime-version:content-type:content-transfer-encoding; s=default;
bh=AWV/MT0TloateYPdWcsbBORnfcY=; b=aUmg0aLkTgd8KUAPu8TWOCTPKs16
3HESGIWoZqWaljAvcADmdiAKhq3YkEJgvlwDz35BH/NKGw5qQ3EtsIh57YcFj9W/
pSvquZYd6gcnOnEdqoGufAApXUzJVh+4EF6CX8PjiRdlngQkX25DHMsdF5QVqWMf
0l8vY5JQ7v8ceoA=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=1.1 required=5.0 tests=AWL,BAYES_50,FSL_HELO_BARE_IP_2,RCVD_IN_DNSWL_LOW,RCVD_NUMERIC_HELO,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=no version=3.3.2 spammy=icrnl, stty, tty, cpid
X-HELO: plane.gmane.org
To: cygwin AT cygwin DOT com
From: Achim Gratz <Stromeko AT NexGo DOT DE>
Subject: Re: stty icrnl
Date: Tue, 7 Jun 2016 09:31:34 +0000 (UTC)
Lines: 33
Message-ID: <loom.20160607T111215-253@post.gmane.org>
References: <loom DOT 20160606T135902-517 AT post DOT gmane DOT org> <loom DOT 20160606T170515-528 AT post DOT gmane DOT org>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes

For the record, this is what I ended up with:

-----------8<-----------
#!/bin/dash
cleanup () {
    /bin/kill $cpid
    exec 6<&- 6>&-
    /bin/stty $stty
}
if [ $# -ne 2 ] ; then
    echo "Usage:  ${0##*/} <TTY> <Baud>"
    exit 1
fi
tty=$1; shift
baud=$1; shift
stty=$(/bin/stty -g)
/bin/stty -icanon -echo
/bin/stty -F $tty $baud
exec 6<> $tty
0<&6 stdbuf -i0 -o0 -e0 tr "\r" "\n" &
cpid=$?
trap cleanup HUP KILL INT
1>&6 stdbuf -i0 -o0 -e0 tr "\n\177" "\r\b"
cleanup
----------->8-----------

The only thing missing is to emulate the effect of the "stty echoe" setting,
that is outputting erase as backspace - space - backspace rather than just a
single backspace.


Regards,
Achim


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019