OT What does RET (Enter) do and how does it do it ??

William Case billlinux at rogers.com
Sun Aug 26 20:36:39 UTC 2007


Hi Aaron;

[snip]

> A second basic fact that needs to be undertood, which  OP I think did
> not, is that what comes out of the keyboard or any other input device is
> just a stream of characters read from the appropriate buffer.
> What a program like vi does with that stream may make it look like a
> series of lines across the width of the window but that is an artifact
> of what vi does with the character stream it receives.
> 

Being a little defencive perhaps, the original OP understood the process
from keyboard matrix ==> scan codes ==> key codes ==> key maps.  I
understand the difference between a stream in raw versus canonical mode.
And, what I have forgotten, I have saved in about 25 pages of cut and
paste notes re: keyboards.  I have enough 'C' to understand functions
like getc() and getchar() and where getchar() gets its char.

My problem was on the other end.  Although, one of the first things I
learnt about Linux (actually all *nix) was that one of the very first
things loaded at OS initialization was the shell, and that all processes
were a child process of the shell.  That was 'read and retain' kind of
knowledge.  It wasn't info that was "in my bones" as it should have
been.  

The reason I didn't know the answer to the query I posed here was that
this was the first question that I have asked that directly depended on
*knowing* that the shell was running and looking for input as the
answer.  When Rick Stevens said "Now, when you're at a command prompt or
other program requesting input (remember that the command prompt is the
shell program asking for input), the RETURN (or ENTER) key signals the
end of user input ...", it was a real head slapping eureka moment .  He
brought home the significance of something that I already knew but
hadn't appreciated. The shell is waiting for the right input (end of
line) so that it can exec the program named.

I suppose there is some value in writing this response.  I can serve as
the classical bad example for people like me futzing around with their
computers trying to figure out how they work.

-- 
Regards Bill




More information about the users mailing list