[comp.sys.hp] Simulating a prompt.

preetham@ra.src.umd.edu (Preetham Gopalaswamy) (06/01/90)

I have written a front end program for a device which is connected to our HP835
by an RS232 link.  I would like this program to echo a prompt (similar to the
c-shell prompt).  The problem that I am having is that it is possible by using
the backspace key to erase the prompt (since I currently use the C command
"printf" to echo the prompt each time).  Is there any way by which I can prevent
this and not have the cursor go back over the prompt ?  I do not face this
problem with my shell prompt and would like to have the same thing be true for
this simulated prompt.  I would appreciate any help I can get.  Thanks.

							Preetham Gopalaswamy

gates@hpfcdc.HP.COM (Bill Gates) (06/02/90)

>Is there any way by which I can prevent
>this and not have the cursor go back over the prompt ?  I do not face this
>problem with my shell prompt and would like to have the same thing be true for
>this simulated prompt.  I would appreciate any help I can get.  Thanks.

To do this I believe you'd have to open the tty device, disable canonical
input and echoing, and do your own character parsing.  Once canonical input
and echoing is disabled, you can read one character at a time, echoing out
only the ones you want the user to see.  You can suppress backspaces that
would overwrite the prompt, etc.

See termio(7) in the HP-UX Reference for a list of the flags you'd need to
unset.  Get and reset the termios structure using ioctls documented there.

Bill