summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-04-14 20:52:21 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-04-14 20:52:21 +0000
commit4ecfd8a8ac9e7b3fc0ec386d572e6821f24935ce (patch)
tree6c60ec7af3f3a870f57602ac48e43e19b847ec3d
parent6719dcabc31ac4459d6d21580f70e10fd2de85a8 (diff)
Pass the job name to the input filter via the -j flag. Some filters
(like foomatic) expect to be able to pass information from lpr via the job name. OK beck@
-rw-r--r--usr.sbin/lpr/SMM.doc/5.t9
-rw-r--r--usr.sbin/lpr/filters/lpf.c8
-rw-r--r--usr.sbin/lpr/lpd/printjob.c8
-rw-r--r--usr.sbin/lpr/lpr/lpr.c6
4 files changed, 20 insertions, 11 deletions
diff --git a/usr.sbin/lpr/SMM.doc/5.t b/usr.sbin/lpr/SMM.doc/5.t
index 978364e0f28..af8b50702fa 100644
--- a/usr.sbin/lpr/SMM.doc/5.t
+++ b/usr.sbin/lpr/SMM.doc/5.t
@@ -1,4 +1,4 @@
-.\" $OpenBSD: 5.t,v 1.4 2003/06/02 23:36:53 millert Exp $
+.\" $OpenBSD: 5.t,v 1.5 2004/04/14 20:52:20 millert Exp $
.\"
.\" Copyright (c) 1983, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -70,7 +70,7 @@ The
.B if
filter is passed the following parameters.
.DS
-\fIfilter\fP [\|\fB\-c\fP\|] \fB\-w\fPwidth \fB\-l\fPlength \fB\-i\fPindent \fB\-n\fP login \fB\-h\fP host accounting_file
+\fIfilter\fP [\|\fB\-c\fP\|] \fB\-w\fPwidth \fB\-l\fPlength \fB\-i\fPindent \fB\-n\fP login \fB\-j\fP jobname \fB\-h\fP host accounting_file
.DE
The
.B \-c
@@ -94,10 +94,13 @@ and
parameters specify the login name and host name of the job owner.
The last argument is the name of the accounting file from
.IR printcap .
+The
+.B \-j
+parameter is optional and specifies the name of the print job if available.
.PP
All other filters are called with the following arguments:
.DS
-\fIfilter\fP \fB\-x\fPwidth \fB\-y\fPlength \fB\-n\fP login \fB\-h\fP host accounting_file
+\fIfilter\fP \fB\-x\fPwidth \fB\-y\fPlength \fB\-n\fP login \fB\-j\fP jobname \fB\-h\fP host accounting_file
.DE
The
.B \-x
diff --git a/usr.sbin/lpr/filters/lpf.c b/usr.sbin/lpr/filters/lpf.c
index d69b4880157..1a6f79d3da3 100644
--- a/usr.sbin/lpr/filters/lpf.c
+++ b/usr.sbin/lpr/filters/lpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lpf.c,v 1.10 2003/06/02 23:36:53 millert Exp $ */
+/* $OpenBSD: lpf.c,v 1.11 2004/04/14 20:52:20 millert Exp $ */
/* $NetBSD: lpf.c,v 1.8 2000/04/29 00:12:32 abs Exp $ */
/*
@@ -40,7 +40,7 @@ static const char copyright[] =
#if 0
static const char sccsid[] = "@(#)lpf.c 8.1 (Berkeley) 6/6/93";
#else
-static const char rcsid[] = "$OpenBSD: lpf.c,v 1.10 2003/06/02 23:36:53 millert Exp $";
+static const char rcsid[] = "$OpenBSD: lpf.c,v 1.11 2004/04/14 20:52:20 millert Exp $";
#endif
#endif /* not lint */
@@ -84,7 +84,7 @@ main(int argc, char **argv)
int done, linedone, maxrep, ch;
char *limit;
- while ((ch = getopt(argc, argv, "crh:i:l:n:w:")) != -1) {
+ while ((ch = getopt(argc, argv, "crh:i:j:l:n:w:")) != -1) {
switch (ch) {
case 'n':
name = optarg;
@@ -108,6 +108,8 @@ main(int argc, char **argv)
case 'c': /* Print control chars */
literal++;
break;
+ case 'j': /* ignore job name */
+ break;
default:
usage();
}
diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c
index 9ccab5d2d94..012400b2ff4 100644
--- a/usr.sbin/lpr/lpd/printjob.c
+++ b/usr.sbin/lpr/lpd/printjob.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: printjob.c,v 1.38 2004/04/13 23:23:02 millert Exp $ */
+/* $OpenBSD: printjob.c,v 1.39 2004/04/14 20:52:20 millert Exp $ */
/* $NetBSD: printjob.c,v 1.31 2002/01/21 14:42:30 wiz Exp $ */
/*
@@ -545,7 +545,7 @@ print(int format, char *file)
ssize_t nread;
struct stat stb;
pid_t pid;
- char *prog, *av[15], buf[BUFSIZ];
+ char *prog, *av[17], buf[BUFSIZ];
int fd, status, serrno;
int n, fi, fo, p[2], stopped = 0, nofile;
@@ -702,6 +702,10 @@ print(int format, char *file)
av[0] = prog;
av[n++] = "-n";
av[n++] = logname;
+ if (*jobname != '\0' && strcmp(jobname, " ") != 0) {
+ av[n++] = "-j";
+ av[n++] = jobname;
+ }
av[n++] = "-h";
av[n++] = fromhost;
av[n++] = AF;
diff --git a/usr.sbin/lpr/lpr/lpr.c b/usr.sbin/lpr/lpr/lpr.c
index decb1aafda6..1379c3c841d 100644
--- a/usr.sbin/lpr/lpr/lpr.c
+++ b/usr.sbin/lpr/lpr/lpr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lpr.c,v 1.34 2003/06/02 23:36:53 millert Exp $ */
+/* $OpenBSD: lpr.c,v 1.35 2004/04/14 20:52:20 millert Exp $ */
/* $NetBSD: lpr.c,v 1.19 2000/10/11 20:23:52 is Exp $ */
/*
@@ -46,7 +46,7 @@ static const char copyright[] =
#if 0
static const char sccsid[] = "@(#)lpr.c 8.4 (Berkeley) 4/28/95";
#else
-static const char rcsid[] = "$OpenBSD: lpr.c,v 1.34 2003/06/02 23:36:53 millert Exp $";
+static const char rcsid[] = "$OpenBSD: lpr.c,v 1.35 2004/04/14 20:52:20 millert Exp $";
#endif
#endif /* not lint */
@@ -301,7 +301,7 @@ main(int argc, char **argv)
tfd = nfile(tfname);
card('H', host);
card('P', person);
- if (hdr && !SH) {
+ if (hdr) {
if (jobname == NULL) {
if (argc == 0)
jobname = "stdin";