home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / amiga / programm / 11659 < prev    next >
Encoding:
Internet Message Format  |  1992-07-26  |  1.3 KB

  1. Path: sparky!uunet!charon.amdahl.com!pacbell.com!mips!spool.mu.edu!umn.edu!csus.edu!netcomsv!terapin!paulk
  2. From: paulk@terapin.com (Paul Kienitz)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Using System() when started from Workbench -- path?
  5. Message-ID: <paulk.0wj4@terapin.com>
  6. Date: 26 Jul 92 18:12:09 GMT
  7. Article-I.D.: terapin.paulk.0wj4
  8. References: <0ePirjO00WB6AL40NI@andrew.cmu.edu>
  9. Organization: BBS
  10. Lines: 30
  11.  
  12. > Does someone have a simple example of getting the path from the
  13. > Workbench process so I can feed it to System()?
  14.  
  15. My program CLImax does this, though it's a 1.3-ish program.  Lemme
  16. look at the source ...
  17.  
  18.   BPTR CopyPath(tass) char *tass;
  19.   {
  20.       struct Process *wb = (void *) FindTask(tass);
  21.       struct CommandLineInterface *wbclap;
  22.       BPTR *wext, *mext, *lastmext, newpath = 0;
  23.  
  24.       lastmext = &newpath;
  25.       if (!wb) return 0;
  26.       if (!(wbclap = BADDR(wb->pr_CLI)))
  27.           return 0;
  28.       for (wext = BADDR(wbclap->cli_CommandDir); wext; wext = BADDR(*wext)) {
  29.           if (!(mext = AllocP(2 * sizeof(BPTR))))
  30.               break;
  31.           *lastmext = (long) mext >> 2;
  32.           lastmext = mext;
  33.           mext[1] = DupLock(wext[1]);
  34.           mext[0] = 0;
  35.       }
  36.       return (newpath);
  37.   }
  38.  
  39.  
  40. This will return a duplicate path given the name of a task to copy it from,
  41. e.g. "Workbench".
  42.