Help on control keys

Mark A. Heilpern heilpern at ibd.BRL.MIL
Wed Jan 4 00:28:39 AEST 1989


In article <893 at husc6.harvard.edu> yylu at walsh.UUCP (Ya Yan Lu) writes:

>     I am concerning the following program.  Is it possible to put some
>control characters in an ascii file, so that whenever I read that file 
>by cat or more, it actually runs a program? When cat or more are used, the 
>control keys in a file usually have some effect, but I am not so clear 
>what they really are.
>     Thanks for any help.

Define program. If you are refering to a 'graphics' type of display, yes.
It is not possible, however, to give a code that tells cat to execute the
command rather than print it. {Unless you feel like rewriting /bin/cat.
If you do, there is a genereic source of the 'normal' cat in comp.sources.}

To create a graphics display that is catted, there are two basic options.
Just like your old instructor from school, I will explain the hard one first.


1) 	a) get out the manual for your terminal and thoroughly study all
	   Control codes and escape codes for graphics/movement.

	b) decide what you want to do and use 'cat >file' and start giving
	   the codes to do what you want the screen to do. [You will not
	   be able to give ^D, kill chars, etc., and the screen may start
	   performing these results, so don't be discouraged if you can
	   no longer see waht you are typeing. Just remember to use ^D on
	   a line by itself to end input.

	c) cat the file and observe. Do Not Use More, as this will pause
	   in unwanted areas.


2) [easy?]
	a) write a program using curses to perform your desired functions.

	b) run this program with redirected output: $ program > catfile

	c) cat catfile and the same display should be seen.

-- 
 |\/|         |
 |  |   _     |<
/    \_(_(_)\_/ \______



More information about the Comp.unix.questions mailing list