From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HTML_MESSAGE,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 7453 invoked from network); 25 Jul 2020 15:10:57 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 25 Jul 2020 15:10:57 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id AEF299CA05; Sun, 26 Jul 2020 01:10:53 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 664169C8B1; Sun, 26 Jul 2020 01:09:37 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ccc.com header.i=@ccc.com header.b="oWmnNf0C"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 995D99C8B1; Sun, 26 Jul 2020 01:09:35 +1000 (AEST) Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) by minnie.tuhs.org (Postfix) with ESMTPS id 0437E9BA4F for ; Sun, 26 Jul 2020 01:09:35 +1000 (AEST) Received: by mail-qk1-f193.google.com with SMTP id b79so11445755qkg.9 for ; Sat, 25 Jul 2020 08:09:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ccc.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8Ek/CWXpwHhV3JYuh1TgVT9nKQfjYjKun9X5Ru0o/fI=; b=oWmnNf0CcmOqKb+/1jxe2CygbbTYjiALDmqdwHloYVh+zNyb2Khnkc3Qn2EyxgrVKp ZzQZztUsuG4M36ybV07eYTjvX+SkhsmnmQYsjlZUEQYjIwdxxGZRPcORxMRupTMgQmra lPPnn8Xb1C1k/CGn0w56+YEta9fh/636oSul4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8Ek/CWXpwHhV3JYuh1TgVT9nKQfjYjKun9X5Ru0o/fI=; b=sL7xBfZbTvWjwPhFVZazYcvvzoZnd8qB0Ysjb4QXT5kLzZ9NKuLiDoKHl4c3MXafDh Rs0oDQ/AGJ5rZmdtnJKkxZ+Up6rgzeOF/5ERgBXAVIdZBzlvauTEA8L4PgJ+DjgwOiUG Qt5eP1U9umHPvm/JD2RlVSfECqAEZ3OttNJgOXHux03rdxOhFNDBw8ZmYsS12i0wELiV x4pXB3otZCbJ1f4hIy8DZjkhbm5kz4SOvxwnW+AxqdoBoM9A0RiRjNWYpxx88lGWIent bJgsRjTJpXbsrwsp0fSL931dpy0O3U4Nyo6Kt9Md2oLANHRgdqWNNMYBRVsB3fWEgxZw 4evA== X-Gm-Message-State: AOAM533px8hLlNOf7xpf7o2NinBub0/tO/7kW+oxtVcuHeSAOjhHD2dy vILgbWScvjHo41oALxRUMhz3PlCTV4GFiiGOrpRPsw== X-Google-Smtp-Source: ABdhPJx0q/wmnidm1WSOpSU2ha55oGPefne0QXo5kcJ5M8uW7Lss3VSjTCaCJvqTwdLhgEYeHzk/ZzM9m4pYca0omfQ= X-Received: by 2002:a37:b307:: with SMTP id c7mr16028002qkf.307.1595689774018; Sat, 25 Jul 2020 08:09:34 -0700 (PDT) MIME-Version: 1.0 References: <20200724022807.D9E1E18C073@mercury.lcs.mit.edu> In-Reply-To: From: Clem Cole Date: Sat, 25 Jul 2020 11:09:08 -0400 Message-ID: To: John Cowan Content-Type: multipart/alternative; boundary="00000000000027066105ab457af3" Subject: Re: [TUHS] V6 Console IO X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: TUHS main list , Noel Chiappa Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" --00000000000027066105ab457af3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable BTW: another old V6 trick is the use file redirection from the different terminal to unlock a hosed tty. Programming on the console was fraught with multiple dragons and not recommended. But due to program crashes that left things in raw mode, I admit that I remember having to uses the redirection trick a few times to get the console back. As Noel said, it could get dicey if the console ended up with canonicalization turned off. V7's =C2=BD cooked (*a.k.a.* CBREAK) was a welcomed edition, = but the fact is V6's try handler was good enough most needs and a lot of used it pretty successfully for a long time. Clem On Sat, Jul 25, 2020 at 12:02 AM John Cowan wrote: > Ctrl+J actually is the keystroke for U+000D LINE FEED, so it always works= ; > old-timers got in the habit of typing ^Jreset^J. > > Note that if a program gets stuck in rare mode rather than raw mode, you > can get out of it with ^C (or whatever INTR is set to), a good reason for > using rare mode. > > > On Fri, Jul 24, 2020 at 10:49 PM Paul Riley wrote: > >> Yep already fallen into that trap. Glad I'm running on a sim! Yes I'd >> considered writing a small program to reset the STTY settings, and you'v= e >> helped me to understand how I can run it! >> >> In answer to the CR question, is it that in raw mode, the CR does not ge= t >> mapped to LF, and therefore the shell doesn't see the LF character and >> recognize the end of the line? Incidentally, why the ^J before ft? Just = to >> clean up the shell input status? >> >> I'll write my own ft, thanks. I'll try raw mode, because I want some >> better line editing capability. >> >> Alternatively if I toy around with /dev/tty does that interfere with the >> operation of the standard console outside of my app? >> >> Paul >> >> *Paul Riley* >> >> >> >> >> On Fri, 24 Jul 2020 at 22:36, Clem Cole wrote: >> >>> >>> >>> On Thu, Jul 23, 2020 at 10:29 PM Noel Chiappa >>> wrote: >>> >>>> ... >>>> This is not a C issue; it's the Unix I/O system (and specifically, >>>> terminal I/O). >>> >>> >>>> ... >>> >>> One can suppress all this; there's a mode call 'raw' >>>> >>> Just be sure to turn raw mode off so canonization is performed again >>> after your program stops running. Remember this a 'system wide' >>> settings for that try and all programs start to use that setting. So = if >>> some reason, your program stops and a new program (like the shell) take= s >>> back over input from the try, if you do not have a way to get it back y= ou >>> are screwed. >>> >>> Back in the day, I have a shell script in my path stored in ~/.bin >>> called: ft (fix tty) which called the stty command with the way I >>> wanted the terminal to be set up. Thus is I was running a program >>> that core dumped and left the try in raw mode, if I could find a way to= run >>> the ft script (usually by typing ^Jft^J ) life was good again. Paul, >>> as an exercise why would ft not be good enough? (hint read and >>> study the section 4 man page for stty) >>> >>> FWIW: is how the original UCB ex/vi and Cornell's Fred editors for v6 >>> works by the way. I suspect that iyou look at any of the video editors= of >>> the day it will show you the details. >>> >>> One of the differences between V7 and earlier UNIX tty handlers was tha= t >>> they tty canonization was split into multiple parts. Also the other h= int >>> with Sixthedition's version of raw and cooked modes, you get all or not= hing so >>> you if you turn on raw, your program, will have do things like backspac= e >>> processing, *etc*.. >>> >>> --00000000000027066105ab457af3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
BTW: another old V6 trick is the use file redirection f= rom=C2=A0the different terminal to unlock a hosed=C2=A0tty.=C2=A0 Programmi= ng=C2=A0on the console was fraught=C2=A0with multiple dragons and not recom= mended.=C2=A0 But due to program crashes that left things in raw mode, I ad= mit that I remember having to uses the redirection trick a few times to get= the console back.=C2=A0 As Noel said, it could=C2=A0get dicey if the conso= le ended up with canonicalization turned off.=C2=A0 =C2=A0V7's =C2=BD c= ooked (a.k.a. CBREAK) was a welcomed edition, but the fact is V6'= ;s try handler was good enough most needs and a lot of used it pretty succe= ssfully for a long time.

Clem

On Sat, Jul 25, 202= 0 at 12:02 AM John Cowan <cowan@ccil.o= rg> wrote:
Ctrl+J actually is the keystroke for U+000D LINE FEED, s= o it always works; old-timers got in the habit of typing ^Jreset^J.
Note that if a program gets stuck=C2=A0in rare mode rather than= raw mode, you can get out of it with ^C (or whatever INTR is set to), a go= od reason for using rare mode.


On Fri, Jul 24, 2020 at = 10:49 PM Paul Riley <paul@rileyriot.com> wrote:
Yep already fallen into that trap. = Glad I'm running on a sim! Yes I'd considered writing a small progr= am to reset the STTY settings, and you've helped me to understand how I= can run it!

In answer to the CR question, is it that in= raw mode, the CR does not get mapped to LF, and therefore the shell doesn&= #39;t see the LF character and recognize the end of the line? Incidentally,= why the ^J before ft? Just to clean up the shell input status?
<= br>
I'll write my own ft, thanks. I'll try raw mode, beca= use I want some better line editing capability.

Al= ternatively if I toy around with /dev/tty does that interfere with the oper= ation of the standard console outside of my app?

P= aul

Paul Riley




=
On Fri, 24 Jul 2020 at 22:36, Clem Co= le <clemc@ccc.com= > wrote:


On Thu, Jul 23, 2020 at 10:29 PM= Noel Chiappa <jnc@mercury.lcs.mit.edu> wrote:
=C2=A0...
This is not a C issue; it's the Unix I/O system (and specifically, term= inal I/O).=C2=A0

...=C2=A0
One can suppress all this; there's a mode call '= raw'=C2=A0
Just be sure to turn raw mode off s= o canonization is performed again after your program stops running. Remembe= r this a 'system wide' settings=C2=A0for that try and all programs = start to use that setting.=C2=A0 =C2=A0So if some reason, your program stop= s and a new program (like the shell) takes back over input from the try, if= you do not have a way to get it back you are screwed.=C2=A0

Back in the day, I have a shell script in my path sto= red in ~/.bin called: ft <= font face=3D"arial, helvetica, sans-serif">(fix tty) which called the stty = command with the way I wanted the terminal=C2=A0to be set up.=C2=A0 =C2=A0<= /font>Thus is I was running a p= rogram that core dumped and left the try in raw mode, if I could find a way= to run the ft script (usually by typing <= /span>^Jft^J=C2=A0) life was good again.=C2=A0 = Paul, as an exercise=C2=A0why would ft<CR> not= be good enough? (hint read and study the section 4 man page for stty)
=C2=A0
FWIW: is how the original UCB e= x/vi=C2=A0 and Cornell's Fred editors for v6 works by the way.=C2=A0 I = suspect that iyou look at any of the video editors of the day it will show = you the details.

One of the differences between V7 and= earlier UNIX tty handlers was that they tty canonization was split into mu= ltiple parts.=C2=A0 =C2=A0Also the other hint with Sixthedition's versi= on of raw and cooked modes, you get all or nothing=C2=A0so you if you turn on raw, your program= , will have do things like backspace processing, etc..

--00000000000027066105ab457af3--