home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 595.lha / MountStuff / EStartup / EStartup.c next >
C/C++ Source or Header  |  1990-10-17  |  2KB  |  77 lines

  1.  
  2. #include <exec/types.h>
  3. #include "hh:template.h"
  4. #define L_V ((LONG)LIBRARY_VERSION)
  5.  
  6. #ifndef _CDECL
  7. #define _CDECL(a) ()
  8. #endif
  9.  
  10. BYTE *Custom = (BYTE *)0x00FFD000L;
  11.  
  12. struct DosBase   *DosBase             = NULL ;
  13. struct ExecBase  *ExecBase            = NULL ;
  14. struct Intuition *IntuitionBase       = NULL ;
  15. struct GfxBase   *GfxBase             = NULL ;
  16.  
  17. extern struct Library *OpenLibrary  _CDECL((TEXT *, ULONG));
  18. extern VOID            CloseLibrary _CDECL((struct Library *));
  19. extern VOID            program      _CDECL((ULONG, TEXT **));
  20. extern VOID            exit         _CDECL((LONG));
  21.  
  22. VOID main _CDECL((int, TEXT **));
  23. VOID quit _CDECL((LONG));
  24.  
  25.  
  26.  VOID
  27. main(argc,argv)
  28.  int argc;
  29.  TEXT *argv[];
  30. {
  31.  if (!(DosBase=(struct DosBase *)OpenLibrary("dos.library",L_V))) {
  32.     puts("Could not open dos.library!");
  33.     quit(0L);
  34.  }
  35.  if (!(ExecBase=(struct ExecBase *)OpenLibrary("exec.library",L_V))) {
  36.     puts("Could not open exec.library!");
  37.     quit(0L);
  38.  }
  39.  if (!(IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",L_V))) {
  40.     puts("Could not open intuition.library!");
  41.     quit(0L);
  42.  }
  43.  if (!(GfxBase=(struct GfxBase *)OpenLibrary("graphics.library",L_V))) {
  44.     puts("Could not open graphics.library!");
  45.     quit(0L);
  46.  }
  47.  if (FetchTemplate((LONG)argc,argv)) {
  48.     program((LONG)argc,argv);
  49.  } else {
  50.     quit(5L);
  51.  }
  52.  quit(0L);
  53. }
  54.  
  55.  
  56.  VOID
  57. quit(value)
  58.  LONG value;
  59. {
  60.  ReleaseTemplate();
  61.  if (GfxBase) {
  62.     CloseLibrary((struct Library *)GfxBase);
  63.  }
  64.  if (IntuitionBase) {
  65.     CloseLibrary((struct Library *)IntuitionBase);
  66.  }
  67.  if (ExecBase) {
  68.     CloseLibrary((struct Library *)ExecBase);
  69.  }
  70.  if (DosBase) {
  71.     CloseLibrary((struct Library *)DosBase);
  72.  }
  73.  exit((int)value);
  74. }
  75.  
  76.  
  77.