Subject: bin/14247: minimal support for "o"-type print-file actions in lpd
To: None <gnats-bugs@gnats.netbsd.org>
From: Andreas Wrede <andreas@planix.com>
List: netbsd-bugs
Date: 10/14/2001 23:55:32
>Number:         14247
>Category:       bin
>Synopsis:       Add minimal support for "o"-type print-file actions in lpd
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 14 20:56:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Andreas Wrede <andreas@planix.com>
>Release:        NetBSD 1.5.2
>Organization:
Planix, Inc.
>Environment:
	
System: NetBSD woffi.planix.com 1.5.2 NetBSD 1.5.2 (PLANIX-IPv6) #1: Wed Aug 29 14:01:08 EDT 2001 root@whome.planix.com:/usr/src/sys/arch/i386/compile/WOFFI i386


>Description:
	MacOS 10.1 uses o-control (postscipt file) to send lpr jobs.
>How-To-Repeat:
	Print from a MacOSX 10.1 client to a NetBSD lpd server
>Fix:
	Apply path taken from FreeBSD. FreeBSD commit message reads:
Add minimal support for "o"-type print-file actions in lpd control files.
This was described in the original RFC wrt lpr, but most lpr's do not
actually implement it.  There is some indication that MacOS 10.1 will
be using this when sending postscript files to print servers (that is
what "o"-type was supposed to signify -- postscript files).


Index: printjob.c
===================================================================
RCS file: /u5/NetBSD-CVS/main/basesrc/usr.sbin/lpr/lpd/printjob.c,v
retrieving revision 1.22.4.2
diff -c -r1.22.4.2 printjob.c
*** printjob.c	2000/10/17 19:50:23	1.22.4.2
--- printjob.c	2001/10/15 03:19:10
***************
*** 1,4 ****
! /*	$NetBSD: printjob.c,v 1.22.4.1 2000/09/28 01:37:35 itojun Exp $	*/
  
  /*
   * Copyright (c) 1983, 1993
--- 1,4 ----
! /*	$NetBSD: printjob.c,v 1.22.4.2 2000/10/17 19:50:23 tv Exp $	*/
  
  /*
   * Copyright (c) 1983, 1993
***************
*** 45,51 ****
  #if 0
  static char sccsid[] = "@(#)printjob.c	8.7 (Berkeley) 5/10/95";
  #else
! __RCSID("$NetBSD: printjob.c,v 1.22.4.1 2000/09/28 01:37:35 itojun Exp $");
  #endif
  #endif /* not lint */
  
--- 45,51 ----
  #if 0
  static char sccsid[] = "@(#)printjob.c	8.7 (Berkeley) 5/10/95";
  #else
! __RCSID("$NetBSD: printjob.c,v 1.22.4.2 2000/10/17 19:50:23 tv Exp $");
  #endif
  #endif /* not lint */
  
***************
*** 357,362 ****
--- 357,364 ----
  	 *		R -- laser dpi "resolution"
  	 *              f -- "file name" name of text file to print
  	 *		l -- "file name" text file with control chars
+ 	 *		o -- "file name" postscript file, according to
+ 	 *		     the RFC.  Here it is treated like an 'f'.
  	 *		p -- "file name" text file to print with pr(1)
  	 *		t -- "file name" troff(1) file to print
  	 *		n -- "file name" ditroff(1) file to print
***************
*** 550,556 ****
  		(void)write(ofd, FF, strlen(FF));
  		tof = 1;
  	}
! 	if (IF == NULL && (format == 'f' || format == 'l')) {
  		tof = 0;
  		while ((n = read(fi, buf, BUFSIZ)) > 0)
  			if (write(ofd, buf, n) != n) {
--- 552,558 ----
  		(void)write(ofd, FF, strlen(FF));
  		tof = 1;
  	}
! 	if (IF == NULL && (format == 'f' || format == 'l' || format == 'o')) {
  		tof = 0;
  		while ((n = read(fi, buf, BUFSIZ)) > 0)
  			if (write(ofd, buf, n) != n) {
***************
*** 594,599 ****
--- 596,609 ----
  			return(ERROR);
  		}
  		fi = p[0];			/* use pipe for input */
+ 	case 'o':	/* print postscript file */
+ 		/*
+ 		 * For now, treat this as a plain-text file, and assume
+ 		 * the standard LPF_INPUT filter will recognize that it
+ 		 * is postscript and know what to do with it.  These
+ 		 * 'o'-file requests could come from MacOS 10.1 systems.
+ 		 */
+ 		/* FALLTHROUGH */
  	case 'f':	/* print plain text file */
  		prog = IF;
  		av[1] = width;
>Release-Note:
>Audit-Trail:
>Unformatted: