[cups] How to get the value of ServerRoot?

Jacob Marble jacobmarble at google.com
Mon Nov 30 09:42:36 PST 2015


Thanks, Michael. I'll avoid calling cups-config at runtime.

My code calls cupsGetPPD3 every 10s to 60m, depending on configuration. Due
to this relatively high frequency, I retain the resulting PPD file until my
service is halted, though I only read the file when it changes. Someone
suggested that a custom cupsGetPPD3 be written in order to not retain the
file.

Since your reply, I have reviewed the documentation for cupsGetPPD3. It
appears that I could delete the resulting PPD file immediately, retaining
only the modtime parameter for subsequent calls to cupsGetPPD3. I will try
this approach next.

Jacob

On Mon, Nov 30, 2015 at 8:25 AM, Michael Sweet <msweet at apple.com> wrote:

> Jacob,
>
> First question: is there a reason why you can't just use cupsGetPPD3?
>
> Assuming that you really do need to implement your own version, and
> assuming you want to optimize access to PPD files, calling 'cups-config
> --serverroot' at build time to get the default PPD directory is
> appropriate.  The libcups code also allows run-time overrides using the
> CUPS_SERVERROOT environment variable.  But don't try to run cups-config at
> run-time - it is a developer tool and not part of the standard CUPS install
> on most systems.
>
>
> > On Nov 13, 2015, at 11:34 PM, Jacob Marble <jacobmarble at google.com>
> wrote:
> >
> > I need to write a new cupsGetPPD()-like function, including the hack
> > in cupsGetPPD3() under the comment "See if the PPD file is available
> > locally". This code attempts to fetch a PPD via the local filesystem,
> > if the server is localhost or /anything.
> >
> > The problem with writing my own implementation is that the "cups
> > globals" are private, so my client code doesn't have access to the
> > value of ServerRoot. Certainly, I could go read cups-files.conf
> > myself, but ServerRoot isn't guaranteed to be set, allowing for the
> > default value, which varies by operating system.
> >
> > The only other option I see is to call cups-config --serverroot from
> > the shell, which is kind of a hack.
> >
> > Is there a better way to programmatically get the value of ServerRoot
> > from client code?
> >
> > Thank you,
> >
> > Jacob
> > _______________________________________________
> > cups mailing list
> > cups at cups.org
> > https://www.cups.org/mailman/listinfo/cups
>
> _________________________________________________________
> Michael Sweet, Senior Printing System Engineer
>
> _______________________________________________
> cups mailing list
> cups at cups.org
> https://www.cups.org/mailman/listinfo/cups
>



More information about the cups mailing list