| 63 | */ |
| 64 | |
| 65 | int /* O - Number of conflicting options */ |
| 66 | cupsGetConflicts( |
| 67 | ppd_file_t *ppd, /* I - PPD file */ |
| 68 | const char *option, /* I - Option to test */ |
| 69 | const char *choice, /* I - Choice to test */ |
| 70 | cups_option_t **options) /* O - Conflicting options */ |
| 71 | { |
| 72 | int i, /* Looping var */ |
| 73 | num_options; /* Number of conflicting options */ |
| 74 | cups_array_t *active; /* Active conflicts */ |
| 75 | _ppd_cups_uiconsts_t *c; /* Current constraints */ |
| 76 | _ppd_cups_uiconst_t *cptr; /* Current constraint */ |
| 77 | ppd_choice_t *marked; /* Marked choice */ |
| 78 | |
| 79 | |
| 80 | /* |
| 81 | * Range check input... |
| 82 | */ |
| 83 | |
| 84 | if (options) |
| 85 | *options = NULL; |
| 86 | |
| 87 | if (!ppd || !option || !choice || !options) |
| 88 | return (0); |
| 89 | |
| 90 | /* |
| 91 | * Test for conflicts... |
| 92 | */ |
| 93 | |
| 94 | active = ppd_test_constraints(ppd, option, choice, 0, NULL, |
| 95 | _PPD_ALL_CONSTRAINTS); |
| 96 | |
| 97 | /* |
| 98 | * Loop through all of the UI constraints and add any options that conflict... |
| 99 | */ |
| 100 | |
| 101 | for (num_options = 0, c = (_ppd_cups_uiconsts_t *)cupsArrayFirst(active); |
| 102 | c; |
| 103 | c = (_ppd_cups_uiconsts_t *)cupsArrayNext(active)) |
| 104 | { |
| 105 | for (i = c->num_constraints, cptr = c->constraints; |
| 106 | i > 0; |
| 107 | i --, cptr ++) |
| 108 | if (_cups_strcasecmp(cptr->option->keyword, option)) |
| 109 | { |
| 110 | if (cptr->choice) |
| 111 | num_options = cupsAddOption(cptr->option->keyword, |
| 112 | cptr->choice->choice, num_options, |
| 113 | options); |
| 114 | else if ((marked = ppdFindMarkedChoice(ppd, |
| 115 | cptr->option->keyword)) != NULL) |
| 116 | num_options = cupsAddOption(cptr->option->keyword, marked->choice, |
| 117 | num_options, options); |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | cupsArrayDelete(active); |
| 122 | |