Funny that even back in Solaris 8 days I had no trouble getting Sun lp/lpsched 
to
support just about every one of the lpr filter types.   Some (like the Fortran 
control
characters, still used in some Fortran programs) are trivial  and can be done
with an existing program (asa) and just a new filter definition; others require 
scrounging
software.  I even got CIF format working (with cif2ps from comp.sources.misc 
archive,
vol 8, issue 100), but that's admittedly silly, since there may only be archaic 
software that
produces CIF format.  (had a time getting a sample file to test, as I recall)

Indeed, I was using ghostscript in an interface script to let a dot matrix 
printer appear to
lp users as PostScript capable long before CUPS existed at all.  It wasn't 
difficult, it just
wasn't out-of-the-box plug-and-play no-brainer easy.

Anyway, I'm not thrilled with the notion of yanking these content options.  As 
long as CUPS 
hasn't replaced the Sun derivative of traditional SVR4 lpsched, they could 
still keep working,
because each lpr option has a corresponding lp option (or combination of 
options).
For the curious, see the attached lp_notes.txt for how they correspond (as well 
as for
most of the tricks I used to get full functionality).

More fundamental is this: as far as I can tell, CUPS lp has _no_ equivalent of 
the
existing lp -T _content_type_ option.  (it looks like the CUPS API _can_ 
provide a
MIME type, but there's no way to do it from the command line)

I gather that CUPS attempts to determine the content-type automatically, and
do the right thing.  But since there's no extended attribute to stamp files 
with a MIME type,
there's no assurance that a typing engine (looking at file content like 
file(1), or looking
at file names, or both) will get it right,  therefore the lack of a 
command-line option
to specify content type is to my way of thinking a serious design flaw with 
CUPS.

Even when it gets it right, one might wish to override that.  Let's say I have 
a PostScript
program that I want to print a source listing of rather than render.  With the 
older
lp, I can do

lp -T simple file.ps

but with something newer, I'd need to preprocess with some sort of 
text-to-PostScript filter
(or else at a minimum, insert a blank line at the beginning to bypass trivial 
checks for
%! at offset 0).

Similarly, CUPS support for legacy lpd clients _stinks_ from what I've read - 
they drop
all support for lpr "filter" options, never mind that since they _do_ have a 
way to specify
MIME type in the API, they _could_ easily have done better, even if not quite 
100%.

CUPS is very capable, and more modern (and to many, more familiar) than 
traditional
lp/lpsched.  But the older lp/lpsched _could be persuaded to do just about 
anything
for those who bothered to learn how; for those, CUPS, while mostly desirable, 
falls
short on compatibility.  And yanking features now that CUPS isn't compatible 
with is IMO
not nearly as good as improving its compatibility so those features could be 
more transparently
migrated.  I don't think it would take much to improve CUPS in that regard.  I 
think yanking
features now might merely reduce the incentive to do the better deed.
-- 
This message posted from opensolaris.org
-------------- next part --------------
Here is an attempt to correlate option descriptions from the lpr man page
with the corresponding lp options.  If -T or -y options are present in the
resulting lp command, that implies the use of filters, not all of which
are supplied or predefined.  Note the lpr -[1234] options appear to
presently be ignored.

     -P destination
           Prints  file  on  a  specific  printer  or  class   of
           printers(see   lpadmin(1M)). Specify destination using
           atomic, POSIX-style (server:destination), or Federated
           Naming  Service (FNS) (.../service/printer/...) names.
           See printers.conf(4)  for  information  regarding  the
           naming conventions for atomic and FNS names, and stan-
           dards(5) for information regarding POSIX.

lp -d dest

     -# number
           Prints a specific number of copies. Specify  number as
           a positive integer. The default for  number is  1.

lp -n number

     -C class
           Prints class as the  job classification  on the banner
           page of the output.  Enclose
            class in double quotes  if  it  contains  blanks.  If
           class  is  not  specified,  the name of the system (as
           returned by  hostname) is printed as the job classifi-
           cation. See hostname(1).

     -J job
           Prints job as the  job name  on the banner page of the
           output.   Enclose  job in double quotes if it contains
           blanks. If  job is not specified,   file  (or  in  the
           case  of  multiple files, the first  file specified on
           the command line) is printed as the job  name  on  the
           banner page of the output.

(not sure about this one)
looks like lpr -J job and lpr -C class are concatenated (with
"\n#####\n#####\t\t " in between if both are present) to form

lp -t title

which ultimately becomes argv[3] passed to the interface script, and
only is used if the banner is printed.

     -T title
           Prints a title on  the  banner  page  of  the  output.
           Enclose  title in double quotes if it contains blanks.
           If  title is not specified, file  is  printed  on  the
           banner page.

(only applicable together with lpr -p option)
lp -T pr -y prtitle=value


     -i indent
           Indents the output a specific number of  SPACE charac-
           ters.  Use  indent  to  indicate  the number of  SPACE
           characters to be indented. Specify  indent as a  posi-
           tive integer. Eight SPACE characters is the default.

(only applicable together with lpr -p option)
lp -T pr -y indent=value

     -1|-2|-3|-4 font
           Mounts the specified font in the font position  1,  2,
           3, or  4. Specify  font as a valid font name.
(ignored)

     -w cols
           Prints  file with pages  of  a  specific  width.  cols
           indicates the number of  columns wide.

(only applicable together with lpr -p option)
lp -T pr -y width=value

     -m    Sends mail after file has  printed.  See  mail(1).  By
           default,  no  mail is sent upon normal completion of a
           print request.

lp -m

     -h    Suppresses printing of the banner page of the output.

lp -o nobanner

     -s    Uses full pathnames (as opposed to symbolic links)  to
           file rather than trying to copy them. This means  file
           should not be modified or removed until  it  has  com-
           pleted  printing.   Option  -s only prevents copies of
           local files from being  made  on  the  local  machine.
           Option -s only works with specified  files. If the lpr
           command is at the end of a pipeline,  file  is  copied
           to the spool.

(absence of lp -c)

     - filter_option
           Notifies the print spooler that  file is not  a  stan-
           dard  text  file.   Enables the spooling daemon to use
           the appropriate filters to print  file.

           filter_options offer a standard  user  interface.  All
           options  may  not  be available for, or applicable to,
           all printers.

           Specify  filter_option as a single character.

           If filter_option is not specified and the printer  can
           interpret  PostScriptO,  inserting   `%!' as the first
           two characters of  file causes file to be  interpreted
           as PostScript.

           The following  filter_options are supported:

           p     Use pr to format the files. See pr(1).

lp -T pr

           l     Print  control  characters  and  suppress   page
                 breaks.

lp -T simple -y catv_filter

Note: I found I had to modify /etc/lp/fd/catv.fd and re-install it, with
the following change, to avoid some interesting problems.  I have no idea
why it was like that in the first place; it doesn't make sense to me...
$ diff catv.fd.orig catv.fd
3c3,5
< Input types: simple,postscript
---
> # input type postscript messes up other filter chains
> # Input types: simple,postscript
> Input types: simple



           t     file contains troff (cat phototypesetter) binary
                 data.

lp -T otroff
(this filter is _not_ supplied, and I haven't found a really satisfactory
equivalent that isn't a major pain to build; fortunately I haven't needed it,
not presently having any clients that generate C/A/T phototypesetter output)    


           n     file contains  ditroff data from device indepen-
                 dent troff.

lp -T troff

           d     file contains  tex data from in  DVI format from
                 Stanford.

lp -T dvi
(this filter is _not_ supplied, but can be created using tex dvips
command wrapped in a script, combined with a reasonably simple filter
definition; in mine, the wrapping script supplies the options
 -q -f -R -D ${Resolution}, with resolution defaulted to something reasonable
if not supplied via the line
Options: MODES dpi\=\([\.0-9]*\) = -D \1
(i.e. lp -y dpi=value) in the filter definition)

           g     file contains standard  plot  data  produced  by
                 plot(1B) routines.

lp -T plot

           v     file contains a raster image. printer must  sup-
                 port   an  appropriate  imaging  model  such  as
                 PostScript in order to print the image.

lp -T raster
(this filter is _not_ supplied; mine looks like
Input types: raster
Output types: postscript
Printer types: any
Printers: any
Filter type: slow
Command: /usr/bin/env OPENWINHOME=/usr/openwin /usr/openwin/bin/rash

which handles Sun Raster files, although I think the original BSD (but not
necessarily SunOS 4.x) usage was to handle Versatec raster files, which
personally I have no use for.  A smart raster file filter, capable of
handle both of those formats and maybe a couple of other common ones,
might be desirable)

           c     file contains data produced by cifplot.

lp -T cif
(this filter is _not_ supplied.  I think I'm using a version of cif2ps
from the comp.sources.misc archive (Volume 8, Issue 100), wrapped in
a bit of script to throw away stderr.  CIF is a rather obscure IC layout
format; I just set this up for the heck of an attempt at completeness.)

           f     Interprets the first character of each line as a
                 standard FORTRAN carriage control character.

lp -T fortran
(this filter is _not_ supplied, but just requires a trivial definition:
Input types: fortran
Output types: simple
Printer types: any
Printers: any
Filter type: slow
Command: /usr/bin/asa
)

Reply via email to