2 * Simulated client test program for CUPS.
4 * Copyright 2017 by Apple Inc.
6 * These coded instructions, statements, and computer programs are the
7 * property of Apple Inc. and are protected by Federal copyright
8 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
9 * which should have been included with this file. If this file is
10 * missing or damaged, see the license at "http://www.cups.org/".
12 * This file is subject to the Apple OS-Developed Software exception.
16 * Include necessary headers...
21 #include <cups/cups.h>
22 #include <cups/raster.h>
23 #include <cups/string-private.h>
24 #include <cups/thread-private.h>
31 typedef struct _client_monitor_s
33 const char *uri
, /* Printer URI */
34 *hostname
, /* Hostname */
36 *resource
; /* Resource path */
37 int port
; /* Port number */
38 http_encryption_t encryption
; /* Use encryption? */
39 ipp_pstate_t printer_state
; /* Current printer state */
40 char printer_state_reasons
[1024];
41 /* Current printer-state-reasons */
42 int job_id
; /* Job ID for submitted job */
43 ipp_jstate_t job_state
; /* Current job state */
44 char job_state_reasons
[1024];
45 /* Current job-state-reasons */
53 static const char *make_raster_file(ipp_t
*response
, int grayscale
, char *tempname
, size_t tempsize
, const char **format
);
54 static void *monitor_printer(_client_monitor_t
*monitor
);
55 static void show_attributes(const char *title
, int request
, ipp_t
*ipp
);
56 static void show_capabilities(ipp_t
*response
);
57 static void usage(void);
61 * 'main()' - Main entry.
64 int /* O - Exit status */
65 main(int argc
, /* I - Number of command-line arguments */
66 char *argv
[]) /* I - Command-line arguments */
68 int i
; /* Looping var */
69 const char *opt
, /* Current option */
70 *uri
= NULL
, /* Printer URI */
75 int keepfile
= 0, /* Keep temp file? */
76 grayscale
= 0; /* Force grayscale? */
77 char tempfile
[1024] = "",
78 /* Temporary file (if any) */
79 scheme
[32], /* URI scheme */
80 userpass
[256], /* Username:password */
81 hostname
[256], /* Hostname */
82 resource
[256]; /* Resource path */
83 int port
; /* Port number */
84 http_encryption_t encryption
; /* Encryption mode */
85 _client_monitor_t monitor
; /* Monitoring data */
86 http_t
*http
; /* HTTP connection */
87 ipp_t
*request
, /* IPP request */
88 *response
; /* IPP response */
89 ipp_attribute_t
*attr
; /* IPP attribute */
90 static const char * const pattrs
[] = /* Printer attributes we are interested in */
94 "printer-description",
101 * Parse command-line options...
104 for (i
= 1; i
< argc
; i
++)
106 if (argv
[i
][0] == '-')
108 for (opt
= argv
[i
] + 1; *opt
; opt
++)
112 case 'f' : /* -f print-file */
115 puts("Print file can only be specified once.");
123 puts("Expected print file after '-f'.");
140 printf("Unknown option '-%c'.\n", *opt
);
146 else if (uri
|| (strncmp(argv
[i
], "ipp://", 6) && strncmp(argv
[i
], "ipps://", 7)))
148 printf("Unknown command-line argument '%s'.\n", argv
[i
]);
157 * Make sure we have everything we need.
162 puts("Expected printer URI.");
168 * Connect to the printer...
171 if (httpSeparateURI(HTTP_URI_CODING_ALL
, uri
, scheme
, sizeof(scheme
), userpass
, sizeof(userpass
), hostname
, sizeof(hostname
), &port
, resource
, sizeof(resource
)) < HTTP_URI_STATUS_OK
)
173 printf("Bad printer URI '%s'.\n", uri
);
180 if (!strcmp(scheme
, "https") || !strcmp(scheme
, "ipps"))
181 encryption
= HTTP_ENCRYPTION_ALWAYS
;
183 encryption
= HTTP_ENCRYPTION_IF_REQUESTED
;
185 if ((http
= httpConnect2(hostname
, port
, NULL
, AF_UNSPEC
, encryption
, 1, 0, NULL
)) == NULL
)
187 printf("Unable to connect to '%s' on port %d: %s\n", hostname
, port
, cupsLastErrorString());
192 * Query printer status and capabilities...
195 request
= ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES
);
196 ippAddString(request
, IPP_TAG_OPERATION
, IPP_TAG_URI
, "printer-uri", NULL
, uri
);
197 ippAddString(request
, IPP_TAG_OPERATION
, IPP_TAG_NAME
, "requesting-user-name", NULL
, cupsUser());
198 ippAddStrings(request
, IPP_TAG_OPERATION
, IPP_TAG_KEYWORD
, "requested-attributes", (int)(sizeof(pattrs
) / sizeof(pattrs
[0])), NULL
, pattrs
);
200 response
= cupsDoRequest(http
, request
, resource
);
202 show_capabilities(response
);
205 * Now figure out what we will be printing...
211 * User specified a print file, figure out the format...
214 if ((opt
= strrchr(printfile
, '.')) != NULL
)
217 * Guess the format from the extension...
220 if (!strcmp(opt
, ".jpg"))
221 printformat
= "image/jpeg";
222 else if (!strcmp(opt
, ".pdf"))
223 printformat
= "application/pdf";
224 else if (!strcmp(opt
, ".ps"))
225 printformat
= "application/postscript";
226 else if (!strcmp(opt
, ".pwg"))
227 printformat
= "image/pwg-raster";
228 else if (!strcmp(opt
, ".urf"))
229 printformat
= "image/urf";
231 printformat
= "application/octet-stream";
236 * Tell the printer to auto-detect...
239 printformat
= "application/octet-stream";
245 * No file specified, make something to test with...
248 if ((printfile
= make_raster_file(response
, grayscale
, tempfile
, sizeof(tempfile
), &printformat
)) == NULL
)
255 * Start monitoring the printer in the background...
258 memset(&monitor
, 0, sizeof(monitor
));
261 monitor
.hostname
= hostname
;
262 monitor
.resource
= resource
;
264 monitor
.encryption
= encryption
;
266 _cupsThreadCreate((_cups_thread_func_t
)monitor_printer
, &monitor
);
269 * Create the job and wait for completion...
272 request
= ippNewRequest(IPP_OP_CREATE_JOB
);
273 ippAddString(request
, IPP_TAG_OPERATION
, IPP_TAG_URI
, "printer-uri", NULL
, uri
);
274 ippAddString(request
, IPP_TAG_OPERATION
, IPP_TAG_NAME
, "requesting-user-name", NULL
, cupsUser());
276 if ((opt
= strrchr(printfile
, '/')) != NULL
)
281 ippAddString(request
, IPP_TAG_OPERATION
, IPP_TAG_NAME
, "job-name", NULL
, opt
);
283 show_attributes("Create-Job request", 1, request
);
285 response
= cupsDoRequest(http
, request
, resource
);
287 show_attributes("Create-Job response", 0, response
);
289 if (cupsLastError() >= IPP_STATUS_REDIRECTION_OTHER_SITE
)
291 printf("Unable to create print job: %s\n", cupsLastErrorString());
293 monitor
.job_state
= IPP_JSTATE_ABORTED
;
298 if ((attr
= ippFindAttribute(response
, "job-id", IPP_TAG_INTEGER
)) == NULL
)
300 puts("No job-id returned in Create-Job request.");
302 monitor
.job_state
= IPP_JSTATE_ABORTED
;
307 monitor
.job_id
= ippGetInteger(attr
, 0);
309 printf("CREATED JOB %d, sending %s of type %s\n", monitor
.job_id
, printfile
, printformat
);
313 request
= ippNewRequest(IPP_OP_SEND_DOCUMENT
);
314 ippAddString(request
, IPP_TAG_OPERATION
, IPP_TAG_URI
, "printer-uri", NULL
, uri
);
315 ippAddInteger(request
, IPP_TAG_OPERATION
, IPP_TAG_INTEGER
, "job-id", monitor
.job_id
);
316 ippAddString(request
, IPP_TAG_OPERATION
, IPP_TAG_NAME
, "requesting-user-name", NULL
, cupsUser());
317 ippAddString(request
, IPP_TAG_OPERATION
, IPP_TAG_MIMETYPE
, "document-format", NULL
, printformat
);
318 ippAddBoolean(request
, IPP_TAG_OPERATION
, "last-document", 1);
320 show_attributes("Send-Document request", 1, request
);
322 response
= cupsDoFileRequest(http
, request
, resource
, printfile
);
324 show_attributes("Send-Document response", 0, response
);
326 if (cupsLastError() >= IPP_STATUS_REDIRECTION_OTHER_SITE
)
328 printf("Unable to print file: %s\n", cupsLastErrorString());
330 monitor
.job_state
= IPP_JSTATE_ABORTED
;
335 puts("WAITING FOR JOB TO COMPLETE");
337 while (monitor
.job_state
< IPP_JSTATE_CANCELED
)
341 * Cleanup after ourselves...
348 if (tempfile
[0] && !keepfile
)
351 return (monitor
.job_state
== IPP_JSTATE_COMPLETED
);
356 * 'make_raster_file()' - Create a temporary raster file.
359 static const char * /* O - Print filename */
360 make_raster_file(ipp_t
*response
, /* I - Printer attributes */
361 int grayscale
, /* I - Force grayscale? */
362 char *tempname
, /* I - Temporary filename buffer */
363 size_t tempsize
, /* I - Size of temp file buffer */
364 const char **format
) /* O - Print format */
366 int i
, /* Looping var */
367 count
; /* Number of values */
368 ipp_attribute_t
*attr
; /* Printer attribute */
369 const char *type
= NULL
; /* Raster type (colorspace + bits) */
370 pwg_media_t
*media
= NULL
; /* Media size */
371 int xdpi
= 0, /* Horizontal resolution */
372 ydpi
= 0; /* Vertical resolution */
373 int fd
; /* Temporary file */
374 cups_mode_t mode
; /* Raster mode */
375 cups_raster_t
*ras
; /* Raster stream */
376 cups_page_header2_t header
; /* Page header */
377 unsigned char *line
, /* Line of raster data */
378 *lineptr
; /* Pointer into line */
379 unsigned y
, /* Current position on page */
380 xcount
, ycount
, /* Current count for X and Y */
381 xrep
, yrep
, /* Repeat count for X and Y */
382 xoff
, yoff
, /* Offsets for X and Y */
383 yend
; /* End Y value */
384 int temprow
, /* Row in template */
385 tempcolor
; /* Template color */
386 const char *template; /* Pointer into template */
387 const unsigned char *color
; /* Current color */
388 static const unsigned char colors
[][3] =
389 { /* Colors for test */
406 static const char * const templates
[] =
407 { /* Raster template */
408 " CCC U U PPPP SSS TTTTT EEEEE SSS TTTTT 000 1 222 333 4 55555 66 77777 888 999 ",
409 "C C U U P P S S T E S S T 0 0 11 2 2 3 3 4 4 5 6 7 8 8 9 9 ",
410 "C U U P P S T E S T 0 0 1 2 3 4 4 5 6 7 8 8 9 9 ",
411 "C U U PPPP SSS ----- T EEEE SSS T 0 0 0 1 22 333 44444 555 6666 7 888 9999 ",
412 "C U U P S T E S T 0 0 1 2 3 4 5 6 6 7 8 8 9 ",
413 "C C U U P S S T E S S T 0 0 1 2 3 3 4 5 5 6 6 7 8 8 9 ",
414 " CCC UUU P SSS T EEEEE SSS T 000 111 22222 333 4 555 666 7 888 99 ",
420 * Figure out the output format...
423 if ((attr
= ippFindAttribute(response
, "document-format-supported", IPP_TAG_MIMETYPE
)) == NULL
)
425 puts("No supported document formats, aborting.");
429 if (ippContainsString(attr
, "image/urf"))
432 * Apple Raster format...
435 *format
= "image/urf";
436 mode
= CUPS_RASTER_WRITE_APPLE
;
438 else if (ippContainsString(attr
, "image/pwg-raster"))
441 * PWG Raster format...
444 *format
= "image/pwg-raster";
445 mode
= CUPS_RASTER_WRITE_PWG
;
450 * No supported raster format...
453 puts("Printer does not support Apple or PWG raster files, aborting.");
458 * Figure out the the media, resolution, and color mode...
461 if ((attr
= ippFindAttribute(response
, "media-default", IPP_TAG_KEYWORD
)) != NULL
)
464 * Use default media...
467 media
= pwgMediaForPWG(ippGetString(attr
, 0, NULL
));
469 else if ((attr
= ippFindAttribute(response
, "media-ready", IPP_TAG_KEYWORD
)) != NULL
)
475 if (ippContainsString(attr
, "na_letter_8.5x11in"))
476 media
= pwgMediaForPWG("na_letter_8.5x11in");
477 else if (ippContainsString(attr
, "iso_a4_210x297mm"))
478 media
= pwgMediaForPWG("iso_a4_210x297mm");
480 media
= pwgMediaForPWG(ippGetString(attr
, 0, NULL
));
484 puts("No default or ready media reported by printer, aborting.");
488 if ((attr
= ippFindAttribute(response
, "urf-supported", IPP_TAG_KEYWORD
)) != NULL
)
490 for (i
= 0, count
= ippGetCount(attr
); i
< count
; i
++)
492 const char *val
= ippGetString(attr
, i
, NULL
);
494 if (!strncmp(val
, "RS", 2))
495 xdpi
= ydpi
= atoi(val
+ 2);
496 else if (!strncmp(val
, "W8", 2) && !type
)
498 else if (!strncmp(val
, "SRGB24", 6) && !grayscale
)
502 else if ((attr
= ippFindAttribute(response
, "pwg-raster-document-resolution-supported", IPP_TAG_RESOLUTION
)) != NULL
)
504 for (i
= 0, count
= ippGetCount(attr
); i
< count
; i
++)
506 int tempxdpi
, tempydpi
;
509 tempxdpi
= ippGetResolution(attr
, 0, &tempydpi
, &tempunits
);
511 if (i
== 0 || tempxdpi
< xdpi
|| tempydpi
< ydpi
)
518 if ((attr
= ippFindAttribute(response
, "pwg-raster-document-type-supported", IPP_TAG_KEYWORD
)) != NULL
)
520 if (!grayscale
&& ippContainsString(attr
, "srgb_8"))
522 else if (ippContainsString(attr
, "sgray_8"))
527 if (xdpi
< 72 || ydpi
< 72)
529 puts("No supported raster resolutions, aborting.");
535 puts("No supported color spaces or bit depths, aborting.");
540 * Make the raster context and details...
543 if (!cupsRasterInitPWGHeader(&header
, media
, type
, xdpi
, ydpi
, "one-sided", NULL
))
545 printf("Unable to initialize raster context: %s\n", cupsRasterErrorString());
549 header
.cupsInteger
[CUPS_RASTER_PWG_TotalPageCount
] = 1;
551 if (header
.cupsWidth
> (4 * header
.HWResolution
[0]))
553 xoff
= header
.HWResolution
[0] / 2;
554 yoff
= header
.HWResolution
[1] / 2;
562 xrep
= (header
.cupsWidth
- 2 * xoff
) / 140;
563 yrep
= xrep
* header
.HWResolution
[1] / header
.HWResolution
[0];
564 yend
= header
.cupsHeight
- yoff
;
567 * Prepare the raster file...
570 if ((line
= malloc(header
.cupsBytesPerLine
)) == NULL
)
572 printf("Unable to allocate %u bytes for raster output: %s\n", header
.cupsBytesPerLine
, strerror(errno
));
576 if ((fd
= cupsTempFd(tempname
, (int)tempsize
)) < 0)
578 printf("Unable to create temporary print file: %s\n", strerror(errno
));
582 if ((ras
= cupsRasterOpen(fd
, mode
)) == NULL
)
584 printf("Unable to open raster stream: %s\n", cupsRasterErrorString());
590 * Write a single page consisting of the template dots repeated over the page.
593 cupsRasterWriteHeader2(ras
, &header
);
595 memset(line
, 0xff, header
.cupsBytesPerLine
);
597 for (y
= 0; y
< yoff
; y
++)
598 cupsRasterWritePixels(ras
, line
, header
.cupsBytesPerLine
);
600 for (temprow
= 0, tempcolor
= 0; y
< yend
;)
602 template = templates
[temprow
];
603 color
= colors
[tempcolor
];
606 if (temprow
>= (int)(sizeof(templates
) / sizeof(templates
[0])))
610 if (tempcolor
>= (int)(sizeof(colors
) / sizeof(colors
[0])))
612 else if (tempcolor
> 3 && header
.cupsColorSpace
== CUPS_CSPACE_SW
)
616 memset(line
, 0xff, header
.cupsBytesPerLine
);
618 if (header
.cupsColorSpace
== CUPS_CSPACE_SW
)
621 * Do grayscale output...
624 for (lineptr
= line
+ xoff
; *template; template ++)
626 if (*template != ' ')
628 for (xcount
= xrep
; xcount
> 0; xcount
--)
643 for (lineptr
= line
+ 3 * xoff
; *template; template ++)
645 if (*template != ' ')
647 for (xcount
= xrep
; xcount
> 0; xcount
--, lineptr
+= 3)
648 memcpy(lineptr
, color
, 3);
657 for (ycount
= yrep
; ycount
> 0 && y
< yend
; ycount
--, y
++)
658 cupsRasterWritePixels(ras
, line
, header
.cupsBytesPerLine
);
661 memset(line
, 0xff, header
.cupsBytesPerLine
);
663 for (y
= 0; y
< header
.cupsHeight
; y
++)
664 cupsRasterWritePixels(ras
, line
, header
.cupsBytesPerLine
);
666 cupsRasterClose(ras
);
670 printf("PRINT FILE: %s\n", tempname
);
677 * 'monitor_printer()' - Monitor the job and printer states.
680 static void * /* O - Thread exit code */
682 _client_monitor_t
*monitor
) /* I - Monitoring data */
684 http_t
*http
; /* Connection to printer */
685 ipp_t
*request
, /* IPP request */
686 *response
; /* IPP response */
687 ipp_attribute_t
*attr
; /* Attribute in response */
688 ipp_pstate_t printer_state
; /* Printer state */
689 char printer_state_reasons
[1024];
690 /* Printer state reasons */
691 ipp_jstate_t job_state
; /* Job state */
692 char job_state_reasons
[1024];/* Printer state reasons */
693 static const char * const jattrs
[] = /* Job attributes we want */
698 static const char * const pattrs
[] = /* Printer attributes we want */
701 "printer-state-reasons"
706 * Open a connection to the printer...
709 http
= httpConnect2(monitor
->hostname
, monitor
->port
, NULL
, AF_UNSPEC
, monitor
->encryption
, 1, 0, NULL
);
712 * Loop until the job is canceled, aborted, or completed.
715 printer_state
= (ipp_pstate_t
)0;
716 printer_state_reasons
[0] = '\0';
718 job_state
= (ipp_jstate_t
)0;
719 job_state_reasons
[0] = '\0';
721 while (monitor
->job_state
< IPP_JSTATE_CANCELED
)
724 * Reconnect to the printer as needed...
727 if (httpGetFd(http
) < 0)
728 httpReconnect2(http
, 30000, NULL
);
730 if (httpGetFd(http
) >= 0)
733 * Connected, so check on the printer state...
736 request
= ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES
);
737 ippAddString(request
, IPP_TAG_OPERATION
, IPP_TAG_URI
, "printer-uri", NULL
, monitor
->uri
);
738 ippAddString(request
, IPP_TAG_OPERATION
, IPP_TAG_NAME
, "requesting-user-name", NULL
, cupsUser());
739 ippAddStrings(request
, IPP_TAG_OPERATION
, IPP_TAG_KEYWORD
, "requested-attributes", (int)(sizeof(pattrs
) / sizeof(pattrs
[0])), NULL
, pattrs
);
741 response
= cupsDoRequest(http
, request
, monitor
->resource
);
743 if ((attr
= ippFindAttribute(response
, "printer-state", IPP_TAG_ENUM
)) != NULL
)
744 printer_state
= (ipp_pstate_t
)ippGetInteger(attr
, 0);
746 if ((attr
= ippFindAttribute(response
, "printer-state-reasons", IPP_TAG_KEYWORD
)) != NULL
)
747 ippAttributeString(attr
, printer_state_reasons
, sizeof(printer_state_reasons
));
749 if (printer_state
!= monitor
->printer_state
|| strcmp(printer_state_reasons
, monitor
->printer_state_reasons
))
751 printf("PRINTER: %s (%s)\n", ippEnumString("printer-state", printer_state
), printer_state_reasons
);
753 monitor
->printer_state
= printer_state
;
754 strlcpy(monitor
->printer_state_reasons
, printer_state_reasons
, sizeof(monitor
->printer_state_reasons
));
759 if (monitor
->job_id
> 0)
762 * Check the status of the job itself...
765 request
= ippNewRequest(IPP_OP_GET_JOB_ATTRIBUTES
);
766 ippAddString(request
, IPP_TAG_OPERATION
, IPP_TAG_URI
, "printer-uri", NULL
, monitor
->uri
);
767 ippAddInteger(request
, IPP_TAG_OPERATION
, IPP_TAG_INTEGER
, "job-id", monitor
->job_id
);
768 ippAddString(request
, IPP_TAG_OPERATION
, IPP_TAG_NAME
, "requesting-user-name", NULL
, cupsUser());
769 ippAddStrings(request
, IPP_TAG_OPERATION
, IPP_TAG_KEYWORD
, "requested-attributes", (int)(sizeof(jattrs
) / sizeof(jattrs
[0])), NULL
, jattrs
);
771 response
= cupsDoRequest(http
, request
, monitor
->resource
);
773 if ((attr
= ippFindAttribute(response
, "job-state", IPP_TAG_ENUM
)) != NULL
)
774 job_state
= (ipp_jstate_t
)ippGetInteger(attr
, 0);
776 if ((attr
= ippFindAttribute(response
, "job-state-reasons", IPP_TAG_KEYWORD
)) != NULL
)
777 ippAttributeString(attr
, job_state_reasons
, sizeof(job_state_reasons
));
779 if (job_state
!= monitor
->job_state
|| strcmp(job_state_reasons
, monitor
->job_state_reasons
))
781 printf("JOB %d: %s (%s)\n", monitor
->job_id
, ippEnumString("job-state", job_state
), job_state_reasons
);
783 monitor
->job_state
= job_state
;
784 strlcpy(monitor
->job_state_reasons
, job_state_reasons
, sizeof(monitor
->job_state_reasons
));
791 if (monitor
->job_state
< IPP_JSTATE_CANCELED
)
794 * Sleep for 5 seconds...
802 * Cleanup and return...
812 * 'show_attributes()' - Show attributes in a request or response.
816 show_attributes(const char *title
, /* I - Title */
817 int request
, /* I - 1 for request, 0 for response */
818 ipp_t
*ipp
) /* I - IPP request/response */
820 int minor
, major
= ippGetVersion(ipp
, &minor
);
821 /* IPP version number */
822 ipp_tag_t group
= IPP_TAG_ZERO
;
823 /* Current group tag */
824 ipp_attribute_t
*attr
; /* Current attribute */
825 const char *name
; /* Attribute name */
826 char buffer
[1024]; /* Value */
829 printf("%s:\n", title
);
830 printf(" version=%d.%d\n", major
, minor
);
831 printf(" request-id=%d\n", ippGetRequestId(ipp
));
833 printf(" status-code=%s\n", ippErrorString(ippGetStatusCode(ipp
)));
835 for (attr
= ippFirstAttribute(ipp
); attr
; attr
= ippNextAttribute(ipp
))
837 if (group
!= ippGetGroupTag(attr
))
839 group
= ippGetGroupTag(attr
);
841 printf(" %s:\n", ippTagString(group
));
844 if ((name
= ippGetName(attr
)) != NULL
)
846 ippAttributeString(attr
, buffer
, sizeof(buffer
));
847 printf(" %s(%s%s)=%s\n", name
, ippGetCount(attr
) > 1 ? "1setOf " : "", ippTagString(ippGetValueTag(attr
)), buffer
);
854 * 'show_capabilities()' - Show printer capabilities.
858 show_capabilities(ipp_t
*response
) /* I - Printer attributes */
860 int i
; /* Looping var */
861 ipp_attribute_t
*attr
; /* Attribute */
862 char buffer
[1024]; /* Attribute value buffer */
863 static const char * const pattrs
[] = /* Attributes we want to show */
867 "finishings-default",
869 "finishings-supported",
873 "output-bin-default",
874 "output-bin-supported",
875 "print-color-mode-default",
876 "print-color-mode-supported",
879 "document-format-default",
880 "document-format-supported",
881 "pwg-raster-document-resolution-supported",
882 "pwg-raster-document-type-supported",
887 puts("CAPABILITIES:");
888 for (i
= 0; i
< (int)(sizeof(pattrs
) / sizeof(pattrs
[0])); i
++)
890 if ((attr
= ippFindAttribute(response
, pattrs
[i
], IPP_TAG_ZERO
)) != NULL
)
892 ippAttributeString(attr
, buffer
, sizeof(buffer
));
893 printf(" %s=%s\n", pattrs
[i
], buffer
);
900 * 'usage()' - Show program usage...
906 puts("Usage: ./testclient printer-uri [-f print-file]");