home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 493.lha / OnTrap / cxtrap.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-04-06  |  1.4 KB  |  52 lines

  1. #include <exec/types.h>
  2. #include <intuition/intuition.h>
  3. #include <proto/exec.h>
  4. #include <proto/intuition.h>
  5.  
  6. static struct IntuiText Text2 = {-1,-1,    /* pen numbers */
  7.                  0,        /* draw mode */
  8.                  14,14,    /* starting offsets */
  9.                  NULL,    /* text attribute pointer */
  10.                  "***> Trap Abort !!!! <***",
  11.                  NULL };
  12.  
  13. static struct IntuiText BodyText = {-1,-1,    /* pen numbers */
  14.                  0,        /* draw mode */
  15.                  4,4,    /* starting offsets */
  16.                  NULL,    /* text attribute pointer */
  17.                  NULL,
  18.                  &Text2 };
  19.  
  20. static struct IntuiText AbortText = {-1,-1,    /* pen numbers */
  21.                  0,        /* draw mode */
  22.                  4,4,    /* starting offsets */
  23.                  NULL,    /* text attribute pointer */
  24.                  "ABORT",
  25.                  NULL };
  26.  
  27. extern char *_ProgramName;
  28.  
  29. /**
  30. *
  31. * name        CXTRAP  - trap exception handler
  32. *
  33. * synopsis    CXTRAP();
  34. *
  35. * description    This function is the default function trap handler
  36. *        WARNING: Does not clean up. A user function must be defined
  37. *        for releasing memory and system resources.
  38. **/
  39. CXTRAP()
  40.    {
  41.    char temp[80];
  42.  
  43.    if (IntuitionBase == NULL)
  44.       IntuitionBase = (struct IntuitionBase *)
  45.                        OpenLibrary("intuition.library",0);
  46.    memcpy(temp, _ProgramName, (long) _ProgramName[-1]);
  47.    temp[(int) _ProgramName[-1]] = '\0';
  48.    BodyText.IText = temp;
  49.    if (AutoRequest(NULL,&BodyText,NULL,&AbortText,0,0,250,60) != TRUE) return(-1);
  50.    return(0);
  51. }
  52.