home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 300-399 / ff353.lzh / AztecArp / wbparse.c < prev   
C/C++ Source or Header  |  1990-06-02  |  1KB  |  57 lines

  1. /* Copyright (C) 1986,1987 by Manx Software Systems, Inc. */
  2.  
  3. /*
  4.  *    This routine is called from the _main() routine and is used to
  5.  *    open a window for standard I/O to use. The window is actually
  6.  *    defined by setting the ToolType, "WINDOW", to the desired window
  7.  *    specification. If this is not required, this routine may be
  8.  *    replaced by a stub in the users main program. Note that even if
  9.  *    this code is called by _main(), if the WINDOW tool type is not
  10.  *    defined, there will be no window.
  11.  *
  12.  *    EXAMPLE:    WINDOW=CON:0/0/640/200/Test Window
  13.  */
  14.  
  15. /* tweeked to handle v1.4 wbench startup */
  16.  
  17. void *IconBase;
  18.  
  19. _wb_parse(struct Process *pp,struct WBStartup *wbm)
  20. {
  21.     char *cp;
  22.     struct DiskObject *dop;
  23.     struct FileHandle *fhp;
  24.     BPTR wind;
  25.  
  26.     if (IconBase = OpenLibrary("icon.library", 0L))
  27.     {
  28.         if (dop = GetDiskObject(wbm->sm_ArgList->wa_Name))
  29.         {
  30.             if (cp = FindToolType(dop->do_ToolTypes, "WINDOW"))
  31.             {
  32.                 if (wind = Open(cp, MODE_OLDFILE))
  33.                 {
  34.                     fhp = (struct FileHandle *) (wind << 2);
  35.  
  36.                     pp->pr_ConsoleTask = (APTR) fhp->fh_Type;
  37.                     pp->pr_CIS = (BPTR)wind;
  38.                     pp->pr_COS = (BPTR)Open("*", MODE_OLDFILE);
  39.  
  40.                     /* !!! 1.4 tweek */
  41.  
  42.                     _devtab[0].mode &= ~O_STDIO;    /* setup for exit to close these if we succeeded */
  43.                     _devtab[1].mode &= ~O_STDIO;
  44.  
  45.                     /* !!! 1.4 tweek */
  46.                 }
  47.             }
  48.  
  49.             FreeDiskObject(dop);
  50.         }
  51.  
  52.         CloseLibrary(IconBase);
  53.  
  54.         IconBase = 0;
  55.     }
  56. }
  57.