Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Dec 2008 17:46:52 GMT
From:      Gavin Atkinson <gavin@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   standards/129554: lp(1) [patch] Implement -m and -t options
Message-ID:  <200812101746.mBAHkqoZ051291@buffy.york.ac.uk>
Resent-Message-ID: <200812101820.mBAIK1gt056677@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         129554
>Category:       standards
>Synopsis:       lp(1) [patch] Implement -m and -t options
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-standards
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 10 18:20:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Gavin Atkinson
>Release:        FreeBSD 7.0-STABLE amd64
>Organization:
>Environment:
System: FreeBSD buffy.york.ac.uk 7.0-STABLE FreeBSD 7.0-STABLE #3: Fri Jun 20 09:21:51 UTC 2008 root@buffy.york.ac.uk:/usr/obj/usr/src/sys/GENERIC amd64

>Description:

lp(1) doesn't support the -t option, as required by me and POSIX.  Implement
it.  While here, I've implemented the -m option, leaving the -w option as
the only one missing for full compliance (although -o and -s are not fully
implemented).
Note that I have implemented the -t option because I needed it, and not
because I necessarily wanted to see this utility closer to compliance.
Therefore, I've not updated any reference to compliance in the code or
man page (I wouldn't know if they need updating or not)

>How-To-Repeat:
	N/A
>Fix:

--- lp-t-moptions.diff begins here ---
Index: src-head/usr.sbin/lpr/lp/lp.1
===================================================================
RCS file: /home/ncvs/src/usr.sbin/lpr/lp/lp.1,v
retrieving revision 1.18
diff -u -r1.18 lp.1
--- src-head/usr.sbin/lpr/lp/lp.1	2 Jul 2004 23:12:46 -0000	1.18
+++ src-head/usr.sbin/lpr/lp/lp.1	10 Dec 2008 17:34:18 -0000
@@ -78,6 +78,8 @@
 .Ev PRINTER
 (with this precedence)
 are taken as the destination printer.
+.It Fl m
+Send mail upon completion.
 .It Fl n Ar num
 Specify that
 .Ar num
@@ -91,6 +93,9 @@
 Not supported,
 provided only as a compatibility option for
 .St -susv2 .
+.It Fl t Ar title
+Set the job title to
+.Ar title .
 .El
 .Sh ENVIRONMENT
 As described above, the variables
Index: src-head/usr.sbin/lpr/lp/lp.sh
===================================================================
RCS file: /home/ncvs/src/usr.sbin/lpr/lp/lp.sh,v
retrieving revision 1.7
diff -u -r1.7 lp.sh
--- src-head/usr.sbin/lpr/lp/lp.sh	8 Mar 2000 10:02:11 -0000	1.7
+++ src-head/usr.sbin/lpr/lp/lp.sh	10 Dec 2008 17:36:52 -0000
@@ -41,6 +41,8 @@
 
 ncopies=""
 symlink="-s"
+mailafter=""
+title=""
 
 # Posix says LPDEST gets precedence over PRINTER
 dest=${LPDEST:-${PRINTER:-lp}}
@@ -51,7 +53,7 @@
 # XXX We include the -s flag as a dummy.  SUSv2 requires it,
 # although we do not yet emit the affected messages.
 #
-while getopts "cd:n:o:s" option
+while getopts "cd:mn:o:st:" option
 do
 	case $option in
 
@@ -59,12 +61,16 @@
 		symlink="";;
 	d)			# destination
 		dest="${OPTARG}";;
+	m)			# mail after job
+		mailafter="-m";;
 	n)			# number of copies
 		ncopies="-#${OPTARG}";;
 	o)			# (printer option)
 		: ;;
 	s)			# (silent option)
 		: ;;
+	t)			# title for banner page
+		title="-J${OPTARG}";;
 	*)			# (error msg printed by getopts)
 		exit 2;;
 	esac
@@ -72,4 +78,4 @@
 
 shift $(($OPTIND - 1))
 
-exec /usr/bin/lpr "-P${dest}" ${symlink} ${ncopies} "$@"
+exec /usr/bin/lpr "-P${dest}" ${symlink} ${ncopies} ${mailafter} "${title}" "$@"
--- lp-t-moptions.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812101746.mBAHkqoZ051291>