home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / PRTSTAT.C < prev    next >
C/C++ Source or Header  |  1997-07-05  |  814b  |  47 lines

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /*
  4. **  PRTSTAT.C - Determine printer status
  5. **
  6. **  public domain by Bob Stout
  7. */
  8.  
  9. #include "sniprint.h"
  10.  
  11. #include <dos.h>
  12.  
  13. /*
  14. **  prtstat() - Call with printer number (0 = LPT1, 1 = LPT2, 2 = LPT3)
  15. **
  16. **  Returns status which can be mapped to a PrStatus struct
  17. */
  18.  
  19. int prtstat(unsigned int printer_no)
  20. {
  21.       union REGS regs;
  22.  
  23.       regs.h.ah = 2;
  24.       regs.x.dx = printer_no;
  25.       int86(0x17, ®s, ®s);
  26.       return regs.h.ah;
  27. }
  28.  
  29. #ifdef TEST
  30.  
  31. #include <stdio.h>
  32.  
  33. #define show(x) printf(#x" is %strue (LPT1)\n", mystat.x ? "" : "not ");
  34.  
  35. main()
  36. {
  37.       struct PrStatus mystat;
  38.  
  39.       *((int *)&mystat) = prtstat(0);
  40.       show(notbusy);
  41.       show(selected);
  42.       show(paperout);
  43.       return 0;
  44. }
  45.  
  46. #endif /* TEST */
  47.