10 #include <sys/types.h> 20 static char *
hmsg =
"hit any key to continue";
35 fp = fopen(
"hpplot",
"wb");
53 "Hit any key to continue, q to abort:");
58 if (stat(
"hpplot",&b)) {
64 fp = fopen(
"hpplot",
"rb");
71 er =
dump((
long) b.st_size,fp);
83 int i, j, k, kk, len, isdev = 0;
85 union {
unsigned short o[2];
long l; } p1;
87 unsigned char mask, chr;
89 if (!fp)
return (
true);
119 fprintf(fp,
"\033*p250X\033*p400Y\033*t100R\033*r1A");
129 for (i = 0; i <
pc.
ysize; i++) {
133 for (j = 0; j <
pc.
xsize; j++) {
135 outp(0x3cd,(cbuf = p1.o[1]) << 4);
138 mask = (mask >> 1) | (mask << 7);
158 fprintf(fp,
"\033*rB\014");
165 for (i = 0; i <
pc.
ysize; i++) {
169 for (k = 0; k < 4; k++) {
170 outpw(0x3ce,k << 8 | 4);
188 fprintf(fp,
"\033*rB\014");
240 if (i & 0x29)
return (
true);
259 if (!buf) buf =
malloc(bsize);
268 sprintf(buf,
"Error: Printer driver %s not found.",
hc_device);
275 if (bsize > size) bsize = size;
283 while (size >= bsize) {
284 fread(buf,bsize,1,fp);
285 for (i = 0; i < bsize; i++)
290 fread(buf,size,1,fp);
291 for (i = 0; i < size; i++)
307 if (!strcmp(device,
"prn") || !strcmp(device,
"lpt1"))
309 else if (!strcmp(device,
"lpt2"))
311 else if (!strcmp(device,
"lpt3"))
313 else if (!strcmp(device,
"lpt4"))
static char buf[MAXPROMPT]
void SetPrinterDevice(char *device)
void PrinterErrmsg(char *msg1, char *msg2)
static char hc_device[10]
Bool PrinterPortStatus(int which)