Article View: comp.sys.amiga.tech
Article #10417Re: problems with forkv (lattice)
From: Fred Fish
Date: Tue, 29 Nov 1988 00:58
Date: Tue, 29 Nov 1988 00:58
75 lines
2530 bytes
2530 bytes
In article <AXYMTny00Uka0DRGpH@andrew.cmu.edu> bader+@andrew.cmu.edu (Miles Bader) writes:
>fnf@fishpond.UUCP (Fred Fish) writes:
>> Forkv only works when the forked program is a C program. This restriction
>> did not make it into the manual, but is apparently in one of the README
>Actually, I can't get it to work with c programs either. I just
>tested it with a really small program that just does "exit(atoi(argv[1]))".
>...
>So my question (why doesn't forkv work?) still stands...
Hmmm... I managed to dig up the test programs I was using when I was
investigating this exact thing, while trying to use forkv to run a subshell
(subcli ???). They are attached to this posting.
To test:
lc -L forkv.c
lc -L echo.c
forkv echo a b c
(this should run the echo program, which should echo it's arguments
and return 123, which gets printed by the forkv program)
forkv newcli
(boom!!! guru ...00004.XXXX...)
=================================== echo.c ===================================
main (argc, argv)
int argc;
char **argv;
{
while (argc-- > 0) {
printf ("%s ", *argv++);
}
printf ("\n");
exit (123);
}
=================================== forkv.c ===================================
/*
* Sample forkv program from Lattice 4.0 manual.
*/
#include "dos.h"
#include "stdio.h"
struct ProcID child;
void main (argc, argv)
int argc;
char *argv[];
{
int ret;
if (argc < 2) {
printf ("no program specified\n");
printf ("usage: fork program [arg1] [arg2] ...\n");
exit (0);
}
printf ("parent: beginning fork of %s\n", argv[1]);
if (forkv (argv[1], &argv[1], NULL, &child) == -1) {
printf ("error forking child\n");
exit (0);
} else {
ret = wait (&child);
}
printf ("parent: %s finished, ret = %d\n", argv[1], ret);
}
======================================================================
Hope this helps to track down the problem.
-Fred
--
# Fred Fish, 1346 West 10th Place, Tempe, AZ 85281, USA
# noao!nud!fishpond!fnf (602) 921-1113
Technical Details
Message-ID:
<168@fishpond.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!pacbell!ames!ncar!noao!asuvax!nud!fishpond!fnfReferences:
<wXY38Sy00Uka8=Ac5B@andrew.cmu.edu> <167@fishpond.UUCP> <AXYMTny00Uka0DRGpH@andrew.cmu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!pacbell!ames!ncar!noao!asuvax!nud!fishpond!fnf From: fnf@fishpond.UUCP (Fred Fish) Newsgroups: comp.sys.amiga.tech Subject: Re: problems with forkv (lattice) Message-ID: <168@fishpond.UUCP> Date: 29 Nov 88 00:58:03 GMT References: <wXY38Sy00Uka8=Ac5B@andrew.cmu.edu> <167@fishpond.UUCP> <AXYMTny00Uka0DRGpH@andrew.cmu.edu> Reply-To: fnf@fishpond.UUCP (Fred Fish) Organization: occasionally Lines: 75