static int prn_flush(gx_device_printer *pdev) { if(is_printer(pdev)) return 0; return fflush(pdev->file); }
static int prn_putc(gx_device_printer *pdev, int c) { if(is_printer(pdev)) { pc98_prn_out(c); return 0; } return fputc(c, pdev->file); }
static int prn_write(gx_device_printer *pdev, char *ptr, int size) { if(is_printer(pdev)) { while(size --) pc98_prn_out(*ptr ++); return size; } return fwrite(ptr, 1, size, pdev->file); }
static int prn_puts(gx_device_printer *pdev, char *ptr) { if(is_printer(pdev)) { while(*ptr) pc98_prn_out(*ptr ++); return 0; } return fputs(ptr, pdev->file); }
/* Close the connection to the printer. */ void gp_close_printer(FILE * pfile, const char *fname) { fclose(pfile); if (!is_printer(fname)) return; /* a file, not a printer */ gp_printfile(win_prntmp, fname); unlink(win_prntmp); }
/* Return NULL if the connection could not be opened. */ FILE * gp_open_printer(char fname[gp_file_name_sizeof], int binary_mode) { if (is_printer(fname)) { FILE *pfile; /* Open a scratch file, which we will send to the */ /* actual printer in gp_close_printer. */ pfile = gp_open_scratch_file(gp_scratch_file_name_prefix, win_prntmp, "wb"); return pfile; } else if (fname[0] == '|') /* pipe */ return popen(fname + 1, (binary_mode ? "wb" : "w")); else if (strcmp(fname, "LPT1:") == 0) return NULL; /* not supported, use %printer%name instead */ else return fopen(fname, (binary_mode ? "wb" : "w")); }