| 2136 | */ |
| 2137 | |
| 2138 | static int /* O - New number of options */ |
| 2139 | include_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 |
no test coverage detected