CAPS Universe documentation  1.0.4
All you need to know to be successful
libcapsppd Development

Retrieving a user's selection

In order to retrieve the user's selection at run-time, you must first query for the Default<optionname> entry. Its .value member defines the selection made. With the value of the .value member search for the selection entry and then you have access to all members.

const char *economode_value;
struct caps_ppd_option *default_economode_option;
struct caps_ppd_option *economode_option;
default_economode_option = caps_ppd_option_get(job->ppd_options, "DefaultEconomode");
economode_option = caps_pp_job_value_get(job->ppd_options, "Economode", default_economode_option->value);
economode_value = economode_option->value; // success
struct caps_ppd_option * caps_ppd_option_get(const struct caps_ppd_options_table *pot, const char *keyword)
Definition: libcapsppd.c:162
Structure to keep the information read-in from an external PPD files.
Definition: libcapsppd-api.h:151
const char * value
Definition: libcapsppd-api.h:158

Another way would be to retrieve the "DefaultEconomode" selection and use its value to search in your original data (e.g. the econo_mode_selections array shown a few lines above) for all required values.

But there is a convenience function available which does the complicated part for you:

const char *economode_value;
economode_value = caps_pp_job_choice_get(job, "EconoMode"); // success