68444b9f0c
text data bss dec hex filename 392 0 0 392 188 lpq.o 1378 0 0 1378 562 lpr.o 142 0 0 142 8e parse_prt.o
28 lines
634 B
C
28 lines
634 B
C
/* vi: set sw=4 ts=4: */
|
|
/*
|
|
* Copyright 2008 Walter Harms (WHarms@bfs.de)
|
|
*
|
|
* Licensed under the GPL v2, see the file LICENSE in this tarball.
|
|
*/
|
|
#include "libbb.h"
|
|
#include "lpr.h"
|
|
|
|
void parse_prt(const char *buf, struct netprint *netprint)
|
|
{
|
|
const char *p;
|
|
|
|
if (!buf) {
|
|
buf = getenv("PRINTER");
|
|
if (!buf)
|
|
buf = "lp"; /* "...@localhost:515" is implied */
|
|
}
|
|
p = strchrnul(buf, '@');
|
|
netprint->queue = xstrndup(buf, p - buf);
|
|
if (!*p) /* just queue? example: "lpq -Pcopie" */
|
|
p = "localhost";
|
|
netprint->server = xstrdup(p);
|
|
|
|
netprint->lsa = xhost2sockaddr(netprint->server,
|
|
bb_lookup_port(NULL, "tcp", 515));
|
|
}
|