home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / OPENSTEP / Networking / msend-3.3-I / malert.m < prev    next >
Encoding:
Text File  |  1997-10-26  |  961 b   |  46 lines

  1. /* $Id: malert.m,v 1.1 1997/10/27 01:02:50 lukeh Exp $ */
  2.  
  3. #if NS_TARGET_MAJOR < 4
  4. #import <libc.h>
  5. #import <appkit/appkit.h>
  6.  
  7. void main(int argc, char*argv[])
  8. {
  9.     printf("\7");
  10.     fflush(stdout);
  11.  
  12.     NXApp = [Application new];
  13.  
  14.     
  15.     if (argc > 2)
  16.         NXRunAlertPanel(argv[1], argv[2], "OK", NULL, NULL);
  17.  
  18.     [NXApp free];
  19.  
  20.     exit(0);
  21. }
  22. #else
  23. #import <Foundation/Foundation.h>
  24. #import <AppKit/AppKit.h>
  25. void main(int argc,char **argv){
  26.     NSAutoreleasePool *puddle = [[NSAutoreleasePool alloc]init];
  27.  
  28.     printf("\7");
  29.     fflush(stdout);
  30.     NSApp = [NSApplication sharedApplication];
  31.     if (argc > 2) {
  32.         id panel = NSGetInformationalAlertPanel([NSString stringWithCString:argv[1]],
  33.             [NSString stringWithCString:argv[2]], @"OK", nil, nil);
  34.         NSModalSession session = [NSApp beginModalSessionForWindow:panel];
  35.         for (;;) {
  36.             if ([NSApp runModalSession:session] != NSRunContinuesResponse)
  37.                  break;
  38.             }
  39.         [NSApp endModalSession:session];
  40.     }
  41.     [puddle release];
  42.     exit(0);
  43. }
  44. #endif
  45.  
  46.