OT What does RET (Enter) do and how does it do it ??
Rick Stevens
rstevens at internap.com
Fri Aug 24 23:38:02 UTC 2007
On Fri, 2007-08-24 at 18:52 -0400, William Case wrote:
> Thanks Rick;
>
> I put your answer together with Alan's and I think I get a satisfying
> answer.
>
> On Fri, 2007-08-24 at 15:09 -0700, Rick Stevens wrote:
> > On Fri, 2007-08-24 at 17:42 -0400, William Case wrote:
> > > Hi;
> > >
> > > This question is meant as a Friday afternoon to a Sunday evening
> > > discussion. It is not rush; but I have been unable to discover an answer
> > > to what seems to me a basic question on how my computer works.
> > >
> > >
> >
> [snip]
>
> > Well, it's simple. The intent of text editors, word processors and the
> > like is that whatever you type in gets saved in the file. In *nix-ish
> > operating systems (Linux, Unix, MacOS, etc.), the RETURN or ENTER key is
> > denoted by a single character in the file. We call this the "newline"
> > character, which is the hexadecimal value 0x0a. In ASCII parlance,
> > that's the "LF" or "linefeed" character. The LF character can also
> > be entered by holding down the "CTRL" key and pressing "j" (also
> > sometimes called "control-J").
> >
> > In Windows-type stuff (DOS, Windows, CP/M, etc.), the ENTER key is
> > denoted by a two character sequence, the hex value 0x0d (ASCII "CR" or
> > "carriage return"), followed by the hex value 0x0a (ASCII "LF" or
> > "linefeed" again). We call this sequence the "CRLF" sequence. Note
> > that the "CR" character can also be entered by holding down the "CTRL"
> > key and pressing "m", which is why it's sometimes called "control-M".
> >
> > (ADDITIONAL INFO: The hex value of "m" is "0x4d" and that of "j" is
> > 0x4a. Holding down the CTRL key inhibits the generation of bit 6 or
> > the value of 0x40, so CTRL-M generates 0x0d instead of 0x4d. Easy.)
> >
> > So much for text editors, word processors and the like. 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 and the program then
> > processes that according to whatever the program is supposed to do.
> >
> > Does that clarify things?
> >
> To re-summarize, the meaning of RET is established by the program being
> used. The program can create it's own meaning for RET; or use a
> standardized meaning according to what has been bound to the keymap the
> program is using, or redefine the keymap it uses to bind one or another
> meaning to a key press or event.
That's pretty much it in a nutshell. Generally, RET (ENTER) is used to
signify the end of a line. What the program _does_ with that line is
up to the program.
I was also trying to emphasize that command prompts are really another
program (on *nix, the shell; on DOS/Windows, command.com or whatever
Windows calls it now) asking for input.
----------------------------------------------------------------------
- Rick Stevens, Principal Engineer rstevens at internap.com -
- CDN Systems, Internap, Inc. http://www.internap.com -
- -
- Silence! Or I shall replace you with a very small shell script! -
- - The Wizard of OS -
----------------------------------------------------------------------
More information about the users
mailing list