summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2019-04-24 18:35:00 -0400
committerMichael R Sweet <michael.r.sweet@gmail.com>2019-04-24 18:35:00 -0400
commitdc84a5a4cdb6900256a6ea9f627336bc19903dcc (patch)
tree5ffba3c61dae8ea76e5432ecf91cde4323338423 /test
parente513da0cd84bca4b3db96b15b2bf936715182d88 (diff)
downloadcups-dc84a5a4cdb6900256a6ea9f627336bc19903dcc.tar.gz
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.
Diffstat (limited to 'test')
-rw-r--r--test/ippeveprinter.c129
-rw-r--r--test/ippeveps.c11
2 files changed, 94 insertions, 46 deletions
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");