MCPcopy Create free account
hub / github.com/OpenPrinting/cups / include_feature

Function include_feature

filter/pstops.c:2138–2193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2136 */
2137
2138static int /* O - New number of options */
2139include_feature(
2140 ppd_file_t *ppd, /* I - PPD file */
2141 const char *line, /* I - DSC line */
2142 int num_options, /* I - Number of options */
2143 cups_option_t **options) /* IO - Options */
2144{
2145 char name[255], /* Option name */
2146 value[255]; /* Option value */
2147 ppd_option_t *option; /* Option in file */
2148
2149
2150 /*
2151 * Get the "%%IncludeFeature: *Keyword OptionKeyword" values...
2152 */
2153
2154 if (sscanf(line + 17, "%254s%254s", name, value) != 2)
2155 {
2156 fputs("DEBUG: The %%IncludeFeature: comment is not valid.\n", stderr);
2157 return (num_options);
2158 }
2159
2160 /*
2161 * Find the option and choice...
2162 */
2163
2164 if ((option = ppdFindOption(ppd, name + 1)) == NULL)
2165 {
2166 _cupsLangPrintFilter(stderr, "WARNING", _("Unknown option \"%s\"."),
2167 name + 1);
2168 return (num_options);
2169 }
2170
2171 if (option->section == PPD_ORDER_EXIT ||
2172 option->section == PPD_ORDER_JCL)
2173 {
2174 _cupsLangPrintFilter(stderr, "WARNING",
2175 _("Option \"%s\" cannot be included via "
2176 "%%%%IncludeFeature."), name + 1);
2177 return (num_options);
2178 }
2179
2180 if (!ppdFindChoice(option, value))
2181 {
2182 _cupsLangPrintFilter(stderr, "WARNING",
2183 _("Unknown choice \"%s\" for option \"%s\"."),
2184 value, name + 1);
2185 return (num_options);
2186 }
2187
2188 /*
2189 * Add the option to the option array and return...
2190 */
2191
2192 return (cupsAddOption(name + 1, value, num_options, options));
2193}
2194
2195

Callers 2

copy_pageFunction · 0.85
copy_setupFunction · 0.85

Calls 4

ppdFindOptionFunction · 0.85
_cupsLangPrintFilterFunction · 0.85
ppdFindChoiceFunction · 0.85
cupsAddOptionFunction · 0.85

Tested by

no test coverage detected