| 266 | */ |
| 267 | |
| 268 | static void |
| 269 | localize(http_t *http, /* I - Connection to destination */ |
| 270 | cups_dest_t *dest, /* I - Destination */ |
| 271 | cups_dinfo_t *dinfo, /* I - Destination information */ |
| 272 | const char *option, /* I - Option */ |
| 273 | const char *value) /* I - Value, if any */ |
| 274 | { |
| 275 | ipp_attribute_t *attr; /* Attribute */ |
| 276 | int i, /* Looping var */ |
| 277 | count; /* Number of values */ |
| 278 | |
| 279 | |
| 280 | if (!option) |
| 281 | { |
| 282 | attr = cupsFindDestSupported(http, dest, dinfo, "job-creation-attributes"); |
| 283 | if (attr) |
| 284 | { |
| 285 | count = ippGetCount(attr); |
| 286 | for (i = 0; i < count; i ++) |
| 287 | localize(http, dest, dinfo, ippGetString(attr, i, NULL), NULL); |
| 288 | } |
| 289 | else |
| 290 | { |
| 291 | static const char * const options[] = |
| 292 | { /* List of standard options */ |
| 293 | CUPS_COPIES, |
| 294 | CUPS_FINISHINGS, |
| 295 | CUPS_MEDIA, |
| 296 | CUPS_NUMBER_UP, |
| 297 | CUPS_ORIENTATION, |
| 298 | CUPS_PRINT_COLOR_MODE, |
| 299 | CUPS_PRINT_QUALITY, |
| 300 | CUPS_SIDES |
| 301 | }; |
| 302 | |
| 303 | puts("No job-creation-attributes-supported attribute, probing instead."); |
| 304 | |
| 305 | for (i = 0; i < (int)(sizeof(options) / sizeof(options[0])); i ++) |
| 306 | if (cupsCheckDestSupported(http, dest, dinfo, options[i], NULL)) |
| 307 | localize(http, dest, dinfo, options[i], NULL); |
| 308 | } |
| 309 | } |
| 310 | else if (!value) |
| 311 | { |
| 312 | printf("%s (%s)\n", option, cupsLocalizeDestOption(http, dest, dinfo, option)); |
| 313 | |
| 314 | if ((attr = cupsFindDestSupported(http, dest, dinfo, option)) != NULL) |
| 315 | { |
| 316 | count = ippGetCount(attr); |
| 317 | |
| 318 | switch (ippGetValueTag(attr)) |
| 319 | { |
| 320 | case IPP_TAG_INTEGER : |
| 321 | for (i = 0; i < count; i ++) |
| 322 | printf(" %d\n", ippGetInteger(attr, i)); |
| 323 | break; |
| 324 | |
| 325 | case IPP_TAG_ENUM : |
no test coverage detected