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

Function cupsResolveConflicts

cups/ppd-conflicts.c:164–558  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162 */
163
164int /* O - 1 on success, 0 on failure */
165cupsResolveConflicts(
166 ppd_file_t *ppd, /* I - PPD file */
167 const char *option, /* I - Newly selected option or @code NULL@ for none */
168 const char *choice, /* I - Newly selected choice or @code NULL@ for none */
169 int *num_options, /* IO - Number of additional selected options */
170 cups_option_t **options) /* IO - Additional selected options */
171{
172 int i, /* Looping var */
173 tries, /* Number of tries */
174 num_newopts; /* Number of new options */
175 cups_option_t *newopts; /* New options */
176 cups_array_t *active = NULL, /* Active constraints */
177 *pass, /* Resolvers for this pass */
178 *resolvers, /* Resolvers we have used */
179 *test; /* Test array for conflicts */
180 _ppd_cups_uiconsts_t *consts; /* Current constraints */
181 _ppd_cups_uiconst_t *constptr; /* Current constraint */
182 ppd_attr_t *resolver; /* Current resolver */
183 const char *resval; /* Pointer into resolver value */
184 char resoption[PPD_MAX_NAME],
185 /* Current resolver option */
186 reschoice[PPD_MAX_NAME],
187 /* Current resolver choice */
188 *resptr, /* Pointer into option/choice */
189 firstpage[255]; /* AP_FIRSTPAGE_Keyword string */
190 const char *value; /* Selected option value */
191 int changed; /* Did we change anything? */
192 ppd_choice_t *marked; /* Marked choice */
193
194
195 /*
196 * Range check input...
197 */
198
199 if (!ppd || !num_options || !options || (option == NULL) != (choice == NULL))
200 return (0);
201
202 /*
203 * Build a shadow option array...
204 */
205
206 num_newopts = 0;
207 newopts = NULL;
208
209 for (i = 0; i < *num_options; i ++)
210 num_newopts = cupsAddOption((*options)[i].name, (*options)[i].value,
211 num_newopts, &newopts);
212 if (option && _cups_strcasecmp(option, "Collate"))
213 num_newopts = cupsAddOption(option, choice, num_newopts, &newopts);
214
215 /*
216 * Loop until we have no conflicts...
217 */
218
219 cupsArraySave(ppd->sorted_attrs);
220
221 resolvers = NULL;

Callers 3

check_constraintsFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 15

cupsAddOptionFunction · 0.85
_cups_strcasecmpFunction · 0.85
cupsArraySaveFunction · 0.85
cupsArrayNewFunction · 0.85
ppd_test_constraintsFunction · 0.85
cupsArrayFirstFunction · 0.85
cupsArrayNextFunction · 0.85
cupsArrayFindFunction · 0.85
ppdFindAttrFunction · 0.85
cupsArrayAddFunction · 0.85
_cups_isspaceFunction · 0.85
cupsArrayDeleteFunction · 0.85

Tested by 3

check_constraintsFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68