home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 13 / MA_Cover_13.bin / source / c / stefanb_src / dospath / src / getset.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-25  |  1.5 KB  |  64 lines

  1. /*
  2.  * getset.c  V1.0
  3.  *
  4.  * Get/Set process path list
  5.  *
  6.  * (c) 1996 Stefan Becker
  7.  */
  8.  
  9. #include "dospath.h"
  10.  
  11. /* Get CLI pointer from a process */
  12. static struct CommandLineInterface *GetProcessCLI(struct Process *pr)
  13. {
  14.  return(
  15.         /* Is the task is a AmigaDOS process? */
  16.         (pr->pr_Task.tc_Node.ln_Type == NT_PROCESS) ?
  17.  
  18.         /* Yes, return pointer to CLI */
  19.         (struct CommandLineInterface *) BADDR(pr->pr_CLI) :
  20.  
  21.         /* No, return NULL */
  22.         NULL);
  23. }
  24.  
  25. __geta4 struct PathListEntry *GetProcessPathList(__A0 struct Process *process)
  26. {
  27.  struct CommandLineInterface *cli;
  28.  struct PathListEntry        *rc  = NULL;
  29.  
  30.  DEBUGLOG(kprintf("Get: Process 0x%08lx Path 0x%08lx\n", process, path);)
  31.  
  32.  /* Get CLI pointer and path list pointer */
  33.  if (cli = GetProcessCLI(process)) rc = BADDR(cli->cli_CommandDir);
  34.  
  35.  DEBUGLOG(kprintf("Get: Result 0x%08lx\n", rc);)
  36.  
  37.  /* Return pointer to path list */
  38.  return(rc);
  39. }
  40.  
  41. __geta4 struct PathListEntry *SetProcessPathList(__A0 struct Process *process,
  42.                                                __A1 struct PathListEntry *path)
  43. {
  44.  struct CommandLineInterface *cli;
  45.  struct PathListEntry        *rc  = NULL;
  46.  
  47.  DEBUGLOG(kprintf("Get: Process 0x%08lx Path 0x%08lx\n", process, path);)
  48.  
  49.  /* Get CLI pointer */
  50.  if (cli = GetProcessCLI(process)) {
  51.  
  52.   /* Get old path list pointer */
  53.   rc = BADDR(cli->cli_CommandDir);
  54.  
  55.   /* Set new path */
  56.   cli->cli_CommandDir = MKBADDR(path);
  57.  }
  58.  
  59.  DEBUGLOG(kprintf("Set: Result 0x%08lx\n", rc);)
  60.  
  61.  /* Return pointer to path list */
  62.  return(rc);
  63. }
  64.