home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d179 / launch.lha / Launch / wbfree.c < prev    next >
C/C++ Source or Header  |  1989-02-25  |  1KB  |  40 lines

  1. #include <exec/memory.h>
  2. #include <workbench/startup.h>
  3. #include <workbench/workbench.h>
  4.  
  5. FreeStartup(msg)
  6. struct WBStartup *msg;
  7. {
  8.     /* Free the files. Assumes they have been allocated via Launch, so
  9.      * they're just AllocMemmed. UnLock all the Locks, and Free the
  10.      * names.
  11.      */
  12.     if(msg->sm_ArgList) {
  13.         int i;
  14.         for(i = 0; i < msg->sm_NumArgs; i++) {
  15.             if(msg->sm_ArgList[i].wa_Lock)
  16.                 UnLock(msg->sm_ArgList[i].wa_Lock);
  17.             if(msg->sm_ArgList[i].wa_Name)
  18.                 FreeMem(msg->sm_ArgList[i].wa_Name,
  19.                     strlen(msg->sm_ArgList[i].wa_Name)+1);
  20.         }
  21.         FreeMem(msg->sm_ArgList,
  22.             sizeof(struct WBArg) * msg->sm_NumArgs);
  23.     }
  24.  
  25.     /* Here goes the program...
  26.      */
  27.     if(msg->sm_Segment)
  28.         UnLoadSeg(msg->sm_Segment);
  29.  
  30.     /* And the name of the window. Again, assuming it's allocated by
  31.      * Launch, so it just fits in its AllocMemmed buffer.
  32.      */
  33.     if(msg->sm_ToolWindow)
  34.         FreeMem(msg->sm_ToolWindow,
  35.             strlen(msg->sm_ToolWindow)+1);
  36.  
  37.     /* And finally the message itself */
  38.     FreeMem(msg, sizeof(struct WBStartup));
  39. }
  40.