Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!hplabs!hpfcso!hpfelg!koren From: koren@hpfelg.HP.COM (Steve Koren) Newsgroups: comp.sys.amiga.tech Subject: ASyncRun() doesn't work with pipe:xxx! Message-ID: <13920086@hpfelg.HP.COM> Date: 2 Sep 90 16:46:44 GMT Organization: HP Elec. Design Div. -FtCollins Lines: 124 Here's a question for all you tech types. Why doesn't Arp's ASyncRun() call like AmigaDos pipes? I've include a short program at the end of this note. The program simply runs two programs in the background. The standard output of the first one goes to a file named by argv[1], and the standard input of the second one comes from a file named argv[2]. Note that the program wants you to have certain files in ram:. Consider this. I run the program as: mytest ram:out1 ram:in1 where ram:in1 exists. This is like saying, in Un*x: wc blah >out1 & cat pipe:a & cat #include #include #include #include struct ArpBase *ArpBase = NULL; struct ProcessControlBlock pcb; long main(argc, argv) int argc; char *argv[]; { long rc = 0, stack = 4000, pri = 0; /* open arp */ if (ArpBase == NULL) if ((ArpBase = (struct Arpbase *) OpenLibrary("arp.library", 0L)) == NULL) exit(2); pcb.pcb_Input = NULL; pcb.pcb_Output = (BPTR)Open(argv[1], MODE_NEWFILE); pcb.pcb_StackSize = stack; pcb.pcb_Pri = pri; if ((rc = ASyncRun("ram:wc", "ram:blah", &pcb)) < 0) { Printf("%s: unable to execute %s\n", BaseName(argv[0]), "ram:wc"); goto Done; } pcb.pcb_Input = (BPTR)Open(argv[2], MODE_OLDFILE); pcb.pcb_Output = NULL; if ((rc = ASyncRun("ram:cat", "", &pcb)) < 0) { Printf("%s: unable to execute %s\n", BaseName(argv[0]), "ram:cat"); goto Done; } Done: if (rc <= 0) { if (pcb.pcb_Input) Close(pcb.pcb_Input); if (pcb.pcb_Output) Close(pcb.pcb_Output); } CloseLibrary((void *)ArpBase); return(rc); }