home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / softsys / andrew / 1170 next >
Encoding:
Text File  |  1992-08-25  |  2.1 KB  |  89 lines

  1. Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!parc.xerox.com!janssen
  2. From: janssen@parc.xerox.com (Bill Janssen)
  3. Newsgroups: comp.soft-sys.andrew
  4. Subject: Re: More checks on size of ATK applications
  5. Message-ID: <seaba7UB0KGW82AmJK@holmes.parc.xerox.com>
  6. Date: 25 Aug 92 18:18:47 GMT
  7. References: <EeZ=xSq__5g8Ei1nVN@cs.city.ac.uk>
  8. Sender: daemon@ucbvax.BERKELEY.EDU
  9. Distribution: world
  10. Organization: The Internet
  11. Lines: 76
  12.  
  13. Excerpts from ext.andrew: 21-Aug-92 More checks on size of ATK .. Nick
  14. Williams@cs.city.ac (1088+0)
  15.  
  16. > Hence the 900 odd K of runapp could be cut down fairly massively.
  17.  
  18. > Am I wrong?
  19.  
  20. Not at all.  Here's my 24K (SunOS 4.1.1, SPARC) version of EZ:
  21.  
  22.     #include <stdio.h>
  23.  
  24.     #include <class.h>
  25.     #include <im.ih>
  26.     #include <buffer.ih>
  27.     #include <frame.ih>
  28.  
  29.     #ifndef _XLIB_H_
  30.     #define Window unsigned long
  31.     #define Display char
  32.     #endif
  33.     #include <xim.ih>
  34.  
  35.     main (ac, av)
  36.          int ac;
  37.          char **av;
  38.     {
  39.       struct xim *xim;
  40.       Window window;
  41.       struct buffer *buffer;
  42.  
  43.       initclass();
  44.  
  45.       im_SetProgramName("edit");        /* if this isn't done,
  46.     im_Create() will core-dump.  Dumb.  */
  47.  
  48.       window = atoi(av[1]);
  49.       buffer = buffer_GetBufferOnFile (av[2], 0);
  50.       xim = xim_New();
  51.       if (!xim_CreateWindow (xim, "localhost"))
  52.         exit(1);
  53.       xim_SetView (xim, frame_Create(buffer));
  54.       im_KeyboardProcessor();
  55.       exit (0);
  56.     }
  57.  
  58.     static initclass ()
  59.     {
  60.     #if ((sun)&&(sparc))
  61.  
  62.     #include <sys/fcntl.h>      /* for O_RDWR */
  63.  
  64.       {
  65.         int fd;
  66.  
  67.         /*
  68.          * XXX - force "/dev/zero" to be open as a file descriptor one
  69.          * greater than the first available one, as a workaround for a
  70.          * 4.1 bug (also present in 4.1.1) in the run-time loader.
  71.          * (Fixed in System V Release 4, allegedly.)
  72.          */
  73.  
  74.         printf ("doing fix for SunOS 4.1...\n");
  75.  
  76.         fd = open("/dev/zero", O_RDWR);
  77.         dup(fd);                        /* one greater */
  78.         close(fd);
  79.       }
  80.     #endif
  81.  
  82.       class_Init(AndrewDir("/dlib/atk"));
  83.     }
  84.  
  85.  
  86. Link it with libclass.a and libutil.a...
  87.  
  88. Bill
  89.