summaryrefslogtreecommitdiff
path: root/usr/src/cmd/print/bsd-sysv-commands
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd/print/bsd-sysv-commands')
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/common.c15
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/in.lpd.c19
2 files changed, 27 insertions, 7 deletions
diff --git a/usr/src/cmd/print/bsd-sysv-commands/common.c b/usr/src/cmd/print/bsd-sysv-commands/common.c
index 73483957ff..fbc68459f8 100644
--- a/usr/src/cmd/print/bsd-sysv-commands/common.c
+++ b/usr/src/cmd/print/bsd-sysv-commands/common.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
*/
@@ -193,6 +193,8 @@ print_job_line(FILE *fp, int count, papi_job_t job, int fmt, int ac, char *av[])
(void) papiAttributeListGetInteger(list, NULL,
"job-id", &id);
+ (void) papiAttributeListGetInteger(list, NULL,
+ "job-id-requested", &id);
(void) papiAttributeListGetString(list, NULL,
"job-originating-user-name", &user);
(void) papiAttributeListGetString(list, NULL,
@@ -238,16 +240,20 @@ cancel_job(papi_service_t svc, FILE *fp, char *printer, papi_job_t job,
papi_status_t status;
papi_attribute_t **list = papiJobGetAttributeList(job);
int id = 0;
+ int rid = 0;
char *user = "";
char *mesg = gettext("cancelled");
papiAttributeListGetInteger(list, NULL,
"job-id", &id);
+ papiAttributeListGetInteger(list, NULL,
+ "job-id-requested", &rid);
papiAttributeListGetString(list, NULL,
"job-originating-user-name", &user);
/* if we are looking and it doesn't match, return early */
- if ((ac > 0) && (match_job(id, user, ac, av) < 0))
+ if ((ac > 0) && (match_job(id, user, ac, av) < 0) &&
+ (match_job(rid, user, ac, av) < 0))
return;
status = papiJobCancel(svc, printer, id);
@@ -267,7 +273,7 @@ berkeley_queue_report(papi_service_t svc, FILE *fp, char *dest, int fmt,
char *pattrs[] = { "printer-name", "printer-state",
"printer-state-reasons", NULL };
char *jattrs[] = { "job-name", "job-octets", "job-k-octets", "job-id",
- "job-originating-user-name",
+ "job-originating-user-name", "job-id-requested",
"job-originating-host-name",
"number-of-intervening-jobs", NULL };
int num_jobs = 0;
@@ -315,7 +321,8 @@ berkeley_cancel_request(papi_service_t svc, FILE *fp, char *dest,
{
papi_status_t status;
papi_job_t *jobs = NULL;
- char *jattrs[] = { "job-originating-user-name", "job-id", NULL };
+ char *jattrs[] = { "job-originating-user-name", "job-id",
+ "job-id-requested", NULL };
status = papiPrinterListJobs(svc, dest, jattrs, PAPI_LIST_JOBS_ALL,
0, &jobs);
diff --git a/usr/src/cmd/print/bsd-sysv-commands/in.lpd.c b/usr/src/cmd/print/bsd-sysv-commands/in.lpd.c
index e10a5b249c..e4bf689d47 100644
--- a/usr/src/cmd/print/bsd-sysv-commands/in.lpd.c
+++ b/usr/src/cmd/print/bsd-sysv-commands/in.lpd.c
@@ -35,6 +35,7 @@
#include <fcntl.h>
#include <stdarg.h>
#include <string.h>
+#include <ctype.h>
#include <errno.h>
#include <syslog.h>
#include <libintl.h>
@@ -381,7 +382,8 @@ parse_cf(papi_service_t svc, char *cf, char **files)
}
static papi_status_t
-submit_job(papi_service_t svc, FILE *ifp, char *printer, char *cf, char **files)
+submit_job(papi_service_t svc, FILE *ifp, char *printer, int rid, char *cf,
+ char **files)
{
papi_attribute_t **list = NULL;
papi_status_t status;
@@ -397,6 +399,10 @@ submit_job(papi_service_t svc, FILE *ifp, char *printer, char *cf, char **files)
"job-originating-host-name", host);
free(host);
}
+ if (rid > 0) {
+ papiAttributeListAddInteger(&list, PAPI_ATTR_EXCL,
+ "job-id-requested", rid);
+ }
}
status = papiJobSubmit(svc, printer, list, NULL, files, &job);
@@ -500,6 +506,7 @@ berkeley_receive_files(papi_service_t svc, FILE *ifp, FILE *ofp, char *printer)
papi_status_t status = PAPI_OK;
char *file, **files = NULL; /* the job data files */
char *cf = NULL;
+ int rid = 0;
char buf[BUFSIZ];
while (fgets(buf, sizeof (buf), ifp) != NULL) {
@@ -515,12 +522,18 @@ berkeley_receive_files(papi_service_t svc, FILE *ifp, FILE *ofp, char *printer)
cleanup(&files, &cf);
break;
case 0x02: { /* Receive control file */
+ if (((cf = strchr(buf, ' ')) != NULL) &&
+ (strlen(cf) > 4)) {
+ while ((*cf != NULL) && (isdigit(*cf) == 0))
+ cf++;
+ rid = atoi(cf);
+ }
cf = receive_control_file(svc, ifp, ofp, atoi(&buf[1]));
if (cf == NULL) {
cleanup(&files, &cf);
return (PAPI_BAD_REQUEST);
} else if (files != NULL) {
- status = submit_job(svc, ifp, printer, cf,
+ status = submit_job(svc, ifp, printer, rid, cf,
files);
cleanup(&files, &cf);
}
@@ -543,7 +556,7 @@ berkeley_receive_files(papi_service_t svc, FILE *ifp, FILE *ofp, char *printer)
}
if ((cf != NULL) && (files != NULL))
- status = submit_job(svc, ifp, printer, cf, files);
+ status = submit_job(svc, ifp, printer, rid, cf, files);
cleanup(&files, &cf);