Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!texbell!sugar!peter From: peter@sugar.hackercorp.com (Peter da Silva) Newsgroups: comp.sys.amiga.tech Subject: Re: Using PIP: Keywords: dupping closing pipes Message-ID: <4689@sugar.hackercorp.com> Date: 7 Dec 89 13:17:48 GMT References: <1610.AA1610@julie> Reply-To: peter@sugar.hackercorp.com (Peter da Silva) Organization: Sugar Land Unix - Houston Lines: 74 In article <1610.AA1610@julie> mcr@julie.UUCP (Michael Richardson) writes: > When I finally got annoyed at the silliness of command line > passing, program launching (with exit codes) and the pr_CLI structure > in general [this was at least 6 months ago] I began to build an > alternate launching scheme, much more similar to the way the > workbench startup message works. Good for you. > I based it on Leo Shwab's wblaunch > code. Leo's? Not mine? What's Leo's look like? > In order deal with who closes file descriptors, etc.. I wound > up passing a bitmap to the sub-process telling it which file handles > it can close. Where in the Startup message? > [Actually, I can also pass the `ToolWindow' field, > and although I haven't done it yet, I always put 0 in the place > where the Workbench message's `number of arguments' is so I could > in fact be launched from Workbench...] What's the point of this? Workbench will pass variable numbers of arguments, and usually at least one (dirlock & name of the program itself). > I'd like this field eventually > to be $ffffffff. (I can pass any number of FileHandles though. > They are installed in the Manx `_devtab' structure.) More details, please. > if((pin=AllocMem(sizeof(struct FileHandle),MEMF_PUBLIC|MEMF_CLEAR))==NULL) { > return(NULL); > } > if((pout=Open("PIP:4096",2000L))==NULL) { > FreeMem(pin,sizeof(struct FileHandle)); > return(NULL); > } > temp=(struct FileHandle*)BTOC(pout); > (*pin)=(*temp); > pin=(struct FileHandle*)CTOB(pin); You're copying the file handles? Interesting. I wouldn't have expected that to work... I don't think there's any guarantee of that. (too bad there's no DupFH call. Commodore? Are you there Commodore? How about for 1.4?) > BTW: Programs compiled with the Rogue Startup code can continue to run > from CLI, and if I ever make the WorkBench modification from the workbench > as well. Sounds good. Where's the code? > The rewrite of the rest [and the posting to Bob Page] awaits pipes > so that I can get rid of some of the temporary files. I don't like > temporary files. Why don't you do this? sprintf(PipeName, "%s:rogue%dpipe%d", PipeDevice, ProcessId, Sequence++); pin = Open(PipeName, MODE_NEWFILE); pout = Open(PipeName, MODE_OLDFILE); This way you won't have to depend on anyone having PIP:, and won't be playing unportable games... -- Peter "Have you hugged your wolf today" da Silva `-_-' 'U` "Really, a video game is nothing more than a Skinner box." -- Peter Merel