XForms: [Fwd: [Fwd: BOUNCE xforms@bob.usuhs.mil: Non-member submission from (fwd)fl_exe_command

controltech (joel@bamboo.verinet.com)
Wed, 7 Jul 1999 09:36:27 -0600 (MDT)

# To subscribers of the xforms list from controltech <joel@bamboo.verinet.com> :

> Ravi Mehrotra wrote:
> >
> > # To subscribers of the xforms list from Ravi Mehrotra <ravi@csnpl.ren.nic.in> :
> >
> > Hi,
> >
> > I do not quite know how fl_exe_command works. The following piece of code
> > gives me problems. I am using XForms 0.89 on a Pentium Pro machine running
> > Linux 2.0.35.
> >
> > /*--------------------Problem Code---------------------------*/
> >
> > #define NONBLOCK 0
> > #define BLOCK 1
> >
> > long pid;
> > FL_OBJECT *status;
> >
> > pid=fl_exe_command("mcopy -n a:file", NONBLOCK);
> > for (;;) {
> > fl_addto_browser_chars(status,".");
> > if (fl_check_command(pid) < 1) {
> > fl_end_command(pid);
> > break;
> > }
> > sleep(1);
> > }
> >
>
I had a simular problem, the way to make it work is to do,

#include <sys/types.h>
#include <sys/wait.h>

..... /* your stuff */

pid_t killpid; /* maybe a long on your system */
int stat;

..... /* your stuff */

pid = fl_exe_command("mcopy -n a:file", NONBLOCK);

while(( killpid = waitpid(pid,&stat,WNOHANG)) == 0)
{
fl_addto_browser_chars(status,".");
sleep(1);
}

fl_end_command(pid);

..... /* your stuff */

Joel

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