Re: XForms: launching X applications

Jim Clark (jim@gnosis.chem.queensu.ca)
Fri, 5 Sep 1997 18:35:08 -0400 (EDT)

To subscribers of the xforms list from Jim Clark <jim@gnosis.chem.queensu.ca> :

On Thu, 4 Sep 1997, Steve Lamont wrote:

> To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :
>
> > I just want to include a button on one of my forms that runs an external X
> > program. I have a callback function attached to this button that just
> > forks a new process and runs the application in this child process.
> > Unfortunately, the child process can't open the X display for some reason.
> > If, I were to try to run xv for instance, I would get an error like "xv
> > can't open display" or something.
>
> The exact error message would be helpful. You might check to see if
> the DISPLAY environment variable is passed correctly.

The exact message is "xv: Can't open display"

>
> This worked perfectly for me in an admittedly quick test:
>
> void launch_cb(FL_OBJECT *ob, long data)
> {
>
> if ( fork() == 0 )
> execl( "/usr/X11R6.1/bin/xv", "xv", NULL );
>
> }
>

Weirdly, this does not work on my system. I can use a system() call with
no problem but the fork() followed by an execl() does not work. My
understanding is that execl() passes the **environ pointer on to the child
process automatically so the xv application should no what DISPLAY to use.

I also explicitly passed the -display :0 parameter to the the xv
program but that also ended up with a "xv: Can't open display" message. I
guess I'm still stumped.

Anyway, thanks for all the suggestion, I'll goof around some more
and see what I can come up with. JIM

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/