/*
- * "$Id: ipp.c,v 1.63 2000/04/29 12:35:57 mike Exp $"
+ * "$Id: ipp.c,v 1.64 2000/05/02 19:29:22 mike Exp $"
*
* IPP routines for the Common UNIX Printing System (CUPS) scheduler.
*
ippAddInteger(job->attrs, IPP_TAG_JOB, IPP_TAG_INTEGER, "job-id", job->id);
job->state = ippAddInteger(job->attrs, IPP_TAG_JOB, IPP_TAG_ENUM,
"job-state", IPP_JOB_STOPPED);
+ job->sheets = ippAddInteger(job->attrs, IPP_TAG_JOB, IPP_TAG_INTEGER,
+ "job-media-sheets-completed", 0);
ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_URI, "job-printer-uri", NULL,
printer_uri);
ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME, "job-name", NULL,
if (attr == NULL)
{
- attr = ippAddStrings(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME, "job->sheets",
+ attr = ippAddStrings(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME, "job-sheets",
2, NULL, NULL);
attr->values[0].string.text = strdup(printer->job_sheets[0]);
attr->values[1].string.text = strdup(printer->job_sheets[1]);
ippAddInteger(job->attrs, IPP_TAG_JOB, IPP_TAG_INTEGER, "job-id", job->id);
job->state = ippAddInteger(job->attrs, IPP_TAG_JOB, IPP_TAG_ENUM,
"job-state", IPP_JOB_PENDING);
+ job->sheets = ippAddInteger(job->attrs, IPP_TAG_JOB, IPP_TAG_INTEGER,
+ "job-media-sheets-completed", 0);
ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_URI, "job-printer-uri", NULL,
printer_uri);
ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME, "job-name", NULL,
/*
- * End of "$Id: ipp.c,v 1.63 2000/04/29 12:35:57 mike Exp $".
+ * End of "$Id: ipp.c,v 1.64 2000/05/02 19:29:22 mike Exp $".
*/
/*
- * "$Id: job.c,v 1.64 2000/04/27 12:24:58 mike Exp $"
+ * "$Id: job.c,v 1.65 2000/05/02 19:29:22 mike Exp $"
*
* Job management routines for the Common UNIX Printing System (CUPS).
*
UpdateJob(job_t *job) /* I - Job to check */
{
int bytes; /* Number of bytes read */
+ int copies; /* Number of copies printed */
char *lineptr, /* Pointer to end of line in buffer */
*message; /* Pointer to message text */
int loglevel; /* Log level for message */
if (loglevel == L_PAGE)
{
/*
- * Page message; send the message to the page_log file...
+ * Page message; send the message to the page_log file and update the
+ * job sheet count...
*/
+ if (!sscanf(message, "%*d%d", &copies))
+ job->sheets->values[0].integer ++;
+ else
+ job->sheets->values[0].integer += copies;
+
LogPage(job, message);
}
else
/*
- * End of "$Id: job.c,v 1.64 2000/04/27 12:24:58 mike Exp $".
+ * End of "$Id: job.c,v 1.65 2000/05/02 19:29:22 mike Exp $".
*/
/*
- * "$Id: job.h,v 1.16 2000/05/01 19:50:27 mike Exp $"
+ * "$Id: job.h,v 1.17 2000/05/02 19:29:22 mike Exp $"
*
* Print job definitions for the Common UNIX Printing System (CUPS) scheduler.
*
int id, /* Job ID */
priority; /* Job priority */
ipp_attribute_t *state; /* Job state */
+ ipp_attribute_t *sheets; /* job-media-sheets-completed */
char username[33]; /* Printing user */
char dest[IPP_MAX_NAME]; /* Destination printer or class */
cups_ptype_t dtype; /* Destination type (class/remote bits) */
/*
- * End of "$Id: job.h,v 1.16 2000/05/01 19:50:27 mike Exp $".
+ * End of "$Id: job.h,v 1.17 2000/05/02 19:29:22 mike Exp $".
*/
/*
- * "$Id: log.c,v 1.8 2000/03/21 18:35:38 mike Exp $"
+ * "$Id: log.c,v 1.9 2000/05/02 19:29:23 mike Exp $"
*
* Log file routines for the Common UNIX Printing System (CUPS).
*
{
char filename[1024], /* Name of error log file */
backname[1024]; /* Backup filename */
+ ipp_attribute_t *billing; /* job-billing attribute */
+
+ billing = ippFindAttribute(job->attrs, "job-billing", IPP_TAG_TEXT);
+
#ifdef HAVE_VSYSLOG
/*
* See if we are logging pages via syslog...
if (strcmp(PageLog, "syslog") == 0)
{
- syslog(LOG_INFO, "PAGE %s %s %d %s", job->printer->name, job->username,
- job->id, page);
+ syslog(LOG_INFO, "PAGE %s %s %d %s %s", job->printer->name, job->username,
+ job->id, page, billing ? billing->values[0].string.text : "");
return (1);
}
/*
* Print a page log entry of the form:
*
- * printer job-id user [DD/MON/YYYY:HH:MM:SS +TTTT] page num-copies
+ * printer job-id user [DD/MON/YYYY:HH:MM:SS +TTTT] page num-copies billing
*/
- fprintf(PageFile, "%s %s %d %s %s\n", job->printer->name, job->username,
- job->id, get_datetime(time(NULL)), page);
+ fprintf(PageFile, "%s %s %d %s %s %s\n", job->printer->name, job->username,
+ job->id, get_datetime(time(NULL)), page,
+ billing ? billing->values[0].string.text : "");
fflush(PageFile);
return (1);
/*
- * End of "$Id: log.c,v 1.8 2000/03/21 18:35:38 mike Exp $".
+ * End of "$Id: log.c,v 1.9 2000/05/02 19:29:23 mike Exp $".
*/