How to mimic the terminal driver?

Chidambaram Vishwanath vishwana at umvlsi.ECS.UMASS.EDU
Wed Nov 30 03:22:01 AEST 1988


     I have taken upon myself the following task, viz.,: I want to add 
an extra feature to the C-shell whereby I can recall earlier commands
by pressing an arrow-key.  I thought first of using 'stty' to
reconfigure the arrow key to be an interrupt key, and then program the
shell to trap the interrupt and process it appropriately. But very 
quickly I discovered that the command-line shell cannot be interrupted.

	So I thought of another possible approach. A program would 
interpose between a child c-shell and the terminal. This program would
take characters from the terminal and deliver them to the shell.(Both
my program and the shell are running in the foreground, connected by a
pipe.)  However here is where I ran into another problem.  How to 
return the end_of_file condition to the reading shell?  For instance,
the 'command-completion' facility in the C-shell depends upon the user
hitting '^D' after entering some text.  My program can detect the eof,
but how is it to communicate it to the shell to which it is connected?

	I will be grateful for any pointers towards solving this
problem, or comments as to the feasibility of the whole approach alto-
gether.

			Thank you,
					Vishwanath,
					University of Mass. at Amherst.
e-mail: vishwana at umaecs (BITNET)
        vishwana at ecs.umass.edu (CSNET)



More information about the Comp.unix.questions mailing list