X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/356a170694d9182f1a350933a76e75bc75f8056d..f7aa4b367eaf2c1e928f97263bcf4da74680aff3:/unix/uxprint.c diff --git a/unix/uxprint.c b/unix/uxprint.c index 387ea28d..37241007 100644 --- a/unix/uxprint.c +++ b/unix/uxprint.c @@ -12,12 +12,12 @@ struct printer_job_tag { printer_job *printer_start_job(char *printer) { - printer_job *ret = smalloc(sizeof(printer_job)); + printer_job *ret = snew(printer_job); /* - * On Unix, we treat cfg.printer as the name of a command to - * pipe to - typically lpr, of course. + * On Unix, we treat the printer string as the name of a + * command to pipe to - typically lpr, of course. */ - ret->fp = popen(cfg.printer, "w"); + ret->fp = popen(printer, "w"); if (!ret->fp) { sfree(ret); ret = NULL; @@ -30,7 +30,8 @@ void printer_job_data(printer_job *pj, void *data, int len) if (!pj) return; - fwrite(data, 1, len, pj->fp); + if (fwrite(data, 1, len, pj->fp) < len) + /* ignore */; } void printer_finish_job(printer_job *pj) @@ -41,3 +42,17 @@ void printer_finish_job(printer_job *pj) pclose(pj->fp); sfree(pj); } + +/* + * There's no sensible way to enumerate printers under Unix, since + * practically any valid Unix command is a valid printer :-) So + * these are useless stub functions, and uxcfg.c will disable the + * drop-down list in the printer configurer. + */ +printer_enum *printer_start_enum(int *nprinters_ptr) { + *nprinters_ptr = 0; + return NULL; +} +char *printer_get_name(printer_enum *pe, int i) { return NULL; +} +void printer_finish_enum(printer_enum *pe) { }