separate svg and postscript handling

This commit is contained in:
Holger Vogt 2020-08-15 21:56:33 +02:00
parent dacd727d87
commit 6b4d2a9241
1 changed files with 19 additions and 8 deletions

View File

@ -38,23 +38,34 @@ void com_hardcopy(wordlist *wl)
if (!cp_getvar("hcopydev", CP_STRING, device, sizeof(device))) if (!cp_getvar("hcopydev", CP_STRING, device, sizeof(device)))
*device = '\0'; *device = '\0';
if (!cp_getvar("hcopydevtype", CP_STRING, buf, sizeof(buf))) {
devtype = "postscript";
}
else {
devtype = buf;
}
if (wl) { if (wl) {
hc_button = 0; hc_button = 0;
fname = copy(wl->wl_word); fname = copy(wl->wl_word);
n_byte_fname = (strlen(fname) + 1) * sizeof *fname;
wl = wl->wl_next; wl = wl->wl_next;
} }
else { else {
hc_button = 1; hc_button = 1;
fname = smktemp("hc"); fname = smktemp("hc");
tempf = TRUE; tempf = TRUE;
} n_byte_fname = (strlen(fname) + 1) * sizeof *fname;
n_byte_fname = (strlen(fname) + 1) * sizeof *fname; if (!strcmp(devtype, "svg")) {
fname = trealloc(fname, n_byte_fname + 4);
if (!cp_getvar("hcopydevtype", CP_STRING, buf, sizeof(buf))) { (void)memcpy(fname + n_byte_fname - 1, ".svg", 5);
devtype = "postscript"; n_byte_fname += 4;
} }
else { else if (!strcmp(devtype, "postscript")) {
devtype = buf; fname = trealloc(fname, n_byte_fname + 3);
(void)memcpy(fname + n_byte_fname - 1, ".ps", 4);
n_byte_fname += 3;
}
} }
/* enable screen plot selection for these display types */ /* enable screen plot selection for these display types */