Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

handling xterm from within a C-app

0 views
Skip to first unread message

Hartwig Distler

unread,
Mar 29, 2003, 4:05:38 AM3/29/03
to
Hi,

how can I open an new xterm window from an C-based application and get
to know it's tty-handle?
Currently I only manage to open a connection to an existing xterm
knowing it's tty.
What I'd like to do fropm within my application is
1.) at launch of my application open the xterm
2.) get handle to xterm
3.) in the runtime-loop pass debug output to the xterm (can do this
already)
4.) at end of app -> close xterm window

If anyone xould provide a sample I would be really gratefull :-)

hartwig

Basile STARYNKEVITCH

unread,
Mar 29, 2003, 4:32:49 AM3/29/03
to
>>>>> "Hartwig" == Hartwig Distler <in...@vrtainment.de> writes:

Hartwig> Hi, how can I open an new xterm window from an C-based
Hartwig> application and get to know it's tty-handle? Currently I
Hartwig> only manage to open a connection to an existing xterm
Hartwig> knowing it's tty. What I'd like to do fropm within my
Hartwig> application is 1.) at launch of my application open the
Hartwig> xterm 2.) get handle to xterm 3.) in the runtime-loop
Hartwig> pass debug output to the xterm (can do this already) 4.)
Hartwig> at end of app -> close xterm window


If you want only to display some textual output of your program, using
xterm might be too complex (unless you fork "xterm -e tail -f
/your/output/file")

An alternative could be to fork xconsole (or another tool), perhaps
using a named FIFO or /dev/stdin or /dev/fd/XX (same as
/proc/self/fd/XX) - eg fork "xconsole -file /your/fifo" or "xconsole
-file /dev/stdin"

You could also fork a small GUI application which just waits for your
main application's output and display it (in a scrolled text window).

Alternatively, you could decide to run your GUI frontend which talks
to your main application. Many apps are so designed!

As an example of a GUI GTK2 application listening to a pipe, you might
look into GUIS (which is a widget server, that you might even want to
use, but it is in alpha stage). Or you could use the guisgtk.c file
from GUIS (which handles a flow of line "commands" from a pipe) and
define your own function parse_request_string. Ask me for details.

GUIS is available under http://freshmeat.net/projects/guis/


--

Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net
aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
8, rue de la Faïencerie, 92340 Bourg La Reine, France

Kasper Dupont

unread,
Mar 29, 2003, 6:18:11 AM3/29/03
to
Hartwig Distler wrote:
>
> Hi,
>
> how can I open an new xterm window from an C-based application and get
> to know it's tty-handle?
> Currently I only manage to open a connection to an existing xterm
> knowing it's tty.
> What I'd like to do fropm within my application is
> 1.) at launch of my application open the xterm
> 2.) get handle to xterm
> 3.) in the runtime-loop pass debug output to the xterm (can do this
> already)
> 4.) at end of app -> close xterm window

see the discussion of the -S option in the xterm man page.
And see this example of a completely different approach:
http://www.daimi.au.dk/~kasperd/comp.os.linux.development.faq.html#xterm

I hope one of them will help you.

--
Kasper Dupont -- der bruger for meget tid på usenet.
For sending spam use mailto:aaa...@daimi.au.dk
for(_=52;_;(_%5)||(_/=5),(_%5)&&(_-=2))putchar(_);

Hartwig Distler

unread,
Mar 29, 2003, 2:09:03 PM3/29/03
to
Kasper Dupont <kas...@daimi.au.dk> wrote in message news:<3E8580F3...@daimi.au.dk>...

> Hartwig Distler wrote:
> >
> > Hi,
> >
> > how can I open an new xterm window from an C-based application and get
> > to know it's tty-handle?
> > Currently I only manage to open a connection to an existing xterm
> > knowing it's tty.
> > What I'd like to do fropm within my application is
> > 1.) at launch of my application open the xterm
> > 2.) get handle to xterm
> > 3.) in the runtime-loop pass debug output to the xterm (can do this
> > already)
> > 4.) at end of app -> close xterm window
>
> see the discussion of the -S option in the xterm man page.
> And see this example of a completely different approach:
> http://www.daimi.au.dk/~kasperd/comp.os.linux.development.faq.html#xterm
>
> I hope one of them will help you.

Hi Basile & Kasper,

thanks very much :-) These were exactly the suggestions and pointers I
was desperately searching for
..

hartwig

0 new messages