home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d9xx / d958 / alert.lha / Alert / Alert.c < prev    next >
C/C++ Source or Header  |  1993-12-10  |  1KB  |  64 lines

  1. /*
  2.  *    File:                    Alert.c
  3.  *    Description:    Displays given parameter in an standard system-alert.
  4.  *    Version:            1.1
  5.  *    Author:                Ketil Hunn
  6.  *    Mail:                    hunn@dhmolde.no
  7.  *
  8.  *    Copyright © 1993 Ketil Hunn.
  9.  *
  10.  *    In order to list the source-files included in this package properly,
  11.  *    the TAB size should be set at 2.
  12.  *
  13.  *    To compile and link:
  14.  *    sc link optimize nostandardio smallcode smalldata Alert.c
  15.  */
  16.  
  17. #include <stdlib.h>
  18. #include <string.h>
  19. #include <intuition/intuition.h>
  20. #include <clib/intuition_protos.h>
  21. #include <clib/exec_protos.h>
  22. #include "Includes/MyAlert.h"
  23. #include "ENV:current_date.h"
  24.  
  25. #define PROGRAM "Alert"
  26. #define VERSION "V1.1"
  27. char const *version = "$VER: " PROGRAM " " VERSION " (" CURRENT_DATE ")";
  28.  
  29. struct IntuitionBase    *IntuitionBase;
  30.  
  31. main(int argc, char *argv[]) {
  32.     if(IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",33))
  33.     {
  34.         if(argc<2 || !(strcmp(argv[1],"?")))
  35.             MyAlert(RECOVERY_ALERT,
  36.                             PROGRAM " " VERSION "  © 1993 Ketil Hunn\n"
  37.                             "Usage: Alert TEXTLINE/M\n\n"
  38.                             "Each given parameter will appear as one line of text "
  39.                             "in the alert.");
  40.         else
  41.         {
  42.             int i=0;
  43.             char    *text;
  44.  
  45.             if(text=malloc(2400))
  46.             {
  47.                 strcpy(text,argv[1]);
  48.                 for(i=2; i<argc; ++i)
  49.                 {
  50.                     strcat(text,"\n");
  51.                     strcat(text,argv[i]);
  52.                 }
  53.                 MyAlert(RECOVERY_ALERT,text);
  54.                 free(text);
  55.  
  56.             }
  57.             else 
  58.                 MyAlert(RECOVERY_ALERT,"Out of memory!");
  59.         }
  60.         CloseLibrary((struct Library *)IntuitionBase);
  61.     }
  62.     exit(0);
  63. }
  64.