| 165 | */ |
| 166 | |
| 167 | int /* O - 1 if supported, 0 otherwise */ |
| 168 | cupsCheckDestSupported( |
| 169 | http_t *http, /* I - Connection to destination */ |
| 170 | cups_dest_t *dest, /* I - Destination */ |
| 171 | cups_dinfo_t *dinfo, /* I - Destination information */ |
| 172 | const char *option, /* I - Option */ |
| 173 | const char *value) /* I - Value or @code NULL@ */ |
| 174 | { |
| 175 | int i; /* Looping var */ |
| 176 | char temp[1024]; /* Temporary string */ |
| 177 | int int_value; /* Integer value */ |
| 178 | int xres_value, /* Horizontal resolution */ |
| 179 | yres_value; /* Vertical resolution */ |
| 180 | ipp_res_t units_value; /* Resolution units */ |
| 181 | ipp_attribute_t *attr; /* Attribute */ |
| 182 | _ipp_value_t *attrval; /* Current attribute value */ |
| 183 | _ipp_option_t *map; /* Option mapping information */ |
| 184 | |
| 185 | |
| 186 | /* |
| 187 | * Get the default connection as needed... |
| 188 | */ |
| 189 | |
| 190 | if (!http) |
| 191 | http = _cupsConnect(); |
| 192 | |
| 193 | /* |
| 194 | * Range check input... |
| 195 | */ |
| 196 | |
| 197 | if (!http || !dest || !dinfo || !option) |
| 198 | return (0); |
| 199 | |
| 200 | /* |
| 201 | * Lookup the attribute... |
| 202 | */ |
| 203 | |
| 204 | if (strstr(option, "-supported")) |
| 205 | attr = ippFindAttribute(dinfo->attrs, option, IPP_TAG_ZERO); |
| 206 | else |
| 207 | { |
| 208 | snprintf(temp, sizeof(temp), "%s-supported", option); |
| 209 | attr = ippFindAttribute(dinfo->attrs, temp, IPP_TAG_ZERO); |
| 210 | } |
| 211 | |
| 212 | if (!attr) |
| 213 | return (0); |
| 214 | |
| 215 | if (!value) |
| 216 | return (1); |
| 217 | |
| 218 | /* |
| 219 | * Compare values... |
| 220 | */ |
| 221 | |
| 222 | if (!strcmp(option, "media") && !strncmp(value, "custom_", 7)) |
| 223 | { |
| 224 | /* |