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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

I have asked on my local LUG mailing list (which is usually quite good);
searched the following text books; "Modern Operating Systems", 2nd ed,
Andrew S. Tanenbaum; "Computer Organization & Architecture", 6th ed,
William Stallings; "The Linux Kernel Primer", Rodriguez, Fischer,
Smolski.  I have done the usual google and Wikipedia.  I mention the
above to indicate I am am willing to dig quite deeply for an answer.  

Since I have been unable to find an answer, I might be able to conclude
I have mis-posed the question.  That is why I am asking for your help,
pointing me to the correct answer or offering me enough of an
explanation, that I can begin to look in the right places.

Put simply:  
1) If I am in any kind of text application, from emacs, vim to OOo
Writer, whenever I push RET the line of characters I have just typed
gets saved as a string literal the, "\n", new line character gets added
to the string array, and the cursor gets moved down to the beginning of
the next line. Of course, in the right circumstances within an
application (i.e. menu selection) push RET to get a sub-program or a
program module to run.  (More questions in a moment)

2) If I am in a terminal at the command prompt and I type in a command,
whenever I push RET the command name I just typed gets executed.  When
it is finished being executed I get a new command line prompt.  Of
course, a executed program can take a string as an argument.

For 1) How does the context (i.e. that I am in a text program) get
established?  Is there a context line at the start of the application?
Is it through main(argc, argv) or some such, depending on the
programming language of the application?  How does it know to move one
line down on the screen i.e. is there a system call, a special
function ?

For 2) Again, how does the context (i.e. that I am in a terminal with a
command prompt) get established?  Is there an exec() call or system call
to execute the program on pushing RET? How can stdin tell the
difference? Why does exec(), or its brethren (fork() etc), act one way
in one instance and another in the next instance?  What is the command
that RET issues that starts, forks, calls or whatever a process or
program?

I suppose there is a simple answer; there should be.  But I have been
having difficulty even explaining what I am asking.  I usually get
answers of the kind "Of course it executes the command.  You pushed RET"

As I said, maybe I am mis-posing the question.  Maybe someone could help
me straighten the question out.  Maybe someone can point me to an
answer.  It can't be a new question. 


-- 
Regards Bill


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux