Unix Programming - Re: Any "simple" way for a program running in an xterm window to create a se

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > April 2005 > Re: Any "simple" way for a program running in an xterm window to create a se





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: Any "simple" way for a program running in an xterm window to create a se
Pascal Bourguignon

2005-04-11, 5:59 pm

"Norm Dresner" <ndrez@att.net> writes:

> Any number of times I've found myself yearning for the old MS-DOS PC's
> multiple video pages using EGA/VGA output cards. I have written, for
> example, a whole series of very useful and complex real-time control
> programs that use up to 8 simultaneous video pages for which the program has
> to do nothing more to put something on a secondary page than to copy the
> text & attributes to a different area of video memory than is used for the
> primary page and the video memory for all pages exists simultaneously and
> the program need do nothing to create them.
>
> In *NIX systems I know how to write separate programs which receive input
> either via a pipe or IPC messaging (or I guess shared memory too) but I was
> wondering if there's something I've overlooked in getting a text-based
> program in an xterm shell window to open a second window for (at least)
> output?


xterm !

For example:

% cat ex-xterm
#!/bin/bash
pipe="/tmp/$$.pipe"
trap "rm $pipe" 0
mknod "$pipe" p
xterm -sb -sl 10000 -e "tty>>$pipe;cat>$pipe" &
read terminal < "$pipe"
echo $pipe $terminal
while read line ; do
case "$line" in
*[aeiou]*) echo "$line" > "$terminal" ;;
*) echo "$line" ;;
esac
done

% ( echo "Hello" ; echo "Zzzz" ) | ./ex-xterm
will display Hello in a new xterm, and Zzzz in the current shell.


--
__Pascal Bourguignon__ http://www.informatimago.com/

Nobody can fix the economy. Nobody can be trusted with their finger
on the button. Nobody's perfect. VOTE FOR NOBODY.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com