sending output to xterm ...

sending output to xterm ...

Post by Irvine Du » Wed, 09 Oct 2002 06:42:35



Hi! Simple problem: Have a process that generates a lot of output.
Want to have this output sent out to an xterm, distinct from the
xterm/shell I started the process from. How do I do it? I would prefer
to use the -Sccn option for this. But, I have been unable to use it
successfully on Linux! Any hints?

Thanks in advance for all your helpful answers.

 
 
 

sending output to xterm ...

Post by Bit Twiste » Wed, 09 Oct 2002 08:55:38



Quote:> Hi! Simple problem: Have a process that generates a lot of output.
> Want to have this output sent out to an xterm, distinct from the
> xterm/shell I started the process from. How do I do it? I would prefer
> to use the -Sccn option for this. But, I have been unable to use it
> successfully on Linux! Any hints?

xterm -e process_name_here &

 
 
 

sending output to xterm ...

Post by Mattias Engdeg? » Thu, 10 Oct 2002 00:22:02



>Want to have this output sent out to an xterm, distinct from the
>xterm/shell I started the process from. How do I do it? I would prefer
>to use the -Sccn option for this. But, I have been unable to use it
>successfully on Linux! Any hints?

Create a pty/tty pair and invoke xterm with -Sccn where cc doesn't
matter if you are using new-style ptys (which modern Linux does); they
can be any two characters. n is the tty file descriptor number. Thus,
use xterm -Sxx13 if fd 13 in the child process is the tty descriptor.

Note that xterm has a couple of bugs and undocumented features when running
in slave mode, no doubt because of insufficient testing (it's rarely used).

 
 
 

sending output to xterm ...

Post by Irvine Du » Thu, 10 Oct 2002 04:28:16


I guess, I did not explain it properly, eh? :)

Ok! Here's the scene:
shell> daemon_process_that_generates_lots_of_messages &

This process writes the output to a file, but it generates so much
output that the little flash file system gets full very quickly. So, I
would rather have this output sent out to an xterm. Thus, inside the
daemon process I would spawn off a child which would execl
(/usr/X11R6/bin/xterm). But, now all the output that the daemon
process generates MUST come out on that xterm.

shell> man xterm

shows that xterm program has -Sccn option by which you can connect a
pseudo-term to it. I tried doing this under Linux 2.4.xx (originally
rh7.3), but that doesn't seem to work!! So, I was wondering if anyone
has already tried this and got it working before, and if so, can you
share your code? Or if you know any public domain code that would have
this. (I am assuming that "expect" should have this or similar
functionality, but I don't know where to look! :( So, your help would
be greatly appreciated.

Also, I searched the groups for previoous postings on similar issues,
and way back in 1993 someone from Germany (.de) had responded he knew
how to do this, but he had not posted a solution! Also, I am not sure
if his email address is valid still. Hence the repost.

Thanks for all your help.



> > Hi! Simple problem: Have a process that generates a lot of output.
> > Want to have this output sent out to an xterm, distinct from the
> > xterm/shell I started the process from. How do I do it? I would prefer
> > to use the -Sccn option for this. But, I have been unable to use it
> > successfully on Linux! Any hints?

> xterm -e process_name_here &

 
 
 

sending output to xterm ...

Post by Thomas Dicke » Thu, 10 Oct 2002 05:01:56




>>Want to have this output sent out to an xterm, distinct from the
>>xterm/shell I started the process from. How do I do it? I would prefer
>>to use the -Sccn option for this. But, I have been unable to use it
>>successfully on Linux! Any hints?
> Create a pty/tty pair and invoke xterm with -Sccn where cc doesn't
> matter if you are using new-style ptys (which modern Linux does); they
> can be any two characters. n is the tty file descriptor number. Thus,
> use xterm -Sxx13 if fd 13 in the child process is the tty descriptor.

The 'cc' is used in debug-traces, if nothing else...

Quote:> Note that xterm has a couple of bugs and undocumented features when running
> in slave mode, no doubt because of insufficient testing (it's rarely used).

There aren't many applications that use it (and not just xterm has the bugs).
As a matter of fact I haven't seen any simple ones (barring multixterm which
is on my to-do list).

--

http://dickey.his.com
ftp://dickey.his.com

 
 
 

sending output to xterm ...

Post by Irvine Du » Thu, 10 Oct 2002 13:27:08


Awesome! Awesome! Thanks a lot guys! This worked. So, for future
reference here's what I am doing:

1. in main program:
   openpty() and note the master and slave. I don't care about the
other params right now.

2. in main program:
   fork()

3. in child:
   execl xterm with -Sxx<slave-fd>

4. in parent:
   write to master fd.

And "magically" data appears on the xterm!

Awesome! Thanks for that suggestion on "xx<fd>". That works great.

Thanks!

---------------------------------------------------------------




> >>Want to have this output sent out to an xterm, distinct from the
> >>xterm/shell I started the process from. How do I do it? I would prefer
> >>to use the -Sccn option for this. But, I have been unable to use it
> >>successfully on Linux! Any hints?

> > Create a pty/tty pair and invoke xterm with -Sccn where cc doesn't
> > matter if you are using new-style ptys (which modern Linux does); they
> > can be any two characters. n is the tty file descriptor number. Thus,
> > use xterm -Sxx13 if fd 13 in the child process is the tty descriptor.

> The 'cc' is used in debug-traces, if nothing else...

> > Note that xterm has a couple of bugs and undocumented features when running
> > in slave mode, no doubt because of insufficient testing (it's rarely used).

> There aren't many applications that use it (and not just xterm has the bugs).
> As a matter of fact I haven't seen any simple ones (barring multixterm which
> is on my to-do list).

 
 
 

1. How to send output to an Xterm window

POSTED FOR A FRIEND:
********************
I am trying to open an xterm window from within a C program and send selected
output to that window.  Regular output will still need to be sent to the
window the program was initiated from.

Is there a way to access the window ID so that this is possible?

Any help would be appreciated!!!

:-)

Jennifer Dyson

2. Use of kdm to export XWindows sessions.

3. How Cron job open Xterm window and display outputs to this xterm?

4. : 1280x1024 in 16 colours with a S3 graphiccard?

5. Redirecting output to file and xterm in bash

6. Help for Virtual Private Networks

7. last line of output missing in xterms

8. How to setup PC with Linux AND Win95

9. Minicom+Xterm+8-bit output

10. redirect child output in another xterm window

11. two xterms with same output

12. How do I get all output on xterm console??

13. garbled output in xterm/emacs