home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!mips!spool.mu.edu!umn.edu!csus.edu!netcomsv!terapin!paulk
- From: paulk@terapin.com (Paul Kienitz)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Using System() when started from Workbench -- path?
- Message-ID: <paulk.0wj4@terapin.com>
- Date: 26 Jul 92 18:12:09 GMT
- Article-I.D.: terapin.paulk.0wj4
- References: <0ePirjO00WB6AL40NI@andrew.cmu.edu>
- Organization: BBS
- Lines: 30
-
- > Does someone have a simple example of getting the path from the
- > Workbench process so I can feed it to System()?
-
- My program CLImax does this, though it's a 1.3-ish program. Lemme
- look at the source ...
-
- BPTR CopyPath(tass) char *tass;
- {
- struct Process *wb = (void *) FindTask(tass);
- struct CommandLineInterface *wbclap;
- BPTR *wext, *mext, *lastmext, newpath = 0;
-
- lastmext = &newpath;
- if (!wb) return 0;
- if (!(wbclap = BADDR(wb->pr_CLI)))
- return 0;
- for (wext = BADDR(wbclap->cli_CommandDir); wext; wext = BADDR(*wext)) {
- if (!(mext = AllocP(2 * sizeof(BPTR))))
- break;
- *lastmext = (long) mext >> 2;
- lastmext = mext;
- mext[1] = DupLock(wext[1]);
- mext[0] = 0;
- }
- return (newpath);
- }
-
-
- This will return a duplicate path given the name of a task to copy it from,
- e.g. "Workbench".
-