summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorMichael Sweet <michael.r.sweet@gmail.com>2017-08-29 19:56:08 -0400
committerMichael Sweet <michael.r.sweet@gmail.com>2017-08-29 19:56:08 -0400
commit5535551fd979791794cb45704286d585787b74a3 (patch)
treeb58ab2653e54e525080b7852c1b803a1d22cec13 /filter
parent7f14a297987bf146db3670f35e717041adca356a (diff)
downloadcups-5535551fd979791794cb45704286d585787b74a3.tar.gz
Add -d (document-format) option to override which format is used.
Diffstat (limited to 'filter')
-rw-r--r--filter/testclient.c50
1 files changed, 46 insertions, 4 deletions
diff --git a/filter/testclient.c b/filter/testclient.c
index a5f7a1df0..5ae8e6366 100644
--- a/filter/testclient.c
+++ b/filter/testclient.c
@@ -109,6 +109,25 @@ main(int argc, /* I - Number of command-line arguments */
{
switch (*opt)
{
+ case 'd' : /* -d document-format */
+ if (printformat)
+ {
+ puts("Document format can only be specified once.");
+ usage();
+ return (1);
+ }
+
+ i ++;
+ if (i >= argc)
+ {
+ puts("Expected document format after '-d'.");
+ usage();
+ return (1);
+ }
+
+ printformat = argv[i];
+ break;
+
case 'f' : /* -f print-file */
if (printfile)
{
@@ -426,7 +445,25 @@ make_raster_file(ipp_t *response, /* I - Printer attributes */
return (NULL);
}
- if (ippContainsString(attr, "image/urf"))
+ if (*format)
+ {
+ if (!ippContainsString(attr, *format))
+ {
+ printf("Printer does not support document-format '%s'.\n", *format);
+ return (NULL);
+ }
+
+ if (!strcmp(*format, "image/urf"))
+ mode = CUPS_RASTER_WRITE_APPLE;
+ else if (!strcmp(*format, "image/pwg-raster"))
+ mode = CUPS_RASTER_WRITE_PWG;
+ else
+ {
+ printf("Unable to generate document-format '%s'.\n", *format);
+ return (NULL);
+ }
+ }
+ else if (ippContainsString(attr, "image/urf"))
{
/*
* Apple Raster format...
@@ -485,7 +522,7 @@ make_raster_file(ipp_t *response, /* I - Printer attributes */
return (NULL);
}
- if ((attr = ippFindAttribute(response, "urf-supported", IPP_TAG_KEYWORD)) != NULL)
+ if (mode == CUPS_RASTER_WRITE_APPLE && (attr = ippFindAttribute(response, "urf-supported", IPP_TAG_KEYWORD)) != NULL)
{
for (i = 0, count = ippGetCount(attr); i < count; i ++)
{
@@ -499,7 +536,7 @@ make_raster_file(ipp_t *response, /* I - Printer attributes */
type = "srgb_8";
}
}
- else if ((attr = ippFindAttribute(response, "pwg-raster-document-resolution-supported", IPP_TAG_RESOLUTION)) != NULL)
+ else if (mode == CUPS_RASTER_WRITE_PWG && (attr = ippFindAttribute(response, "pwg-raster-document-resolution-supported", IPP_TAG_RESOLUTION)) != NULL)
{
for (i = 0, count = ippGetCount(attr); i < count; i ++)
{
@@ -903,5 +940,10 @@ show_capabilities(ipp_t *response) /* I - Printer attributes */
static void
usage(void)
{
- puts("Usage: ./testclient printer-uri [-f print-file]");
+ puts("Usage: ./testclient printer-uri [options]");
+ puts("Options:");
+ puts(" -d document-format Generate the specified format");
+ puts(" -f print-file Print the named file");
+ puts(" -g Force grayscale printing");
+ puts(" -k Keep temporary files");
}