SUMMARY: Determining available printers

From: Peter Schauss x 2014 (
Date: Thu Apr 02 1998 - 08:46:54 CST

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 <>

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.


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
Gull Electronic Systems Division
Parker Hannifin Corporation
Smithtown, NY

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:35 CDT