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

Function _ppdParseOptions

cups/ppd-mark.c:609–681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

607 */
608
609int /* O - Number of options */
610_ppdParseOptions(
611 const char *s, /* I - String to parse */
612 int num_options, /* I - Number of options */
613 cups_option_t **options, /* IO - Options */
614 _ppd_parse_t which) /* I - What to parse */
615{
616 char option[PPD_MAX_NAME * 2 + 1], /* Current option/property */
617 choice[PPD_MAX_NAME], /* Current choice/value */
618 *ptr; /* Pointer into option or choice */
619
620
621 if (!s)
622 return (num_options);
623
624 /*
625 * Read all of the "*Option Choice" and "property value" pairs from the
626 * string, add them to an options array as we go...
627 */
628
629 while (*s)
630 {
631 /*
632 * Skip leading whitespace...
633 */
634
635 while (_cups_isspace(*s))
636 s ++;
637
638 /*
639 * Get the option/property name...
640 */
641
642 ptr = option;
643 while (*s && !_cups_isspace(*s) && ptr < (option + sizeof(option) - 1))
644 *ptr++ = *s++;
645
646 if (ptr == s || !_cups_isspace(*s))
647 break;
648
649 *ptr = '\0';
650
651 /*
652 * Get the choice...
653 */
654
655 while (_cups_isspace(*s))
656 s ++;
657
658 if (!*s)
659 break;
660
661 ptr = choice;
662 while (*s && !_cups_isspace(*s) && ptr < (choice + sizeof(choice) - 1))
663 *ptr++ = *s++;
664
665 if (*s && !_cups_isspace(*s))
666 break;

Callers 2

_ppdCacheCreateWithPPDFunction · 0.85
ppd_mark_choicesFunction · 0.85

Calls 2

_cups_isspaceFunction · 0.85
cupsAddOptionFunction · 0.85

Tested by

no test coverage detected