Category : Recently Uploaded Files
Archive   : SNIP9503.ZIP
Filename : PRTSTAT.C

 
Output of file : PRTSTAT.C contained in archive : SNIP9503.ZIP
/*
** PRTSTAT.H - Header file for PRTSTAT.C
*/

#ifndef PRTSTAT_H
#define PRTSTAT_H

struct PrStatus {
unsigned int timeout : 1;
unsigned int unused : 2;
unsigned int IOerror : 1;
unsigned int selected : 1;
unsigned int paperout : 1;
unsigned int ack : 1;
unsigned int notbusy : 1;
};

int prtstat(unsigned int);

#endif

/*** End of PRTSTAT.H *******************************************************/

/*
** PRTSTAT.C - Determine printer status
**
** public domain by Bob Stout
*/

#include

#ifndef PRTSTAT_H
#include "prtstat.h"
#endif

/*
** prtstat() - Call with printer number (0 = LPT1, 1 = LPT2, 2 = LPT3)
**
** Returns status which can be mapped to a PrStatus struct
*/

int prtstat(unsigned int printer_no)
{
union REGS regs;

regs.h.ah = 2;
regs.x.dx = printer_no;
int86(0x17, ®s, ®s);
return regs.h.ah;
}

#ifdef TEST

#include

#define show(x) printf(#x" is %strue (LPT1)\n", mystat.x ? "" : "not ");

main()
{
struct PrStatus mystat;

*((int *)&mystat) = prtstat(0);
show(notbusy);
show(selected);
show(paperout);
return 0;
}

#endif


  3 Responses to “Category : Recently Uploaded Files
Archive   : SNIP9503.ZIP
Filename : PRTSTAT.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/