ULPR - Universal LPR Client

Copyright © 2000, Chris Gonnerman
chris@gonnerman.org

ULPR is a printing client program for the LPD, TCP (raw), and SMB protocols.  It is extensible, so that additional protocols may be added, and it requires NO configuration files.

ULPR is distributed under the terms of the General Public License of the Free Software Foundation; see the file COPYING included in the distribution for details, or visit www.gnu.org.

Updated! Version 0.6 a security hole in the LPD and TCP transports.  Note that the frontend-to-backend connection has changed so that you will need to rewrite any other protocols you may have implemented.


Introduction

I am a laptop user, and I got tired of adding printers to /etc/printcap every time I needed to print at a new location.  Not only is it a hassle, but the /etc/printcap file rapidly becomes a mess.  ULPR solves these problems.

Here's an example:

  user@laptop> ulpr -P smb://office/deskjet

Simple, eh? ULPR accepts two main types of printer specification:

The protocol can be omitted (leave out the colon, too); this selects the default protocol, lpd.  If only a name without punctuation is found, it's assumed to be the printer name and the server name defaults to localhost.  If the first syntax is used and the printer name is omitted, the default printer name is assumed; this varies, as each protocol module can specify its own default.  For the lpd: protocol, the default is "lp".

Each protocol is implemented by a backend module, in the $PREFIX/libexec/ulpr directory, named "protocol"_print, i.e.  lpd_print, smb_print, tcp_print, etc. Eventually, there will be a ulpq command with similar backends named "protocol"_queue.  The default protocol is implemented by a symbolic link from lpd_print to def_print; you can change the default by changing this link.

It is also possible to specify options at the end of the printer specification where such are needed; I have deliberately limited the number of options accepted, and each protocol module implements its own set of options, so there is no general rule.  However, the option "debug" does usually specify verbose tracing of the program, probably not needed by any casual user.  Options are specified after the normal print specification, following a slash and separated by slashes, as in:

  lpd://hostname/printer/option1/option2=abc/option3
lpd:printer@hostname/option1=xyz/option2

Some options are specified by themselves, and others have arguments following an equal sign, as shown above.  See below for additional examples.

Protocols

LPD

This is the normal default protocol.  It has the following defaults and options:
Defaults
  Host: localhost
  Printer: lp
Options
  debug print verbose debugging output
  strict use strict RFC 1179 port range only (otherwise uses a reserved port)
  time=n connection timeout in seconds

TCP

This is the raw-tcp protocol module; it opens a connection to a given port and dumps in the print job.  Each file specified on the command line is sent through a separate connection.  The "printer" part of the print specification is the port address to send to.
Defaults
  Host: localhost
  Printer: 10001
Options
  debug print verbose debugging output
  reserved use a reserved port, less than 1024, as the source port
  time=n connection timeout in seconds

SMB

This is the SMB (Server Message Block) protocol.  The backend protocol module is actually a script file using the smbclient program included with Samba; therefore you need Samba installed to use this protocol module.  Note that name resolution uses the Samba model also; see the smbclient documentation for more information.  The default host and printer are rather likely to be incorrect...
Defaults
  Host: server
  Printer: printer
Options
  debug print verbose debugging output
  ip=n IP address of server (see the smbclient -I option)

Comments