Commit 90149034 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

localspl: Add lpr port extension.

parent 6372a61e
......@@ -164,6 +164,20 @@ static BOOL unixname_start_doc(doc_t *doc, const WCHAR *output)
return doc->unixname.fd != -1;
}
static BOOL lpr_start_doc(doc_t *doc, const WCHAR *printer_name)
{
static const WCHAR lpr[] = { 'l','p','r',' ','-','P','\'' };
static const WCHAR quote[] = { '\'',0 };
int printer_len = wcslen(printer_name);
WCHAR *cmd;
cmd = malloc(printer_len * sizeof(WCHAR) + sizeof(lpr) + sizeof(quote));
memcpy(cmd, lpr, sizeof(lpr));
memcpy(cmd + ARRAY_SIZE(lpr), printer_name, printer_len * sizeof(WCHAR));
memcpy(cmd + ARRAY_SIZE(lpr) + printer_len, quote, sizeof(quote));
return pipe_start_doc(doc, cmd);
}
static NTSTATUS start_doc(void *args)
{
const struct start_doc_params *params = args;
......@@ -176,6 +190,8 @@ static NTSTATUS start_doc(void *args)
ret = pipe_start_doc(doc, params->port + 1 /* strlen("|") */);
else if (params->type == PORT_IS_UNIXNAME)
ret = unixname_start_doc(doc, params->port);
else if (params->type == PORT_IS_LPR)
ret = lpr_start_doc(doc, params->port + 4 /* strlen("lpr:") */);
if (ret)
*params->doc = (size_t)doc;
......
......@@ -506,7 +506,8 @@ static BOOL WINAPI localmon_StartDocPort(HANDLE hport, WCHAR *printer_name,
TRACE("(%p %s %ld %ld %p)\n", hport, debugstr_w(printer_name),
job_id, level, doc_info);
if (port->type == PORT_IS_PIPE || port->type == PORT_IS_UNIXNAME)
if (port->type == PORT_IS_PIPE || port->type == PORT_IS_UNIXNAME ||
port->type == PORT_IS_LPR)
{
struct start_doc_params params;
......@@ -546,7 +547,8 @@ static BOOL WINAPI localmon_WritePort(HANDLE hport, BYTE *buf, DWORD size,
TRACE("(%p %p %lu %p)\n", hport, buf, size, written);
if (port->type == PORT_IS_PIPE || port->type == PORT_IS_UNIXNAME)
if (port->type == PORT_IS_PIPE || port->type == PORT_IS_UNIXNAME ||
port->type == PORT_IS_LPR)
{
struct write_doc_params params;
BOOL ret;
......@@ -568,7 +570,8 @@ static BOOL WINAPI localmon_EndDocPort(HANDLE hport)
TRACE("(%p)\n", hport);
if (port->type == PORT_IS_PIPE || port->type == PORT_IS_UNIXNAME)
if (port->type == PORT_IS_PIPE || port->type == PORT_IS_UNIXNAME ||
port->type == PORT_IS_LPR)
{
struct end_doc_params params;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment