From dc84a5a4cdb6900256a6ea9f627336bc19903dcc Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Wed, 24 Apr 2019 18:35:00 -0400 Subject: [PATCH] Update man pages. Default manufacturer is now "Example". Add support for DEBUG:, ERROR:, and INFO: messages from print commands. Info and error messages get copied to the job-state-message attribute. Add support for updating printer-alert-description attributes. --- doc/help/man-client.conf.html | 16 ++++ doc/help/man-cupsd.conf.html | 12 ++- doc/help/man-ippevepcl.html | 7 +- doc/help/man-ippeveprinter.html | 86 +++++++++++++++++---- man/ippevepcl.man | 11 +-- man/ippeveprinter.man | 100 +++++++++++++++++++++---- test/ippeveprinter.c | 129 +++++++++++++++++++++----------- test/ippeveps.c | 11 ++- 8 files changed, 281 insertions(+), 91 deletions(-) diff --git a/doc/help/man-client.conf.html b/doc/help/man-client.conf.html index 879213735..4cf714c96 100644 --- a/doc/help/man-client.conf.html +++ b/doc/help/man-client.conf.html @@ -60,6 +60,22 @@ Not all operating systems support TLS 1.3 at this time. The default is "Yes".
User name
Specifies the default user name to use for requests. +
UserAgentTokens None +
UserAgentTokens ProductOnly +
UserAgentTokens Major +
UserAgentTokens Minor +
UserAgentTokens Minimal +
UserAgentTokens OS +
UserAgentTokens Full +
Specifies what information is included in the User-Agent header of HTTP requests. +"None" disables the User-Agent header. +"ProductOnly" reports "CUPS". +"Major" reports "CUPS/major IPP/2". +"Minor" reports "CUPS/major.minor IPP/2.1". +"Minimal" reports "CUPS/major.minor.patch IPP/2.1". +"OS" reports "CUPS/major.minor.path (osname osversion) IPP/2.1". +"Full" reports "CUPS/major.minor.path (osname osversion; architecture) IPP/2.1". +The default is "Minimal".
ValidateCerts Yes
ValidateCerts No
Specifies whether to only allow TLS with certificates whose common name matches the hostname. diff --git a/doc/help/man-cupsd.conf.html b/doc/help/man-cupsd.conf.html index b1b0ac0b5..a34be393f 100644 --- a/doc/help/man-cupsd.conf.html +++ b/doc/help/man-cupsd.conf.html @@ -267,13 +267,11 @@ command.
Specifies what information is included in the Server header of HTTP responses. "None" disables the Server header. "ProductOnly" reports "CUPS". -"Major" reports "CUPS 2". -"Minor" reports "CUPS 2.0". -"Minimal" reports "CUPS 2.0.0". -"OS" reports "CUPS 2.0.0 (UNAME)" where UNAME is the output of the -uname(1) -command. -"Full" reports "CUPS 2.0.0 (UNAME) IPP/2.0". +"Major" reports "CUPS/major IPP/2". +"Minor" reports "CUPS/major.minor IPP/2.1". +"Minimal" reports "CUPS/major.minor.patch IPP/2.1". +"OS" reports "CUPS/major.minor.path (osname osversion) IPP/2.1". +"Full" reports "CUPS/major.minor.path (osname osversion; architecture) IPP/2.1". The default is "Minimal".
SSLListen ipv4-address:port
SSLListen [ipv6-address]:port diff --git a/doc/help/man-ippevepcl.html b/doc/help/man-ippevepcl.html index 929657ec4..b07b9be4d 100644 --- a/doc/help/man-ippevepcl.html +++ b/doc/help/man-ippevepcl.html @@ -27,12 +27,13 @@ are print commands for ippeveprinter(1). As with all print commands, these commands read either the filename specified on the command-line or from the standard input. Output is sent to the standard output. +Status and progress messages are sent to the standard error.

ippevepcl -prints to B&W HP PCL laser printers and some color inkjet printers and supports printing of PWG Raster (image/pwg-raster) and Apple Raster (image/urf) print files. +prints to B&W HP PCL laser printers and supports printing of HP PCL (application/vnd.hp-pcl), PWG Raster (image/pwg-raster), and Apple Raster (image/urf) print files.

ippeveps -print to Adobe PostScript printers and supports printing of PDF (application/pdf), JPEG (image/jpeg), PWG Raster (image/pwg-raster), and Apple Raster (image/urf) print files. +print to Adobe PostScript printers and supports printing of PDF (application/pdf), PostScript (application/postscript), JPEG (image/jpeg), PWG Raster (image/pwg-raster), and Apple Raster (image/urf) print files. Printer-specific commands are read from a supplied PPD file. -If no PPD file is specified, generic commands suitable for any Level 2 or Level 3 PostScript printer are used instead to specify copies, duplex printing, and media size. +If no PPD file is specified, generic commands suitable for any Level 2 or Level 3 PostScript printer are used instead to specify duplex printing and media size.

Exit Status

These programs return 1 on error and 0 on success.

Environment

diff --git a/doc/help/man-ippeveprinter.html b/doc/help/man-ippeveprinter.html index d653f254c..b0af8e245 100644 --- a/doc/help/man-ippeveprinter.html +++ b/doc/help/man-ippeveprinter.html @@ -20,10 +20,23 @@ ippeveprinter - an ipp everywhere printer application for cups ] [ -2 ] [ +-D +device-uri +] [ +-K +keypath +] [ -M manufacturer ] [ -P +filename.ppd +] [ +-V +ipp-version +] [ +-a +filename.conf ] [ -c command @@ -34,8 +47,6 @@ ippeveprinter - an ipp everywhere printer application for cups -f type/subtype[,...] ] [ --h -] [ -i iconfile.png ] [ @@ -54,7 +65,7 @@ ippeveprinter - an ipp everywhere printer application for cups port ] [ -r -subtype +subtype[,subtype] ] [ -s speed[,color-speed] @@ -77,24 +88,45 @@ The following options are recognized by
Show the CUPS version.
-2
Report support for two-sided (duplex) printing. +
-D device-uri +
Set the device URI for print output. +The URI can be a filename, directory, or a network socket URI of the form "socket://ADDRESS[:PORT]" (where the default port number is 9100). +When specifying a directory, +ippeveprinter +will create an output file using the job ID and name.
-M manufacturer
Set the manufacturer of the printer. -The default is "Test". -
-P -
Report support for PIN printing. +The default is "Example". +
-P filename.ppd +
Load printer attributes from the specified PPD file. +This option is typically used in conjunction with the +ippeveps(7) +printer command ("-c ippeveps"). +
-V 1.1 +
-V 2.0 +
Specifies the maximum IPP version to report. +2.0 is the default.
-c command
Run the specified command for each document that is printed. +If "command" is not an absolute path ("/path/to/command"), +ippeveprinter +looks for the command in the "ippeveprinter" subdirectory of the CUPS binary directory, typically /usr/lib/cups/ippeveprinter or /usr/libexec/cups/ippeveprinter. +The +cups-config(1) +command can be used to discover the correct binary directory ("cups-config --serverbin"). +In addition, the CUPS_SERVERBIN environment variable can be used to override the default location of this directory - see the +cups(1) +man page for more details.
-d spool-directory
Specifies the directory that will hold the print files. The default is a directory under the user's current temporary directory.
-f type/subtype[,...]
Specifies a list of MIME media types that the server will accept. -The default is "application/pdf,image/jpeg,image/pwg-raster". -
-h -
Shows program help. +The default depends on the type of printer created.
-i iconfile.png
Specifies the printer icon file for the server. -The default is "printer.png". +The file must be a PNG format image. +The default is an internally-provided PNG image.
-k
Keeps the print documents in the spool directory rather than deleting them.
-l location @@ -111,8 +143,8 @@ command.
-p port
Specifies the port number to listen on. The default is a user-specific number from 8000 to 8999. -
-r subtype -
Specifies the Bonjour subtype(s) to advertise. +
-r subtype[,subtype] +
Specifies the DNS-SD subtype(s) to advertise. Separate multiple subtypes with a comma. The default is "_print".
-s speed[,color-speed] @@ -120,7 +152,7 @@ The default is "_print". If two numbers are specified and the second number is greater than zero, the server will report support for color printing. The default is "10,0".
-v[vvv] -
Be (very) verbose when logging activity to the standard output. +
Be (very) verbose when logging activity to standard error.

Exit Status

The @@ -137,8 +169,34 @@ program is unique to CUPS and conforms to the IPP Everywhere (PWG 5100.14) speci ippeveprinter adds environment variables starting with "IPP_" for all IPP Job attributes in the print request. For example, when executing a command for an IPP Job containing the "media" Job Template attribute, the "IPP_MEDIA" environment variable will be set to the value of that attribute. +

In addition, all IPP "xxx-default" Printer Description attributes are added to the environment. +For example, the "IPP_MEDIA_DEFAULT" environment variable will be set to the default value for the "media" Job Template attribute.

Enumerated values are converted to their keyword equivalents. For example, a "print-quality" Job Template attribute with a enum value of 3 will become the "IPP_PRINT_QUALITY" environment variable with a value of "draft". +This string conversion only happens for standard Job Template attributes, currently "finishings", "orientation-requested", and "print-quality". +

Finally, the "CONTENT_TYPE" environment variable contains the MIME media type of the document being printed, the "DEVICE_URI" environment variable contains the device URI as specified with the "-D" option, and the "PPD" environment variable contains the PPD filename as specified with the "-P" option. +

Command Output

+Unless they communicate directly with a printer, print commands send printer-ready data to the standard output. +

Print commands can send messages back to +ippeveprinter +on the standard error with one of the following prefixes: +

+
ATTR: attribute=value[ attribute=value] +
Sets the named attribute(s) to the given values. +Currently only the "job-impressions" and "job-impressions-completed" Job Status attributes and the "marker-xxx", "printer-alert", "printer-alert-description", "printer-supply", and "printer-supply-description" Printer Status attributes can be set. +
DEBUG: Debugging message +
Logs a debugging message if at least two -v's have been specified. +
ERROR: Error message +
Logs an error message and copies the message to the "job-state-message" attribute. +
INFO: Informational message +
Logs an informational/progress message if -v has been specified and copies the message to the "job-state-message" attribute unless an error has been reported. +
STATE: keyword[,keyword,...] +
Sets the printer's "printer-state-reasons" attribute to the listed keywords. +
STATE: -keyword[,keyword,...] +
Removes the listed keywords from the printer's "printer-state-reasons" attribute. +
STATE: +keyword[,keyword,...] +
Adds the listed keywords to the printer's "printer-state-reasons" attribute. +

Examples

Run ippeveprinter @@ -152,7 +210,7 @@ with a service name of My Cool Printer: command whenever a job is sent to the server:
 
-    ippeveprinter -c file "My Cool Printer"
+    ippeveprinter -c /usr/bin/file "My Cool Printer"
 

See Also

PWG Internet Printing Protocol Workgroup (http://www.pwg.org/ipp) diff --git a/man/ippevepcl.man b/man/ippevepcl.man index 02a9e33d4..738e87cd9 100644 --- a/man/ippevepcl.man +++ b/man/ippevepcl.man @@ -1,12 +1,12 @@ .\" -.\" ippeveprinter man page for CUPS. +.\" ippevepcl/ps man page for CUPS. .\" .\" Copyright © 2019 by Apple Inc. .\" .\" Licensed under Apache License v2.0. See the file "LICENSE" for more .\" information. .\" -.TH ippevepcl/ps 7 "CUPS" "22 March 2019" "Apple Inc." +.TH ippevepcl/ps 7 "CUPS" "24 April 2019" "Apple Inc." .SH NAME ippevepcl/ps \- pcl and postscript print commands for ippeveprinter .SH SYNOPSIS @@ -27,14 +27,15 @@ are print commands for .BR ippeveprinter (1). As with all print commands, these commands read either the filename specified on the command-line or from the standard input. Output is sent to the standard output. +Status and progress messages are sent to the standard error. .PP .B ippevepcl -prints to B&W HP PCL laser printers and some color inkjet printers and supports printing of PWG Raster (image/pwg-raster) and Apple Raster (image/urf) print files. +prints to B&W HP PCL laser printers and supports printing of HP PCL (application/vnd.hp-pcl), PWG Raster (image/pwg-raster), and Apple Raster (image/urf) print files. .PP .B ippeveps -print to Adobe PostScript printers and supports printing of PDF (application/pdf), JPEG (image/jpeg), PWG Raster (image/pwg-raster), and Apple Raster (image/urf) print files. +print to Adobe PostScript printers and supports printing of PDF (application/pdf), PostScript (application/postscript), JPEG (image/jpeg), PWG Raster (image/pwg-raster), and Apple Raster (image/urf) print files. Printer-specific commands are read from a supplied PPD file. -If no PPD file is specified, generic commands suitable for any Level 2 or Level 3 PostScript printer are used instead to specify copies, duplex printing, and media size. +If no PPD file is specified, generic commands suitable for any Level 2 or Level 3 PostScript printer are used instead to specify duplex printing and media size. .SH EXIT STATUS These programs return 1 on error and 0 on success. .SH ENVIRONMENT diff --git a/man/ippeveprinter.man b/man/ippeveprinter.man index 796f78ac6..0fb4c2416 100644 --- a/man/ippeveprinter.man +++ b/man/ippeveprinter.man @@ -6,7 +6,7 @@ .\" Licensed under Apache License v2.0. See the file "LICENSE" for more .\" information. .\" -.TH ippeveprinter 1 "CUPS" "19 April 2019" "Apple Inc." +.TH ippeveprinter 1 "CUPS" "24 April 2019" "Apple Inc." .SH NAME ippeveprinter \- an ipp everywhere printer application for cups .SH SYNOPSIS @@ -20,10 +20,23 @@ ippeveprinter \- an ipp everywhere printer application for cups ] [ .B \-2 ] [ +.B \-D +.I device-uri +] [ +.B \-K +.I keypath +] [ .B \-M .I manufacturer ] [ .B \-P +.I filename.ppd +] [ +.B \-V +.I ipp-version +] [ +.B \-a +.I filename.conf ] [ .B \-c .I command @@ -34,8 +47,6 @@ ippeveprinter \- an ipp everywhere printer application for cups .B \-f .I type/subtype[,...] ] [ -.B \-h -] [ .B \-i .I iconfile.png ] [ @@ -54,7 +65,7 @@ ippeveprinter \- an ipp everywhere printer application for cups .I port ] [ .B \-r -.I subtype +.I subtype[,subtype] ] [ .B \-s .I speed[,color-speed] @@ -81,15 +92,40 @@ Show the CUPS version. .B \-2 Report support for two-sided (duplex) printing. .TP 5 +\fB\-D \fIdevice-uri\fR +Set the device URI for print output. +The URI can be a filename, directory, or a network socket URI of the form "socket://ADDRESS[:PORT]" (where the default port number is 9100). +When specifying a directory, +.B ippeveprinter +will create an output file using the job ID and name. +.TP 5 \fB\-M \fImanufacturer\fR Set the manufacturer of the printer. -The default is "Test". +The default is "Example". .TP 5 -.B \-P -Report support for PIN printing. +\fB\-P \fIfilename.ppd\fR +Load printer attributes from the specified PPD file. +This option is typically used in conjunction with the +.BR ippeveps (7) +printer command ("\-c ippeveps"). +.TP 5 +\fB\-V 1.1\fR +.TP 5 +\fB\-V 2.0\fR +Specifies the maximum IPP version to report. +2.0 is the default. .TP 5 \fB\-c \fIcommand\fR Run the specified command for each document that is printed. +If "command" is not an absolute path ("/path/to/command"), +.B ippeveprinter +looks for the command in the "ippeveprinter" subdirectory of the CUPS binary directory, typically /usr/lib/cups/ippeveprinter or /usr/libexec/cups/ippeveprinter. +The +.BR cups-config (1) +command can be used to discover the correct binary directory ("cups-config --serverbin"). +In addition, the CUPS_SERVERBIN environment variable can be used to override the default location of this directory - see the +.BR cups (1) +man page for more details. .TP 5 \fB\-d \fIspool-directory\fR Specifies the directory that will hold the print files. @@ -97,14 +133,12 @@ The default is a directory under the user's current temporary directory. .TP 5 \fB\-f \fItype/subtype[,...]\fR Specifies a list of MIME media types that the server will accept. -The default is "application/pdf,image/jpeg,image/pwg-raster". -.TP 5 -.B \-h -Shows program help. +The default depends on the type of printer created. .TP 5 \fB\-i \fIiconfile.png\fR Specifies the printer icon file for the server. -The default is "printer.png". +The file must be a PNG format image. +The default is an internally-provided PNG image. .TP 5 .B \-k Keeps the print documents in the spool directory rather than deleting them. @@ -127,8 +161,8 @@ command. Specifies the port number to listen on. The default is a user-specific number from 8000 to 8999. .TP 5 -\fB\-r \fIsubtype\fR -Specifies the Bonjour subtype(s) to advertise. +\fB\-r \fIsubtype[,subtype]\fR +Specifies the DNS-SD subtype(s) to advertise. Separate multiple subtypes with a comma. The default is "_print". .TP 5 @@ -138,7 +172,7 @@ If two numbers are specified and the second number is greater than zero, the ser The default is "10,0". .TP 5 .B \-v[vvv] -Be (very) verbose when logging activity to the standard output. +Be (very) verbose when logging activity to standard error. .SH EXIT STATUS The .B ippeveprinter @@ -155,8 +189,42 @@ program is unique to CUPS and conforms to the IPP Everywhere (PWG 5100.14) speci adds environment variables starting with "IPP_" for all IPP Job attributes in the print request. For example, when executing a command for an IPP Job containing the "media" Job Template attribute, the "IPP_MEDIA" environment variable will be set to the value of that attribute. .LP +In addition, all IPP "xxx-default" Printer Description attributes are added to the environment. +For example, the "IPP_MEDIA_DEFAULT" environment variable will be set to the default value for the "media" Job Template attribute. +.LP Enumerated values are converted to their keyword equivalents. For example, a "print-quality" Job Template attribute with a enum value of 3 will become the "IPP_PRINT_QUALITY" environment variable with a value of "draft". +This string conversion only happens for standard Job Template attributes, currently "finishings", "orientation-requested", and "print-quality". +.LP +Finally, the "CONTENT_TYPE" environment variable contains the MIME media type of the document being printed, the "DEVICE_URI" environment variable contains the device URI as specified with the "\-D" option, and the "PPD" environment variable contains the PPD filename as specified with the "\-P" option. +.SH COMMAND OUTPUT +Unless they communicate directly with a printer, print commands send printer-ready data to the standard output. +.LP +Print commands can send messages back to +.B ippeveprinter +on the standard error with one of the following prefixes: +.TP 5 +\fBATTR: \fIattribute=value[ attribute=value]\fR +Sets the named attribute(s) to the given values. +Currently only the "job-impressions" and "job-impressions-completed" Job Status attributes and the "marker-xxx", "printer-alert", "printer-alert-description", "printer-supply", and "printer-supply-description" Printer Status attributes can be set. +.TP 5 +\fBDEBUG: \fIDebugging message\fR +Logs a debugging message if at least two \-v's have been specified. +.TP 5 +\fBERROR: \fIError message\fR +Logs an error message and copies the message to the "job-state-message" attribute. +.TP 5 +\fBINFO: \fIInformational message\fR +Logs an informational/progress message if \-v has been specified and copies the message to the "job-state-message" attribute unless an error has been reported. +.TP 5 +\fBSTATE: \fIkeyword[,keyword,...]\fR +Sets the printer's "printer-state-reasons" attribute to the listed keywords. +.TP 5 +\fBSTATE: -\fIkeyword[,keyword,...]\fR +Removes the listed keywords from the printer's "printer-state-reasons" attribute. +.TP 5 +\fBSTATE: +\fIkeyword[,keyword,...]\fR +Adds the listed keywords to the printer's "printer-state-reasons" attribute. .SH EXAMPLES Run .B ippeveprinter @@ -171,7 +239,7 @@ Run the command whenever a job is sent to the server: .nf - ippeveprinter \-c file "My Cool Printer" + ippeveprinter \-c /usr/bin/file "My Cool Printer" .fi .SH SEE ALSO PWG Internet Printing Protocol Workgroup (http://www.pwg.org/ipp) diff --git a/test/ippeveprinter.c b/test/ippeveprinter.c index 5e817df2b..0f94b4e19 100644 --- a/test/ippeveprinter.c +++ b/test/ippeveprinter.c @@ -197,6 +197,8 @@ struct ippeve_job_s /**** Job data ****/ *username, /* job-originating-user-name */ *format; /* document-format */ ipp_jstate_t state; /* job-state value */ + char *message; /* job-state-message value */ + int msglevel; /* job-state-message log level (0=error, 1=info) */ time_t created, /* time-at-creation value */ processing, /* time-at-processing value */ completed; /* time-at-completed value */ @@ -332,7 +334,7 @@ main(int argc, /* I - Number of command-line args */ *keypath = NULL, /* Keychain path */ #endif /* HAVE_SSL */ *location = "", /* Location of printer */ - *make = "Test", /* Manufacturer */ + *make = "Example", /* Manufacturer */ *model = "Printer", /* Model */ *name = NULL, /* Printer name */ #if !CUPS_LITE @@ -781,43 +783,50 @@ copy_job_attributes( if (!ra || cupsArrayFind(ra, "job-state-message")) { - switch (job->state) + if (job->message) { - case IPP_JSTATE_PENDING : - ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL, "Job pending."); - break; + ippAddString(client->response, IPP_TAG_JOB, IPP_TAG_TEXT, "job-state-message", NULL, job->message); + } + else + { + switch (job->state) + { + case IPP_JSTATE_PENDING : + ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL, "Job pending."); + break; - case IPP_JSTATE_HELD : - if (job->fd >= 0) - ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL, "Job incoming."); - else if (ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_ZERO)) - ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL, "Job held."); - else - ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL, "Job created."); - break; + case IPP_JSTATE_HELD : + if (job->fd >= 0) + ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL, "Job incoming."); + else if (ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_ZERO)) + ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL, "Job held."); + else + ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL, "Job created."); + break; - case IPP_JSTATE_PROCESSING : - if (job->cancel) - ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL, "Job canceling."); - else - ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL, "Job printing."); - break; + case IPP_JSTATE_PROCESSING : + if (job->cancel) + ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL, "Job canceling."); + else + ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL, "Job printing."); + break; - case IPP_JSTATE_STOPPED : - ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL, "Job stopped."); - break; + case IPP_JSTATE_STOPPED : + ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL, "Job stopped."); + break; - case IPP_JSTATE_CANCELED : - ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL, "Job canceled."); - break; + case IPP_JSTATE_CANCELED : + ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL, "Job canceled."); + break; - case IPP_JSTATE_ABORTED : - ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL, "Job aborted."); - break; + case IPP_JSTATE_ABORTED : + ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL, "Job aborted."); + break; - case IPP_JSTATE_COMPLETED : - ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL, "Job completed."); - break; + case IPP_JSTATE_COMPLETED : + ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL, "Job completed."); + break; + } } } @@ -1820,10 +1829,13 @@ static void delete_job(ippeve_job_t *job) /* I - Job */ { if (Verbosity) - fprintf(stderr, "Removing job #%d from history.\n", job->id); + fprintf(stderr, "[Job %d] Removing job from history.\n", job->id); ippDelete(job->attrs); + if (job->message) + free(job->message); + if (job->filename) { if (!KeepFiles) @@ -5224,7 +5236,7 @@ process_attr_message( job->impcompleted = atoi(option->value); } - else if (!strncmp(option->name, "marker-", 7) || !strcmp(option->name, "printer-alert") || !strcmp(option->name, "printer-supply") || !strcmp(option->name, "printer-supply-description")) + else if (!strncmp(option->name, "marker-", 7) || !strcmp(option->name, "printer-alert") || !strcmp(option->name, "printer-alert-description") || !strcmp(option->name, "printer-supply") || !strcmp(option->name, "printer-supply-description")) { /* * Update Printer Status attribute... @@ -6195,27 +6207,60 @@ process_job(ippeve_job_t *job) /* I - Job */ while ((ptr = strchr(line, '\n')) != NULL) { + int level = 3; /* Message log level */ + *ptr++ = '\0'; - if (Verbosity > 1) - fprintf(stderr, "[Job %d] Command - %s\n", job->id, line); + if (!strncmp(line, "ATTR:", 5)) + { + /* + * Process job/printer attribute updates. + */ - if (!strncmp(line, "STATE:", 6)) + process_attr_message(job, line); + } + else if (!strncmp(line, "DEBUG:", 6)) { /* - * Process printer-state-reasons keywords. + * Debug message... */ - process_state_message(job, line); + level = 2; } - else if (!strncmp(line, "ATTR:", 5)) + else if (!strncmp(line, "ERROR:", 6)) { /* - * Process job/printer attribute updates. + * Error message... */ - process_attr_message(job, line); + level = 0; + job->message = strdup(line + 6); + job->msglevel = 0; } + else if (!strncmp(line, "INFO:", 5)) + { + /* + * Informational/progress message... + */ + + level = 1; + if (job->msglevel) + { + job->message = strdup(line + 5); + job->msglevel = 1; + } + } + else if (!strncmp(line, "STATE:", 6)) + { + /* + * Process printer-state-reasons keywords. + */ + + process_state_message(job, line); + } + + if (Verbosity >= level) + fprintf(stderr, "[Job %d] Command - %s\n", job->id, line); bytes = ptr - line; if (ptr < endptr) @@ -7560,7 +7605,7 @@ usage(int status) /* O - Exit status */ _cupsLangPuts(stdout, _("-m model Set model name (default=Printer)")); _cupsLangPuts(stdout, _("-n hostname Set hostname for printer")); _cupsLangPuts(stdout, _("-p port Set port number for printer")); - _cupsLangPuts(stdout, _("-r subtype Set DNS-SD service subtype")); + _cupsLangPuts(stdout, _("-r subtype,[subtype] Set DNS-SD service subtype")); _cupsLangPuts(stdout, _("-s speed[,color-speed] Set speed in pages per minute")); _cupsLangPuts(stderr, _("-v Be verbose")); diff --git a/test/ippeveps.c b/test/ippeveps.c index 6a48aacdb..2bfc14eb4 100644 --- a/test/ippeveps.c +++ b/test/ippeveps.c @@ -420,6 +420,7 @@ get_options(cups_option_t **options) /* O - Options */ { ppd_cache = _ppdCacheCreateWithPPD(ppd); + /* TODO: Fix me - values are names, not numbers... Also need to support finishings-col */ if ((value = getenv("IPP_FINISHINGS")) == NULL) value = getenv("IPP_FINISHINGS_DEFAULT"); @@ -482,10 +483,12 @@ get_options(cups_option_t **options) /* O - Options */ int num_presets; /* Number of presets */ cups_option_t *presets; /* Presets */ - if ((pq = atoi(value) - 3) < 0) - pq = 0; - else if (pq > 2) - pq = 2; + if (!strcmp(value, "draft")) + pq = 0; + else if (!strcmp(value, "high")) + pq = 2; + else + pq = 1; if ((value = getenv("IPP_PRINT_COLOR_MODE")) == NULL) value = getenv("IPP_PRINT_COLOR_MODE_DEFAULT"); -- 2.39.5