Why does cups pass the device URL to backends as ARGV[0]?

Michael Sweet mike at easysw.com
Sat May 2 08:32:22 PDT 2009


Hadmut Danisch wrote:
> Hi,
> 
> just a question. I sometimes need to debug problems with printing with cups.
> 
> And in most cases I run against the same problem again and again, i.e. that the backend drivers can't be used from the command line for debugging, because the device URL is to be passed as ARGV[0] (where usually the path of the program resides) instead of ARGV[1] (where the parameters usually starts).
> 
> This looks like a silly, if not one of the worst ever, design decisions.
> 
> Is there any good reason at all for doing so?

The good reason originally was to preserve as much as possible from
the System V printing interface while allowing a program to act as
filter or backend based on the command-line contents.

If you read "man backend" and "man filter" you'll notice that the
device URI is also in an environment variable (and that's actually
where you want to get it from - the argv[0] version is sanitized for
security reasons...)

Similarly, the printer name (passed to filters in argv[0]) is also
available in the environment.

-- 
______________________________________________________________________
Michael Sweet, Easy Software Products           mike at easysw dot com




More information about the cups-devel mailing list