Jspice3
hcopy.c File Reference
#include "spice.h"
#include "plotdefs.h"
Include dependency graph for hcopy.c:

Go to the source code of this file.

Functions

static void message (char *instr, char *outstr)
 
int ft_makehardcopy (GRAPH *graph, char *fname, char *devtype, char *device, char *mesg)
 

Function Documentation

int ft_makehardcopy ( GRAPH graph,
char *  fname,
char *  devtype,
char *  device,
char *  mesg 
)

Definition at line 25 of file hcopy.c.

29 {
30  bool printed = false;
31  char buf[BSIZE_SP];
32  char *sif = "%s saved in file \"%s\"";
33 
34  if (*device) {
35  sprintf(buf, "Printing %s on the %s printer", fname, device);
36  message(buf, mesg);
37 
38 #ifdef SYSTEM_PLOT5LPR
39  if (!strcmp(devtype, "plot5")) {
40  (void) sprintf(buf, SYSTEM_PLOT5LPR, device, fname);
41  (void) system(buf);
42  printed = true;
43  }
44 #endif
45 
46 #ifdef SYSTEM_PSLPR
47  if (!strcmp(devtype, "postscript")) {
48  (void) sprintf(buf, SYSTEM_PSLPR, device, fname);
49  (void) system(buf);
50  printed = true;
51  }
52 #endif
53  if (!strcmp(devtype, "laser")) {
54  (void) sprintf(buf, "PCL not supported yet");
55  message(buf, mesg);
56  printed = false;
57  }
58  if (!strcmp(devtype, "text")) {
59  (void) sprintf(buf, "lpr -h -P%s %s", device, fname);
60  (void) system(buf);
61  printed = true;
62  }
63  }
64 
65  if (!printed) {
66  if (!strcmp(devtype, "plot5")) {
67  sprintf(buf, sif, "Unix \"plot(1)\"", fname);
68  }
69  else if (!strcmp(devtype, "postscript")) {
70  sprintf(buf, sif, "Postscript image", fname);
71  }
72  else if (!strcmp(devtype, "laser")) {
73  sprintf(buf, sif, "PCL image", fname);
74  }
75  else if (!strcmp(devtype, "text")) {
76  sprintf(buf, sif, "Text", fname);
77  }
78  message(buf, mesg);
79  }
80  return (0);
81 }
static char buf[MAXPROMPT]
Definition: arg.c:18
#define BSIZE_SP
Definition: misc.h:19
Definition: outitf.c:1049
DISPDEVICE device[]
Definition: display.c:24
int system(char *str)
Definition: libfuncs.c:85
static void message(char *instr, char *outstr)
Definition: hcopy.c:13
static void message ( char *  instr,
char *  outstr 
)
static

Definition at line 13 of file hcopy.c.

16 {
17  if (!outstr)
18  fprintf(cp_out, "%s\n", instr);
19  else
20  strcpy(outstr, instr);
21 }
char * strcpy()
FILE * cp_out
Definition: help.c:101