9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Implementing cooked mode
@ 2006-12-21  0:54 Joel Salomon
  2006-12-21  1:08 ` Russ Cox
  2006-12-21  2:27 ` [9fans] " Joel Salomon
  0 siblings, 2 replies; 6+ messages in thread
From: Joel Salomon @ 2006-12-21  0:54 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

If a program has the console in raw mode, can it erase characters or
words that it has echoed to the screen?

Context is a homework assignment to implement cooked mode in user
space.  The code in /sys/src/cmd/rio/wind.c looks to be a start, but I
don't see how to remove characters from the screen.  I suppose I could
use string() in libdraw and draw the string graphically rather than
echoing.  Rio's wind.c and acme's text.c both handle the various
control characters, but they aren't pretending to write to the
console.

Nemo's book has a similar assignment, so it seems to be doable; I just
haven't found how in the manual.

Failing that, are there printable glyphs shown if control characters
are write()n to the console?

--Joel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] Implementing cooked mode
  2006-12-21  0:54 [9fans] Implementing cooked mode Joel Salomon
@ 2006-12-21  1:08 ` Russ Cox
  2006-12-21  1:47   ` Russ Cox
  2006-12-21  2:27 ` [9fans] " Joel Salomon
  1 sibling, 1 reply; 6+ messages in thread
From: Russ Cox @ 2006-12-21  1:08 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> If a program has the console in raw mode, can it erase characters or
> words that it has echoed to the screen?

No.

Russ


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] Implementing cooked mode
  2006-12-21  1:08 ` Russ Cox
@ 2006-12-21  1:47   ` Russ Cox
  2006-12-21 12:50     ` Brantley Coile
  0 siblings, 1 reply; 6+ messages in thread
From: Russ Cox @ 2006-12-21  1:47 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> > If a program has the console in raw mode, can it erase characters or
> > words that it has echoed to the screen?
>
> No.

This is actually only half true.  You can echo backspaces and it will
erase up to the beginning of the line, but no earlier.

Russ


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [9fans] Re: Implementing cooked mode
  2006-12-21  0:54 [9fans] Implementing cooked mode Joel Salomon
  2006-12-21  1:08 ` Russ Cox
@ 2006-12-21  2:27 ` Joel Salomon
  2006-12-21  4:01   ` Russ Cox
  1 sibling, 1 reply; 6+ messages in thread
From: Joel Salomon @ 2006-12-21  2:27 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On 12/20/06, Joel Salomon <joelcsalomon@gmail.com> wrote:
> If a program has the console in raw mode, can it erase characters or
> words that it has echoed to the screen?

Oops. I meant a program running under rio, having written "rawon" to
/dev/consctl.

Experimentally, echoing backspaces does work—sort of—under rio.
Emphasis on the "sort of".  I'm going to stick with echoing the
control picture ␈ while doing the Right Thing™ to the buffer being
built up.  So entering:
	0123455<bs>6789
will echo:
	0123455␈6789
while filling the buffer with:
	0123456789
The program's due before midnight, so this implementation will have to do.

BTW: do all programs that accept passwords in (rio) console raw mode
have to implement the full cooking themselves?

--Joel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] Re: Implementing cooked mode
  2006-12-21  2:27 ` [9fans] " Joel Salomon
@ 2006-12-21  4:01   ` Russ Cox
  0 siblings, 0 replies; 6+ messages in thread
From: Russ Cox @ 2006-12-21  4:01 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> BTW: do all programs that accept passwords in (rio) console raw mode
> have to implement the full cooking themselves?

Yes, but there is a library routine to ask for a password.
Also, very few programs actually read passwords -- usually
factotum does it for them.

Russ


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] Implementing cooked mode
  2006-12-21  1:47   ` Russ Cox
@ 2006-12-21 12:50     ` Brantley Coile
  0 siblings, 0 replies; 6+ messages in thread
From: Brantley Coile @ 2006-12-21 12:50 UTC (permalink / raw)
  To: 9fans

>> > If a program has the console in raw mode, can it erase characters or
>> > words that it has echoed to the screen?
>>
>> No.
> 
> This is actually only half true.  You can echo backspaces and it will
> erase up to the beginning of the line, but no earlier.
> 
> Russ

I was about to point this out.  We had to implement a reasonable subset
of readline for the SR EtherDrive firmware, if you can have the words
reasonable and readline in the same sentence.  People kept hitting ^P
to back up a line in history, causing an unexpected reboot. ☹

I stuck it in rc(1) and put rc in raw mode.  Not for public consumption, which
is a good thing. ☺



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-12-21 12:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-21  0:54 [9fans] Implementing cooked mode Joel Salomon
2006-12-21  1:08 ` Russ Cox
2006-12-21  1:47   ` Russ Cox
2006-12-21 12:50     ` Brantley Coile
2006-12-21  2:27 ` [9fans] " Joel Salomon
2006-12-21  4:01   ` Russ Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).