SUMMARY: Determining available printers

Peter Schauss x 2014 (ps4330@okc01.jccbi.gov)
Thu, 02 Apr 1998 09:46:54 -0500

Original post:

What is the best way for a program to determine what printers
exist on a system. Under Solaris 2.4 we could look in /etc/lp/printers.
On Solaris 2.6, this directory exists but is empty. Now it appears we
have to read the file /etc/printers.conf. Is there some other way to
do this which will not break the next time we upgrade?

Summary of responses:

In my original post, I did not make it totally clear that I was
looking for a way for application programs to display a list of
available printers.

I received a large number of suggestions to use lpstat -a
or lpstat -t and redirect it to a file. In the interests of brevity I won't
recap all of these.

The most usefull response was as follows:

From: David Thorburn-Gundlach <david@bae.uga.edu>

Peter --

/etc/printers.conf is the preferred method, and probably won't break.
SunOS used BSD-style printing and /etc/printcap, but Solaris moved to
SysV-style printing and /etc/lp/printers or some such. Unfortunately,
SysV printing ain't that great, and Sun finally moved to a SysV
compatible version of BSD printing (instead of trying to do it the
other way around), and they're expected to stay there.

:-D

Looks like my choice is either to take a chance that /etc/printers.conf
will not break on the next upgrade or to use the more complicated
approach with lpstat.

If I get any other suggestions, I will post another summary.

Thanks to everyone who replied.

Peter Schauss
ps4330@okc01.jccbi.gov
Gull Electronic Systems Division
Parker Hannifin Corporation
Smithtown, NY