home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / comm / cyberpager-1.5.lha / CyberPager / source / library / spool.c < prev    next >
C/C++ Source or Header  |  1994-02-07  |  917b  |  37 lines

  1. #include "memory.h"
  2.  
  3. STRPTR __saveds __asm NameInSpool(register __a0 PagerHandle_t * ph, register __a1 STRPTR name)
  4. {
  5.     STRPTR location, ptr;
  6.     ULONG allocSize;
  7.  
  8.     if (!name)
  9.         name = "";
  10.  
  11.     location = FindPagerConfigDefault(ph, "SPOOLDIR", "pager:spool");
  12.  
  13.     allocSize = strlen(location) + strlen(name) + 4;
  14.  
  15.     if (ptr = MyAllocVec(allocSize)) {
  16.         strcpy(ptr, location);
  17.         if (name[0])
  18.             AddPart(ptr, name, allocSize);
  19.     }
  20.  
  21.     /*
  22.      * we don't actually call FreePagerConfig(location) here.  this way,
  23.      * the config entry will remain loaded in memory and any subsequent
  24.      * calls the client makes to NameInSpool will not have to re-read the
  25.      * config file to find out where the spool directory is located. when
  26.      * the client calls FreePagerHandle() the config entry for the spool
  27.      * directory will finally go away.
  28.      */
  29.  
  30.     return ptr;
  31. }
  32.  
  33. void __saveds __asm FreeNameInSpool(register __a0 STRPTR name)
  34. {
  35.     MyFreeVec(name);
  36. }
  37.