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

Function show_default

cups/testdest.c:491–528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

489 */
490
491static void
492show_default(http_t *http, /* I - Connection to destination */
493 cups_dest_t *dest, /* I - Destination */
494 cups_dinfo_t *dinfo, /* I - Destination information */
495 const char *option) /* I - Option */
496{
497 if (!strcmp(option, "media"))
498 {
499 /*
500 * Show default media option...
501 */
502
503 cups_size_t size; /* Media size information */
504
505 if (cupsGetDestMediaDefault(http, dest, dinfo, CUPS_MEDIA_FLAGS_DEFAULT, &size))
506 printf("%s (%.2fx%.2fmm, margins=[%.2f %.2f %.2f %.2f])\n", size.media, size.width * 0.01, size.length * 0.01, size.left * 0.01, size.bottom * 0.01, size.right * 0.01, size.top * 0.01);
507 else
508 puts("FAILED");
509 }
510 else
511 {
512 /*
513 * Show default other option...
514 */
515
516 ipp_attribute_t *defattr; /* Default attribute */
517
518 if ((defattr = cupsFindDestDefault(http, dest, dinfo, option)) != NULL)
519 {
520 char value[1024]; /* Value of default attribute */
521
522 ippAttributeString(defattr, value, sizeof(value));
523 puts(value);
524 }
525 else
526 puts("FAILED");
527 }
528}
529
530
531/*

Callers 1

mainFunction · 0.70

Calls 3

cupsGetDestMediaDefaultFunction · 0.85
cupsFindDestDefaultFunction · 0.85
ippAttributeStringFunction · 0.85

Tested by

no test coverage detected