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

Function with_value

tools/ipptool.c:5823–6396  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5821 */
5822
5823static int /* O - 1 on match, 0 on non-match */
5824with_value(ipptool_test_t *data, /* I - Test data */
5825 cups_array_t *errors, /* I - Errors array */
5826 char *value, /* I - Value string */
5827 int flags, /* I - Flags for match */
5828 ipp_attribute_t *attr, /* I - Attribute to compare */
5829 char *matchbuf, /* I - Buffer to hold matching value */
5830 size_t matchlen) /* I - Length of match buffer */
5831{
5832 int i, /* Looping var */
5833 count, /* Number of values */
5834 match; /* Match? */
5835 char temp[1024], /* Temporary value string */
5836 *valptr; /* Pointer into value */
5837 const char *name; /* Attribute name */
5838
5839
5840 *matchbuf = '\0';
5841 match = (flags & IPPTOOL_WITH_ALL) ? 1 : 0;
5842
5843 /*
5844 * NULL matches everything.
5845 */
5846
5847 if (!value || !*value)
5848 return (1);
5849
5850 /*
5851 * Compare the value string to the attribute value.
5852 */
5853
5854 name = ippGetName(attr);
5855 count = ippGetCount(attr);
5856
5857 switch (ippGetValueTag(attr))
5858 {
5859 case IPP_TAG_INTEGER :
5860 case IPP_TAG_ENUM :
5861 for (i = 0; i < count; i ++)
5862 {
5863 char op, /* Comparison operator */
5864 *nextptr; /* Next pointer */
5865 int intvalue, /* Integer value */
5866 attrvalue = ippGetInteger(attr, i),
5867 /* Attribute value */
5868 valmatch = 0; /* Does the current value match? */
5869
5870 valptr = value;
5871
5872 while (isspace(*valptr & 255) || isdigit(*valptr & 255) ||
5873 *valptr == '-' || *valptr == ',' || *valptr == '<' ||
5874 *valptr == '=' || *valptr == '>')
5875 {
5876 op = '=';
5877 while (*valptr && !isdigit(*valptr & 255) && *valptr != '-')
5878 {
5879 if (*valptr == '<' || *valptr == '>' || *valptr == '=')
5880 op = *valptr;

Callers 2

do_monitor_printer_stateFunction · 0.85
do_testFunction · 0.85

Calls 15

ippGetNameFunction · 0.85
ippGetCountFunction · 0.85
ippGetValueTagFunction · 0.85
ippGetIntegerFunction · 0.85
add_stringfFunction · 0.85
ippGetRangeFunction · 0.85
ippGetBooleanFunction · 0.85
ippGetResolutionFunction · 0.85
regcompFunction · 0.85
regerrorFunction · 0.85
print_fatal_errorFunction · 0.85
regexecFunction · 0.85

Tested by

no test coverage detected