- switch (attr->value_tag)
- {
- case IPP_TAG_INTEGER :
- case IPP_TAG_ENUM :
- for (i = 0; i < attr->num_values; i ++)
- if (Output == _CUPS_OUTPUT_PLIST)
- printf("<integer>%d</integer>\n", attr->values[i].integer);
- else
- printf("%d ", attr->values[i].integer);
- break;
-
- case IPP_TAG_BOOLEAN :
- for (i = 0; i < attr->num_values; i ++)
- if (Output == _CUPS_OUTPUT_PLIST)
- puts(attr->values[i].boolean ? "<true />" : "<false />");
- else if (attr->values[i].boolean)
- fputs("true ", stdout);
- else
- fputs("false ", stdout);
- break;
-
- case IPP_TAG_RANGE :
- for (i = 0; i < attr->num_values; i ++)
- if (Output == _CUPS_OUTPUT_PLIST)
- printf("<dict><key>lower</key><integer>%d</integer>"
- "<key>upper</key><integer>%d</integer></dict>\n",
- attr->values[i].range.lower, attr->values[i].range.upper);
- else
- printf("%d-%d ", attr->values[i].range.lower,
- attr->values[i].range.upper);
- break;
-
- case IPP_TAG_RESOLUTION :
- for (i = 0; i < attr->num_values; i ++)
- if (Output == _CUPS_OUTPUT_PLIST)
- printf("<dict><key>xres</key><integer>%d</integer>"
- "<key>yres</key><integer>%d</integer>"
- "<key>units</key><string>%s</string></dict>\n",
- attr->values[i].resolution.xres,
- attr->values[i].resolution.yres,
- attr->values[i].resolution.units == IPP_RES_PER_INCH ?
- "dpi" : "dpcm");
- else
- printf("%dx%d%s ", attr->values[i].resolution.xres,
- attr->values[i].resolution.yres,
- attr->values[i].resolution.units == IPP_RES_PER_INCH ?
- "dpi" : "dpcm");
- break;
-
- case IPP_TAG_DATE :
- for (i = 0; i < attr->num_values; i ++)
- if (Output == _CUPS_OUTPUT_PLIST)
- printf("<date>%s</date>\n", iso_date(attr->values[i].date));
- else
- printf("%s ", iso_date(attr->values[i].date));
- break;
-
- case IPP_TAG_STRING :
- for (i = 0; i < attr->num_values; i ++)
- {
- if (Output == _CUPS_OUTPUT_PLIST)
- {
- char buffer[IPP_MAX_LENGTH * 5 / 4 + 1];
- /* Output buffer */
-
- printf("<data>%s</data>\n",
- httpEncode64_2(buffer, sizeof(buffer),
- attr->values[i].unknown.data,
- attr->values[i].unknown.length));
- }
- else
- {
- char *ptr, /* Pointer into data */
- *end; /* End of data */
-
- putchar('\"');
- for (ptr = attr->values[i].unknown.data,
- end = ptr + attr->values[i].unknown.length;
- ptr < end;
- ptr ++)
- {
- if (*ptr == '\\' || *ptr == '\"')
- printf("\\%c", *ptr);
- else if (!isprint(*ptr & 255))
- printf("\\%03o", *ptr & 255);
- else
- putchar(*ptr);
- }
- putchar('\"');
- }
- }
- break;
-
- case IPP_TAG_TEXT :
- case IPP_TAG_NAME :
- case IPP_TAG_KEYWORD :
- case IPP_TAG_CHARSET :
- case IPP_TAG_URI :
- case IPP_TAG_MIMETYPE :
- case IPP_TAG_LANGUAGE :
- for (i = 0; i < attr->num_values; i ++)
- if (Output == _CUPS_OUTPUT_PLIST)
- print_xml_string("string", attr->values[i].string.text);
- else
- printf("\"%s\" ", attr->values[i].string.text);
- break;
-
- case IPP_TAG_TEXTLANG :
- case IPP_TAG_NAMELANG :
- for (i = 0; i < attr->num_values; i ++)
- if (Output == _CUPS_OUTPUT_PLIST)
- {
- fputs("<dict><key>language</key><string>", stdout);
- print_xml_string(NULL, attr->values[i].string.language);
- fputs("</string><key>string</key><string>", stdout);
- print_xml_string(NULL, attr->values[i].string.text);
- puts("</string></dict>");
- }
- else
- printf("\"%s\"[%s] ", attr->values[i].string.text,
- attr->values[i].string.language);
- break;
-
- case IPP_TAG_BEGIN_COLLECTION :
- for (i = 0; i < attr->num_values; i ++)
- {
- if (Output == _CUPS_OUTPUT_PLIST)
- {
- puts("<dict>");
- for (colattr = attr->values[i].collection->attrs;
- colattr;
- colattr = colattr->next)
- print_attr(colattr, NULL);
- puts("</dict>");
- }
- else
- {
- if (i)
- putchar(' ');
-
- print_col(attr->values[i].collection);
- }
- }
- break;
-
- default :
- if (Output == _CUPS_OUTPUT_PLIST)
- printf("<string><<%s>></string>\n",
- ippTagString(attr->value_tag));
- else
- fputs(ippTagString(attr->value_tag), stdout);
- break;
- }
-
- if (attr->num_values > 1)
- puts("</array>");