home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 11 / 11.iso / n / n002 / 4.ddi / DEMOS.ZIP / XCSTATUS.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-16  |  2.5 KB  |  80 lines

  1. /*
  2.     xcstatus.c  - XCOMMS TSR status program 
  3.  
  4.     Executing XCSTATUS.EXE will report the status of the 
  5.     TSR version of XCOMMS resident program.  DO NOT EXECUTE
  6.     WITH THE BUNDLED XCOMMS KERNAL!
  7.  
  8.     To execute, execute the following:
  9.         C>XCSTATUS
  10.           --------
  11.  
  12.     (C) Copyright 1989, South Mountain Software Incorporated
  13.     All Rights Reserved
  14.  
  15. */
  16.  
  17. #include    "xc.h"
  18. extern long xc_test();                  /* All others are int's */
  19. extern unsigned int  xc_vectr;          /* The resultant XCOMMS vector */
  20.  
  21. char    copyr[] = "(C) Copyright 1991 South Mountain Software, Inc.\n";
  22.  
  23. main()
  24. {
  25.     int  major_rev, minor_rev;
  26.     int  total_buffers, buffers_avail;
  27.     char string1[22], string2[22];
  28.     int  ports;
  29.     int  i;
  30.  
  31.     if (xc_entr(1) == 0) {
  32.         xc_vers(&major_rev, &minor_rev, &total_buffers, &buffers_avail);
  33.         printf("\nXCSTATUS - XCOMMS status summary\n");
  34.         printf("Revision of XCOMMS is %d.%d,  ", major_rev, minor_rev);
  35.         printf("vector is %x hex\n\n", xc_vectr);
  36.         printf("%d Buffers allocated by XCOMMS\n", total_buffers);
  37.         printf("%d Buffers currently used\n", total_buffers - buffers_avail);
  38.         printf("%d Buffers currently available\n\n", buffers_avail);
  39.         printf("Maximum number of ports=%d\n", ports = xc_gport());
  40.  
  41.         printf("Ctrl-Break monitoring is ");
  42.         if (xck_stat())
  43.             printf("enabled\n");
  44.         else 
  45.             printf("disabled\n");
  46.         printf("Timer services are ");
  47.         if (xct_stat())
  48.             printf("enabled\n\n");
  49.         else 
  50.             printf("disabled\n\n");
  51.  
  52.             for (i = 0; (i < ports); ++i) {
  53.                 printf("COM%1d = ", i + 1);
  54.                 if (xc_tport(i) == 1) {
  55.                     printf("Not installed");
  56.                 } else {
  57.                     if (xc_stat(i)) 
  58.                         printf( "Interrupt driven, ");
  59.                     else
  60.                         printf( "Polled, ");
  61.                 printf("Received %ld bytes, ", xc_test(i));
  62.                 printf("Signals are ");
  63.                 if (xc_dtr(i, 2)) 
  64.                     printf("DTR ");
  65.                 if (xc_rts(i, 2)) 
  66.                     printf("RTS ");
  67.                 if (xc_dcd(i)) 
  68.                     printf("DCD ");
  69.                 if (xc_cts(i)) 
  70.                     printf("CTS ");
  71.                 if (xc_dsr(i)) 
  72.                     printf("DSR ");
  73.             }
  74.             printf("\n");
  75.         }
  76.     } else 
  77.         printf("XCOMMS is not installed???\n");
  78. }
  79.  
  80.