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



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@xxxxxxxxxxxx -
- CDN Systems, Internap, Inc. http://www.internap.com -
- -
- Silence! Or I shall replace you with a very small shell script! -
- - The Wizard of OS -
----------------------------------------------------------------------

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list



Relevant Pages

  • Re: help newbe with 8051 uC
    ... Actually, Microsoft isn't confused. ... Windows 2000 and up have both a DOS prompt and a Windows command prompt, and although the command languages are similar, the two are entirely distinct things. ... Basically, they wanted people who needed to use old DOS programs to be able to find a command shell, while hoping that everyone else would use point-and-drool windows for everything. ...
    (sci.electronics.design)
  • Re: How to open program in a UNIX-like fashion on MSWinXP?
    ... I was wondering how I could get the Windows XP command prompt to ... act a little more like a UNIX shell. ...
    (comp.os.linux.misc)
  • Re: Program abnormal termination - Windows XP Home Edition
    ... you will see a command prompt. ... MVP Windows - Shell / User ... Wes Lucas wrote: ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: [SLE] Bat files in Linux
    ... > I have a few commands that I would like to run at the command prompt. ... > In Windows I do this with a bat file that looks like the sample below. ... In the *nix world they are called shell scripts and are made executable ...
    (SuSE)
  • My recent Epiphany about operating systems
    ... In Winblow$, the release & bundling of IE was purposely as crippleware, virus, & bug delivery system 2 trap people into constantly 'upgrading'. ... A simple comparisson of Windows 95 side-by-side with the final Windows ME & various IE 'upgrades' illustrates how the supposedly 'new & improved' stuff is actually about 1/5 the speed, ... The OS Kernels are designed to require constant patching or nothing runs properly when 'upgrading' softwares. ... Just like M$ writes Windoze 2 B full of bugs, so they can keep selling the same crap over & over "oh but we fixed it this time" - yeah right:)) I am still using the shell from Windows95. ...
    (freebsd-questions)