summaryrefslogtreecommitdiffstats
path: root/usr.sbin/lpr/lpr
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>2000-06-21 20:20:26 +0000
committerwollman <wollman@FreeBSD.org>2000-06-21 20:20:26 +0000
commitdc44bff8163b240f97f70572db3884722d23ce60 (patch)
treeabb4f5ff452623d754007dbcde3cc7c91e9207f9 /usr.sbin/lpr/lpr
parent5201118f7df4ce7f5d5f98840b96279a6289a5df (diff)
downloadFreeBSD-src-dc44bff8163b240f97f70572db3884722d23ce60.zip
FreeBSD-src-dc44bff8163b240f97f70572db3884722d23ce60.tar.gz
Allow those of us who have to print through LPRng spoolers to send
spooler options using `Z' control-file lines and the `-Z' flag.
Diffstat (limited to 'usr.sbin/lpr/lpr')
-rw-r--r--usr.sbin/lpr/lpr/lpr.148
-rw-r--r--usr.sbin/lpr/lpr/lpr.c23
2 files changed, 64 insertions, 7 deletions
diff --git a/usr.sbin/lpr/lpr/lpr.1 b/usr.sbin/lpr/lpr/lpr.1
index 6a481c0..5948676 100644
--- a/usr.sbin/lpr/lpr/lpr.1
+++ b/usr.sbin/lpr/lpr/lpr.1
@@ -47,6 +47,7 @@
.Op Fl L Ar locale
.Op Fl T Ar title
.Op Fl U Ar user
+.Op Fl Z Ar daemon-options
.Op Fl i Ar numcols
.Op Fl 1234 Ar font
.Op Fl w Ns Ar num
@@ -180,10 +181,14 @@ Normally, the first file's name is used.
Use
.Ar locale
specified as argument instead of one found in environment.
-Use "C" to reset locale to default.
+(Only effective when filtering through
+.Xr pr 1
+is requested using the
+.Fl p
+option.)
.It Fl T Ar title
Title name for
-.Xr pr 1 ,
+.Xr pr 1 ,
instead of the file name.
.It Fl U Ar user
User name to print on the burst page,
@@ -191,6 +196,22 @@ also for accounting purposes.
This option is only honored if the real user-id is daemon
(or that specified in the printcap file instead of daemon),
and is intended for those instances where print filters wish to requeue jobs.
+.It Fl Z Ar daemon-options
+Some spoolers, such as
+.Tn LPRng ,
+accept additional per-job options using a
+.Ql Z
+control line.
+When
+.Fl Z
+is specified, and
+.Fl p
+.Pq Xr pr 1
+is not requested, the specified
+.Ar daemon-options
+will be passed to the remote
+.Tn LPRng
+spooler.
.It Fl i numcols
The output is indented by
.Pq Ar numcols .
@@ -256,7 +277,28 @@ regarding missing spool files by
Fonts for
.Xr troff 1
and
-.Xr tex
+.Tn TeX
reside on the host with the printer.
It is currently not possible to
use local font libraries.
+.Pp
+The
+.Ql Z
+control file line is used for two different purposes; for
+standard
+.Fx
+.Xr lpd 8 ,
+it specifies a locale to be passed to
+.Xr pr 1 .
+For
+.Tn LPRng
+.Xr lpd 8 ,
+it specifies additional options to be interpreted by the spooler's
+input and output filters.
+When submitting jobs via
+.Nm lpr ,
+.Fl p
+.Fl L Ar locale
+is used in the former context, and
+.Fl Z Ar daemon-options
+is used in the latter.
diff --git a/usr.sbin/lpr/lpr/lpr.c b/usr.sbin/lpr/lpr/lpr.c
index 1cdb374..5a65f94 100644
--- a/usr.sbin/lpr/lpr/lpr.c
+++ b/usr.sbin/lpr/lpr/lpr.c
@@ -103,6 +103,7 @@ static char *locale; /* pr'ing locale */
static int userid; /* user id */
static char *Uflag; /* user name specified with -U flag */
static char *width; /* width for versatec printing */
+static char *Zflag; /* extra filter options for LPRng servers */
static struct stat statb;
@@ -154,7 +155,8 @@ main(argc, argv)
errs = 0;
while ((c = getopt(argc, argv,
- ":#:1:2:3:4:C:J:L:P:T:U:cdfghi:lnmprstvw:")) != -1)
+ ":#:1:2:3:4:C:J:L:P:T:U:Z:cdfghi:lnmprstvw:"))
+ != -1)
switch (c) {
case '#': /* n copies */
i = strtol(optarg, &p, 10);
@@ -198,6 +200,10 @@ main(argc, argv)
Uflag = optarg;
break;
+ case 'Z':
+ Zflag = optarg;
+ break;
+
case 'c': /* print cifplot output */
case 'd': /* print tex output (dvi files) */
case 'g': /* print graph(1G) output */
@@ -332,6 +338,8 @@ main(argc, argv)
card('C', class);
card('L', person);
}
+ if (format != 'p' && Zflag != 0)
+ card('Z', Zflag);
if (iflag)
card('I', itoa(indent));
if (mailflg)
@@ -342,6 +350,12 @@ main(argc, argv)
card('1'+i, fonts[i]);
if (width != NULL)
card('W', width);
+ /*
+ * XXX
+ * Our use of `Z' here is incompatible with LPRng's
+ * use. We assume that the only use of our existing
+ * `Z' card is as shown for `p' format (pr) files.
+ */
if (format == 'p') {
char *s;
@@ -734,9 +748,10 @@ chkprinter(s, pp)
static void
usage()
{
- fprintf(stderr, "%s\n%s\n",
-"usage: lpr [-Pprinter] [-#num] [-C class] [-J job] [-T title] [-U user]",
-"[-i[numcols]] [-1234 font] [-L locale] [-wnum] [-cdfghlnmprstv] [name ...]");
+ fprintf(stderr, "%s\n",
+"usage: lpr [-Pprinter] [-#num] [-C class] [-J job] [-T title] [-U user]\n"
+ "\t[-Z daemon-options] [-i[numcols]] [-i[numcols]] [-1234 font]\n"
+ "\t[-L locale] [-wnum] [-cdfghlnmprstv] [name ...]");
exit(1);
}
OpenPOWER on IntegriCloud