drew@cgfsv1.dec.com (Steve Drew) (09/26/86)
>In reply to Graeme Clark -- Dept. of Computer Science, Univ. of Toronto. >> Has anyone successfully used the functions fexecl() and fexecv() >> in the Manx (3.20a) library? When I use them, fexecl() gurus whenever >> I call it, and fexecv() does so occasionally. Is it me? I stuck my neck out and said this: > I have successfully used the fexecv function (alot) and so far no problems. > Make sure you call it somewhat like this: Well I spoke too soon. I had used it a lot with no problem HOWEVER I had'nt tried the TYPE command. fexec'ing the TYPE command twice in a row will bring up a GURU everytime. But don't panic, I FOUND A WORK AROUND. I wrote a little program to dump the Task and Process stuctures before and after executing fexecv() and I tried most of the C: commands, the only one that poked at these structures was the TYPE command. It looks like it changed pr_CIS (current input stream) to be a file handle of the file you specified it to type. It then closes this file handle but leaves pr_CIS pointing to this old File handle. So when you run fexecv() again it goes to push the command line into the CIS stream buffer of this close file handle. Result GURU. At this point I made a few assumptions: the cli_Module code that normally calls programs must reset the CIS/COS after there complete, it also must be responsible to open the redirection files and put their file handles in CIS/COS before calling. How does it reset them you ask? It has a copy of the StandardIn/out file handles in the CLI structure so why not add a few lines of code to reset CIS/COS after calling fexec(). I DID AND NO MORE GURU's. (from memory) do something like the following: main(argc, argv) char *argv[]; { struct Process *pr, *FindTask(); struct CommandLineInterface *cli; pr = FindTask(0L); cli = (struct CommandLineInterface *) ((long)pr->CLI << 2); argv[argc] = '\0'; fexecv(argv[1], &argv[1]); /* reset COS/CIS */ pr->pr_COS = cli->cli_StandardOutput; pr->pr_CIS = cli->cli_StandardInput; } Hope this helps. (let me know) Steve Drew at ENET: CGFSV1::DREW ARPA: drew%cfgsv1.dec.com@decwrl.dec.com USENET: {decvax!decwrl}!cgfsv1.dec.com!drew