home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / TELECOM / OSKBox.lzh / MAILBOX / CC / evstat.c < prev    next >
C/C++ Source or Header  |  1988-06-09  |  981b  |  56 lines

  1. #include <stdio.h>
  2. #include <module.h>
  3. #include <events.h>
  4. #include <signal.h>
  5.  
  6. char *sign (i)
  7. {
  8.     static char str[10];
  9.     
  10.     sprintf (str, "%d", i);
  11.     if (i > 0) {
  12.         movmem (str, str+1, strlen (str) + 1);
  13.         str[0] = '+';
  14.         }
  15.     while (strlen (str) < 3) {
  16.         movmem (str, str+1, strlen (str) + 1);
  17.         str[0] = ' ';
  18.         }    
  19.     return (str);
  20.     }
  21.  
  22. movmem (from, to, count)
  23. register char *from, *to;
  24. register int count;
  25. {
  26.     if (from > to)
  27.         while (count--)
  28.             *to++ = *from++;
  29.     else {
  30.         from += count;
  31.         to += count;
  32.         while (count--)
  33.             *--to = *--from;
  34.         }
  35.     }                
  36.  
  37. main ()
  38. {
  39.     int ev;
  40.     event info;
  41.     char str1[10], str2[10];
  42.         
  43.     printf ("Event  Name            Value  Wait  Sig.  Link\n");
  44.     ev = 0;
  45.     ev = _ev_info (ev, &info) + 1;
  46.     while (ev) {
  47.         strcpy (str1, sign (info._ev_winc));
  48.         strcpy (str2, sign (info._ev_sinc));
  49.         printf (" %2d    %-11.11s      %3d   %s   %s    %2d\n",
  50.             info._ev_eid, info._ev_name, info._ev_value,
  51.             str1, str2, info._ev_link);
  52.         ev = _ev_info (ev, &info) + 1;
  53.         }
  54.     }
  55.  
  56.