Get list of installed printers

I also need a list of printers and had the same concern. Following the above suggestion I checked the source of lpstat.c . I was expecting it to be a suid so it could read "/etc/cups/printers.conf" . I now realise it does not do this.

Instead it sends a HTTP POST request to localhost:631 where cupsd runs. The request is of the form Content-Type: application/ipp and things such as requested-attributes auth-info-required . The reason not to be more specific is that it uses a non-standard encoding (see: http://en.wikipedia.org/wiki/Internet_Printing_Protocol) ... so I suspect actually parsing the output of lpstat -a is actually cleaner.


It's been six years since the original question, I'm using Cups 2.2.7 And still 'lpstat -a' returns the name of the printer in the first word. So I think it is safe to assume that it will continue as the right way to get a list of installed printers.