mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 09:27:59 +00:00
5d718ef64b
The number of people has been steadily increasing who read our source code with an editor that thinks tab stops are 4 spaces apart, as opposed to the traditional tty-derived 8 that the PuTTY code expects. So I've been wondering for ages about just fixing it, and switching to a spaces-only policy throughout the code. And I recently found out about 'git blame -w', which should make this change not too disruptive for the purposes of source-control archaeology; so perhaps now is the time. While I'm at it, I've also taken the opportunity to remove all the trailing spaces from source lines (on the basis that git dislikes them, and is the only thing that seems to have a strong opinion one way or the other). Apologies to anyone downstream of this code who has complicated patch sets to rebase past this change. I don't intend it to be needed again.
59 lines
1.2 KiB
C
59 lines
1.2 KiB
C
/*
|
|
* Printing interface for PuTTY.
|
|
*/
|
|
|
|
#include <assert.h>
|
|
#include <stdio.h>
|
|
#include "putty.h"
|
|
|
|
struct printer_job_tag {
|
|
FILE *fp;
|
|
};
|
|
|
|
printer_job *printer_start_job(char *printer)
|
|
{
|
|
printer_job *ret = snew(printer_job);
|
|
/*
|
|
* On Unix, we treat the printer string as the name of a
|
|
* command to pipe to - typically lpr, of course.
|
|
*/
|
|
ret->fp = popen(printer, "w");
|
|
if (!ret->fp) {
|
|
sfree(ret);
|
|
ret = NULL;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
void printer_job_data(printer_job *pj, const void *data, size_t len)
|
|
{
|
|
if (!pj)
|
|
return;
|
|
|
|
if (fwrite(data, 1, len, pj->fp) < len)
|
|
/* ignore */;
|
|
}
|
|
|
|
void printer_finish_job(printer_job *pj)
|
|
{
|
|
if (!pj)
|
|
return;
|
|
|
|
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) { }
|