home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / utility / misc / toolmana.lha / ToolManager / Source / WBStartup / ToolManager.c < prev   
Encoding:
C/C++ Source or Header  |  1992-09-26  |  1.9 KB  |  75 lines

  1. /*
  2.  * ToolManager.c  V2.0
  3.  *
  4.  * Start & quit ToolManager
  5.  *
  6.  * (c) 1990-1992 Stefan Becker
  7.  */
  8.  
  9. #include <clib/exec_protos.h>
  10. #include <clib/intuition_protos.h>
  11. #include <clib/locale_protos.h>
  12. #include <clib/toolmanager_protos.h>
  13. #include <stdlib.h>
  14. #include "/locale/toolmanager.h"
  15.  
  16. struct Library *ToolManagerBase; /* Supress DICE auto-open */
  17. struct Library *LocaleBase;
  18. struct EasyStruct es={sizeof(struct EasyStruct),0,"ToolManager",
  19.                       MSG_UTILITIES_QUITREQ_TEXT_STR,
  20.                       MSG_UTILITIES_QUITREQ_GAD_STR};
  21. char *VersionString[]="$VER: ToolManager_Starter 2.0 (26.9.1992)";
  22.  
  23.  
  24. /* CLI entry point */
  25. int main(int argc, char *argv[])
  26. {
  27.  struct Task *t;
  28.  
  29.  /* Find handler task */
  30.  Forbid();
  31.  t=FindTask("ToolManager Handler");
  32.  Permit();
  33.  
  34.  /* Now open library */
  35.  if (ToolManagerBase=OpenLibrary(TMLIBNAME,0)) {
  36.   /* Handler active? Yes, call quit function */
  37.   if (t) {
  38.    struct Catalog *Catalog=NULL;
  39.  
  40.    /* Try to open locale.library */
  41.    if (LocaleBase=OpenLibrary("locale.library",38)) {
  42.  
  43.     /* Try to get catalog for current language */
  44.     if (Catalog=OpenCatalog(NULL,"toolmanager.catalog",
  45.                             OC_BuiltInLanguage, "english",
  46.                             OC_Version,         2,
  47.                             TAG_DONE)) {
  48.      /* Get translation strings */
  49.      es.es_TextFormat=GetCatalogStr(Catalog,MSG_UTILITIES_QUITREQ_TEXT,
  50.                                     es.es_TextFormat);
  51.      es.es_GadgetFormat=GetCatalogStr(Catalog,MSG_UTILITIES_QUITREQ_GAD,
  52.                                       es.es_GadgetFormat);
  53.     }
  54.    }
  55.  
  56.    /* Show requester */
  57.    if (EasyRequestArgs(NULL,&es,NULL,NULL)) QuitToolManager();
  58.  
  59.    /* Free locale stuff */
  60.    if (LocaleBase) {
  61.     if (Catalog) CloseCatalog(Catalog);
  62.     CloseLibrary(LocaleBase);
  63.    }
  64.   }
  65.   CloseLibrary(ToolManagerBase);
  66.  }
  67.  exit(0);
  68. }
  69.  
  70. /* WB entry point */
  71. int wbmain(struct WBStartup *wbs)
  72. {
  73.  return(main(0,0));
  74. }
  75.