18 fprintf(
cp_out,
"%s\n", instr);
32 char *sif =
"%s saved in file \"%s\"";
35 sprintf(buf,
"Printing %s on the %s printer", fname, device);
38 #ifdef SYSTEM_PLOT5LPR 39 if (!strcmp(devtype,
"plot5")) {
40 (void) sprintf(buf, SYSTEM_PLOT5LPR, device, fname);
47 if (!strcmp(devtype,
"postscript")) {
48 (void) sprintf(buf, SYSTEM_PSLPR, device, fname);
53 if (!strcmp(devtype,
"laser")) {
54 (void) sprintf(buf,
"PCL not supported yet");
58 if (!strcmp(devtype,
"text")) {
59 (void) sprintf(buf,
"lpr -h -P%s %s", device, fname);
66 if (!strcmp(devtype,
"plot5")) {
67 sprintf(buf, sif,
"Unix \"plot(1)\"", fname);
69 else if (!strcmp(devtype,
"postscript")) {
70 sprintf(buf, sif,
"Postscript image", fname);
72 else if (!strcmp(devtype,
"laser")) {
73 sprintf(buf, sif,
"PCL image", fname);
75 else if (!strcmp(devtype,
"text")) {
76 sprintf(buf, sif,
"Text", fname);
91 static void errmsg(
GRAPH*,
char*,
char*);
92 static int port_status(
int);
97 static int port_status();
102 static char *
hmsg =
"hit any key to continue";
141 for (i = 0; i < 8 &&
device[i] &&
device[i] !=
'.'; i++)
145 for (j = 0, i++; j < 3 &&
device[i]; i++, j++)
146 hc_device[i] = device[i];
156 while (port_status(hc_port)) {
157 errmsg(
graph,
"Error: Printer is not accessible.",
158 "Hit any key to continue, q to abort:");
164 if (stat(fname,&b)) {
165 sprintf(buf,
"Error: File \"%s\", can't stat.\n",fname);
172 fp = fopen(fname,
"rb");
174 sprintf(buf,
"Error: File \"%s\" not found.\n",fname);
180 er =
dump(
graph,hc_device,(
long) b.st_size,fp);
188 if (
eq(devtype,
"plot5")) {
189 sprintf(buf,
"File \"%s\" is in the Unix ", fname);
190 errmsg(
graph,buf,
"\"plot(1)\" format.\n");
192 else if (
eq(devtype,
"postscript")) {
193 sprintf(buf,
"File \"%s\" may be printed on a ", fname);
194 errmsg(
graph,buf,
"postscript printer.\n");
196 else if (
eq(devtype,
"laser")) {
197 sprintf(buf,
"File \"%s\" may be printed on a ", fname);
198 errmsg(
graph,buf,
"pcl laser printer.\n");
200 else if (
eq(devtype,
"text")) {
201 sprintf(buf,
"File \"%s\" may be printed on a ", fname);
202 errmsg(
graph,buf,
"text printer.\n");
211 errmsg(
graph, msg1, msg2)
265 if (i & 0x29)
return (1);
286 if (!buf) buf = (
char *)
malloc(bsize);
296 sprintf(buf,
"Error: Printer driver %s not found.\n",
device);
304 if (bsize > size) bsize = size;
312 while (size >= bsize) {
313 fread(buf,bsize,1,fp);
314 for (i = 0; i < bsize; i++)
319 fread(buf,size,1,fp);
320 for (i = 0; i < size; i++)
338 response.
reply.
ch = getch() & 0xff;
340 response.
reply.
ch = 256 + getch();
345 request.
fp = (FILE*)0;
static char buf[MAXPROMPT]
struct graph::@2 absolute
static struct sHtxt * input()
union response::@11 reply
static char hc_device[10]
int ft_makehardcopy(GRAPH *graph, char *fname, char *devtype, char *device, char *mesg)
static void message(char *instr, char *outstr)