summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorsonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>2010-03-29 20:59:36 +0530
committersonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>2010-03-29 20:59:36 +0530
commitc7f2fd24c9b933d8806de9016fb9bca3f269a8af (patch)
treec175c9baa36d9de3dac3d5b0cb6563d0ea6b2196 /usr/src
parent567c0b92c2af3154cccac71336940521945f8ae8 (diff)
downloadillumos-joyent-c7f2fd24c9b933d8806de9016fb9bca3f269a8af.tar.gz
6919676 lpstat output message under powersave mode need to be fixed
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/lp/lib/papi/lpsched-printers.c252
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/common.c7
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/lpstat.c48
3 files changed, 174 insertions, 133 deletions
diff --git a/usr/src/cmd/lp/lib/papi/lpsched-printers.c b/usr/src/cmd/lp/lib/papi/lpsched-printers.c
index 120fec5fec..3765e21f66 100644
--- a/usr/src/cmd/lp/lib/papi/lpsched-printers.c
+++ b/usr/src/cmd/lp/lib/papi/lpsched-printers.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -41,38 +41,56 @@ lpsched_printer_status_to_attributes(papi_attribute_t ***attrs,
if (attrs == NULL)
return;
- if (status & (PS_DISABLED|PS_LATER|PS_FAULTED|PS_FORM_FAULT)) {
- papiAttributeListAddInteger(attrs, PAPI_ATTR_REPLACE,
- "printer-state", 0x05); /* stopped */
- if (status & PS_LATER)
- papiAttributeListAddString(attrs, PAPI_ATTR_REPLACE,
- "printer-state-reasons", "moving-to-paused");
- else if (status & PS_FAULTED)
+ if (!(status & (PS_DISABLED|PS_LATER))) {
+ if (status & PS_FAULTED) {
+ if (status & PS_BUSY)
+ /* faulted printing */
+ papiAttributeListAddInteger(attrs,
+ PAPI_ATTR_REPLACE,
+ "printer-state", 0x06);
+ else
+ /* faulted printer */
+ papiAttributeListAddInteger(attrs,
+ PAPI_ATTR_REPLACE,
+ "printer-state", 0x07);
+
papiAttributeListAddString(attrs, PAPI_ATTR_REPLACE,
- "printer-state-reasons", "none");
- else if (status & PS_FORM_FAULT)
+ "printer-state-reasons", "none");
+ } else if (status & PS_BUSY) {
+ papiAttributeListAddInteger(attrs, PAPI_ATTR_REPLACE,
+ "printer-state", 0x04); /* processing */
papiAttributeListAddString(attrs, PAPI_ATTR_REPLACE,
- "printer-state-reasons",
- "interpreter-resource-unavailable");
- else
+ "printer-state-reasons", "moving-to-paused");
+ } else if (status & PS_FORM_FAULT) {
+ papiAttributeListAddInteger(attrs, PAPI_ATTR_REPLACE,
+ "printer-state", 0x05); /* stopped */
papiAttributeListAddString(attrs, PAPI_ATTR_REPLACE,
- "printer-state-reasons", "paused");
- } else if (status & PS_BUSY) {
+ "printer-state-reasons",
+ "interpreter-resource-unavailable");
+ } else
+ papiAttributeListAddInteger(attrs, PAPI_ATTR_REPLACE,
+ "printer-state", 0x03); /* idle */
+ } else if (status & PS_DISABLED) {
+ papiAttributeListAddInteger(attrs, PAPI_ATTR_REPLACE,
+ "printer-state", 0x05); /* stopped */
+ papiAttributeListAddString(attrs, PAPI_ATTR_REPLACE,
+ "printer-state-reasons", "paused");
+ } else if (status & PS_LATER) {
papiAttributeListAddInteger(attrs, PAPI_ATTR_REPLACE,
- "printer-state", 0x04); /* processing */
+ "printer-state", 0x08); /* waiting for auto reply */
papiAttributeListAddString(attrs, PAPI_ATTR_REPLACE,
- "printer-state-reasons", "moving-to-paused");
+ "printer-state-reasons", "moving-to-paused");
} else {
papiAttributeListAddInteger(attrs, PAPI_ATTR_REPLACE,
- "printer-state", 0x03); /* idle */
+ "printer-state", 0x03); /* idle */
}
papiAttributeListAddBoolean(attrs, PAPI_ATTR_REPLACE,
- "printer-is-accepting-jobs",
- ((status & PS_REJECTED) != PS_REJECTED));
+ "printer-is-accepting-jobs",
+ ((status & PS_REJECTED) != PS_REJECTED));
papiAttributeListAddBoolean(attrs, PAPI_ATTR_REPLACE,
- "printer-is-processing-jobs",
- ((status & PS_DISABLED) != PS_DISABLED));
+ "printer-is-processing-jobs",
+ ((status & PS_DISABLED) != PS_DISABLED));
}
void
@@ -82,34 +100,34 @@ lpsched_printer_defaults(papi_attribute_t ***attributes)
return;
papiAttributeListAddBoolean(attributes, PAPI_ATTR_REPLACE,
- "multiple-document-jobs-supported", PAPI_TRUE);
+ "multiple-document-jobs-supported", PAPI_TRUE);
papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "multiple-document-handling-supported",
- "seperate-documents-colated-copies");
+ "multiple-document-handling-supported",
+ "seperate-documents-colated-copies");
papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "pdl-override-supported", "not-attempted");
+ "pdl-override-supported", "not-attempted");
papiAttributeListAddInteger(attributes, PAPI_ATTR_REPLACE,
- "job-priority-supported", 40);
+ "job-priority-supported", 40);
papiAttributeListAddInteger(attributes, PAPI_ATTR_REPLACE,
- "job-priority-default", 20);
+ "job-priority-default", 20);
papiAttributeListAddRange(attributes, PAPI_ATTR_REPLACE,
- "copies-supported", 1, 65535);
+ "copies-supported", 1, 65535);
papiAttributeListAddInteger(attributes, PAPI_ATTR_REPLACE,
- "copies-default", 1);
+ "copies-default", 1);
papiAttributeListAddBoolean(attributes, PAPI_ATTR_REPLACE,
- "page-ranges-supported", PAPI_TRUE);
+ "page-ranges-supported", PAPI_TRUE);
papiAttributeListAddInteger(attributes, PAPI_ATTR_REPLACE,
- "number-up-supported", 1);
+ "number-up-supported", 1);
papiAttributeListAddInteger(attributes, PAPI_ATTR_REPLACE,
- "number-up-default", 1);
+ "number-up-default", 1);
papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "job-hold-until-supported", "no-hold");
+ "job-hold-until-supported", "no-hold");
papiAttributeListAddString(attributes, PAPI_ATTR_APPEND,
- "job-hold-until-supported", "indefinite");
+ "job-hold-until-supported", "indefinite");
papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "job-hold-until-default", "no-hold");
+ "job-hold-until-default", "no-hold");
papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "document-format-default", "application/octet-stream");
+ "document-format-default", "application/octet-stream");
}
@@ -129,32 +147,32 @@ lpsched_printer_configuration_to_attributes(service_t *svc, printer_t *p,
/* get the configuration DB data */
if ((tmp = getprinter(dest)) == NULL) {
detailed_error(svc,
- gettext("unable to read configuration data"));
+ gettext("unable to read configuration data"));
return (PAPI_DEVICE_ERROR);
}
/* name */
papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "printer-name", tmp->name);
+ "printer-name", tmp->name);
if (tmp->name != NULL) {
char uri[BUFSIZ];
snprintf(uri, sizeof (uri), "lpsched://localhost/printers/%s",
- tmp->name);
+ tmp->name);
papiAttributeListAddString(&p->attributes, PAPI_ATTR_REPLACE,
- "printer-uri-supported", uri);
+ "printer-uri-supported", uri);
}
/* banner */
if ((tmp->banner & BAN_OPTIONAL) == BAN_OPTIONAL)
papiAttributeListAddString(&p->attributes, PAPI_ATTR_APPEND,
- "job-sheets-supported", "optional");
+ "job-sheets-supported", "optional");
else if (tmp->banner & BAN_NEVER)
papiAttributeListAddString(&p->attributes, PAPI_ATTR_APPEND,
- "job-sheets-supported", "none");
+ "job-sheets-supported", "none");
else if (tmp->banner & BAN_ALWAYS)
papiAttributeListAddString(&p->attributes, PAPI_ATTR_APPEND,
- "job-sheets-supported", "standard");
+ "job-sheets-supported", "standard");
/* input_types */
if (tmp->input_types != NULL) {
@@ -162,75 +180,75 @@ lpsched_printer_configuration_to_attributes(service_t *svc, printer_t *p,
for (i = 0; tmp->input_types[i] != NULL; i++)
papiAttributeListAddLPString(&p->attributes,
- PAPI_ATTR_APPEND, "document-format-supported",
- lp_type_to_mime_type(tmp->input_types[i]));
+ PAPI_ATTR_APPEND, "document-format-supported",
+ lp_type_to_mime_type(tmp->input_types[i]));
}
/* description */
papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "printer-info", tmp->description);
+ "printer-info", tmp->description);
/* add lpsched specific attributes */
papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "device-uri", tmp->device);
+ "device-uri", tmp->device);
papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-dial-info", tmp->dial_info);
+ "lpsched-dial-info", tmp->dial_info);
papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-fault-recovery", tmp->fault_rec);
+ "lpsched-fault-recovery", tmp->fault_rec);
papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-interface-script", tmp->interface);
+ "lpsched-interface-script", tmp->interface);
papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-data-rate", tmp->speed);
+ "lpsched-data-rate", tmp->speed);
papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-stty", tmp->stty);
+ "lpsched-stty", tmp->stty);
papiAttributeListAddBoolean(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-login-term", tmp->login);
+ "lpsched-login-term", tmp->login);
papiAttributeListAddBoolean(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-daisy", tmp->daisy);
+ "lpsched-daisy", tmp->daisy);
papiAttributeListAddLPStrings(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-charsets", tmp->char_sets);
+ "lpsched-charsets", tmp->char_sets);
#ifdef CAN_DO_MODULES
papiAttributeListAddLPStrings(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-modules", tmp->modules);
+ "lpsched-modules", tmp->modules);
#endif /* CAN_DO_MODULES */
papiAttributeListAddLPStrings(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-options", tmp->options);
+ "lpsched-options", tmp->options);
papiAttributeListAddLPStrings(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-printer-type", tmp->printer_types);
+ "lpsched-printer-type", tmp->printer_types);
if (tmp->fault_alert.shcmd != NULL) {
papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-fault-alert-command",
- tmp->fault_alert.shcmd);
+ "lpsched-fault-alert-command",
+ tmp->fault_alert.shcmd);
papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-fault-alert-threshold",
- tmp->fault_alert.Q);
+ "lpsched-fault-alert-threshold",
+ tmp->fault_alert.Q);
papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-fault-alert-interval",
- tmp->fault_alert.W);
+ "lpsched-fault-alert-interval",
+ tmp->fault_alert.W);
}
papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-cpi-value", tmp->cpi.val);
+ "lpsched-cpi-value", tmp->cpi.val);
papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-cpi-unit", tmp->cpi.sc);
+ "lpsched-cpi-unit", tmp->cpi.sc);
papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-lpi-value", tmp->lpi.val);
+ "lpsched-lpi-value", tmp->lpi.val);
papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-lpi-unit", tmp->lpi.sc);
+ "lpsched-lpi-unit", tmp->lpi.sc);
papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-plen-value", tmp->plen.val);
+ "lpsched-plen-value", tmp->plen.val);
papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-plen-unit", tmp->plen.sc);
+ "lpsched-plen-unit", tmp->plen.sc);
papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-pwid-value", tmp->pwid.val);
+ "lpsched-pwid-value", tmp->pwid.val);
papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-pwid-unit", tmp->pwid.sc);
+ "lpsched-pwid-unit", tmp->pwid.sc);
/* allow/deny list */
load_userprinter_access(dest, &allowed, &denied);
papiAttributeListAddLPStrings(&p->attributes, PAPI_ATTR_REPLACE,
- "requesting-user-name-allowed", allowed);
+ "requesting-user-name-allowed", allowed);
papiAttributeListAddLPStrings(&p->attributes, PAPI_ATTR_REPLACE,
- "requesting-user-name-denied", denied);
+ "requesting-user-name-denied", denied);
freelist(allowed);
freelist(denied);
@@ -263,16 +281,16 @@ lpsched_printer_configuration_to_attributes(service_t *svc, printer_t *p,
sysname.nodename[0] = 0;
}
snprintf(buf, sizeof (buf), "file://%s%s/ppd/%s.ppd",
- sysname.nodename, ETCDIR, tmp->name);
+ sysname.nodename, ETCDIR, tmp->name);
papiAttributeListAddString(&p->attributes, PAPI_ATTR_REPLACE,
- "ppd-file-uri", buf);
+ "ppd-file-uri", buf);
snprintf(buf, sizeof (buf), "file://%s%s",
- sysname.nodename, tmp->ppd);
+ sysname.nodename, tmp->ppd);
papiAttributeListAddString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-printer-configure-ppd-uri", buf);
+ "lpsched-printer-configure-ppd-uri", buf);
papiAttributeListAddString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-ppd-source-path", tmp->ppd);
+ "lpsched-ppd-source-path", tmp->ppd);
snprintf(buf, sizeof (buf), "%s/ppd/%s.ppd", ETCDIR, tmp->name);
@@ -299,33 +317,33 @@ printer_status_to_attributes(printer_t *p, char *printer, char *form,
return (PAPI_BAD_ARGUMENT);
papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "form-ready", form);
+ "form-ready", form);
papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-active-job", request_id);
+ "lpsched-active-job", request_id);
papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-mounted-char-set", character_set);
+ "lpsched-mounted-char-set", character_set);
papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-disable-reason", disable_reason);
+ "lpsched-disable-reason", disable_reason);
papiAttributeListAddDatetime(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-disable-date", disable_date);
+ "lpsched-disable-date", disable_date);
papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-reject-reason", reject_reason);
+ "lpsched-reject-reason", reject_reason);
papiAttributeListAddDatetime(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-reject-date", reject_date);
+ "lpsched-reject-date", reject_date);
/* add the current system time */
papiAttributeListAddDatetime(&p->attributes, PAPI_ATTR_REPLACE,
- "printer-current-time", time(NULL));
+ "printer-current-time", time(NULL));
/* add the time since last enabled */
papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "printer-up-time", time(NULL));
+ "printer-up-time", time(NULL));
/* add the status information */
lpsched_printer_status_to_attributes(&p->attributes, status);
papiAttributeListAddString(&p->attributes, PAPI_ATTR_EXCL,
- "printer-state-reasons", "none");
+ "printer-state-reasons", "none");
lpsched_printer_defaults(&p->attributes);
@@ -349,20 +367,20 @@ lpsched_class_configuration_to_attributes(service_t *svc, printer_t *p,
/* get the configuration DB data */
if ((tmp = getclass(dest)) == NULL) {
detailed_error(svc,
- gettext("unable to read configuration data"));
+ gettext("unable to read configuration data"));
return (PAPI_DEVICE_ERROR);
}
/* name */
papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "printer-name", tmp->name);
+ "printer-name", tmp->name);
if (tmp->name != NULL) {
char uri[BUFSIZ];
snprintf(uri, sizeof (uri), "lpsched://localhost/printers/%s",
- tmp->name);
+ tmp->name);
papiAttributeListAddString(&p->attributes, PAPI_ATTR_REPLACE,
- "printer-uri-supported", uri);
+ "printer-uri-supported", uri);
}
if (tmp->members != NULL) {
@@ -371,8 +389,8 @@ lpsched_class_configuration_to_attributes(service_t *svc, printer_t *p,
for (i = 0; members[i] != NULL; i++)
papiAttributeListAddString(&p->attributes,
- PAPI_ATTR_APPEND,
- "member-names", members[i]);
+ PAPI_ATTR_APPEND,
+ "member-names", members[i]);
}
freeclass(tmp);
@@ -388,22 +406,22 @@ class_status_to_attributes(printer_t *p, char *printer, short status,
return (PAPI_BAD_ARGUMENT);
papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-reject-reason", reject_reason);
+ "lpsched-reject-reason", reject_reason);
papiAttributeListAddDatetime(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-reject-date", reject_date);
+ "lpsched-reject-date", reject_date);
/* add the current system time */
papiAttributeListAddDatetime(&p->attributes, PAPI_ATTR_REPLACE,
- "printer-current-time", time(NULL));
+ "printer-current-time", time(NULL));
papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "printer-up-time", time(NULL));
+ "printer-up-time", time(NULL));
/* add the status information */
lpsched_printer_status_to_attributes(&p->attributes, status);
papiAttributeListAddString(&p->attributes, PAPI_ATTR_EXCL,
- "printer-state-reasons", "none");
+ "printer-state-reasons", "none");
lpsched_printer_defaults(&p->attributes);
@@ -422,10 +440,10 @@ attributes_to_printer(papi_attribute_t **attributes, PRINTER *tmp)
/* banner needs some conversion to the bitfield */
iter = NULL, string = NULL; flags = 0;
for (status = papiAttributeListGetString(attributes, &iter,
- "job-sheets-supported", &string);
+ "job-sheets-supported", &string);
status == PAPI_OK;
status = papiAttributeListGetString(attributes, &iter,
- NULL, &string))
+ NULL, &string))
if (strcasecmp(string, "none") == 0)
flags |= BAN_NEVER;
else if (strcasecmp(string, "standard") == 0)
@@ -436,10 +454,10 @@ attributes_to_printer(papi_attribute_t **attributes, PRINTER *tmp)
/* input_types needs mime-type conversion */
iter = NULL, string = NULL; list = NULL;
for (status = papiAttributeListGetString(attributes, &iter,
- "document-format-supported", &string);
+ "document-format-supported", &string);
status == PAPI_OK;
status = papiAttributeListGetString(attributes, &iter,
- NULL, &string))
+ NULL, &string))
addlist(&list, mime_type_to_lp_type(string));
if (list != NULL) {
if (tmp->input_types != NULL)
@@ -448,30 +466,30 @@ attributes_to_printer(papi_attribute_t **attributes, PRINTER *tmp)
}
papiAttributeListGetLPString(attributes,
- "device-uri", &tmp->device);
+ "device-uri", &tmp->device);
papiAttributeListGetLPString(attributes,
- "printer-info", &tmp->description);
+ "printer-info", &tmp->description);
papiAttributeListGetLPString(attributes,
- "lpsched-dial-info", &tmp->dial_info);
+ "lpsched-dial-info", &tmp->dial_info);
papiAttributeListGetLPString(attributes,
- "lpsched-fault-recovery", &tmp->fault_rec);
+ "lpsched-fault-recovery", &tmp->fault_rec);
papiAttributeListGetLPString(attributes,
- "lpsched-interface-script", &tmp->interface);
+ "lpsched-interface-script", &tmp->interface);
papiAttributeListGetLPString(attributes,
- "lpsched-data-rate", &tmp->speed);
+ "lpsched-data-rate", &tmp->speed);
papiAttributeListGetLPString(attributes,
- "lpsched-stty", &tmp->stty);
+ "lpsched-stty", &tmp->stty);
papiAttributeListGetLPStrings(attributes,
- "lpsched-charsets", &tmp->char_sets);
+ "lpsched-charsets", &tmp->char_sets);
papiAttributeListGetLPStrings(attributes,
- "lpsched-printer-types", &tmp->printer_types);
+ "lpsched-printer-types", &tmp->printer_types);
papiAttributeListGetLPStrings(attributes,
- "lpsched-options", &tmp->options);
+ "lpsched-options", &tmp->options);
papiAttributeListGetLPStrings(attributes,
- "lpsched-modules", &tmp->modules);
+ "lpsched-modules", &tmp->modules);
#ifdef LP_USE_PAPI_ATTR
papiAttributeListGetLPString(attributes,
- "lpsched-printer-ppd-uri", &tmp->ppd);
+ "lpsched-printer-ppd-uri", &tmp->ppd);
#endif
return (PAPI_OK);
diff --git a/usr/src/cmd/print/bsd-sysv-commands/common.c b/usr/src/cmd/print/bsd-sysv-commands/common.c
index 05aaa45758..5df4e3b9b7 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 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
*/
@@ -185,7 +185,10 @@ printer_state_line(FILE *fp, papi_printer_t p, int num_jobs, char *name)
if ((state != 0x03) || (num_jobs != 0)) {
fprintf(fp, "%s: %s", name, state_string(state));
- if (state == 0x05) /* stopped */
+ if ((state == 0x05) ||
+ (state == 0x06) ||
+ (state == 0x07) ||
+ (state == 0x08)) /* stopped */
fprintf(fp, ": %s\n", reason);
else
fprintf(fp, "\n");
diff --git a/usr/src/cmd/print/bsd-sysv-commands/lpstat.c b/usr/src/cmd/print/bsd-sysv-commands/lpstat.c
index 563f82320c..6f666bcc03 100644
--- a/usr/src/cmd/print/bsd-sysv-commands/lpstat.c
+++ b/usr/src/cmd/print/bsd-sysv-commands/lpstat.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
*/
@@ -406,6 +406,7 @@ report_printer(papi_service_t svc, char *name, papi_printer_t printer,
printf(gettext("is idle. enabled"));
break;
case 0x04: /* processing */
+ case 0x06: /* faulted printing */
status = papiPrinterListJobs(svc, name, NULL,
0, 0, &j);
@@ -445,10 +446,16 @@ report_printer(papi_service_t svc, char *name, papi_printer_t printer,
if ((jstate == 0x0008) ||
(jstate == 0x05) ||
(jstate == 0)) {
- printf(gettext
- ("now printing"\
- " %s-%d. enabled"),
- name, jobid);
+ if (pstat == 0x04)
+ printf(gettext
+ ("now printing"\
+ " %s-%d. enabled"),
+ name, jobid);
+ if (pstat == 0x06)
+ printf(gettext
+ ("faulted printing"\
+ " %s-%d. enabled"),
+ name, jobid);
break;
}
}
@@ -459,21 +466,34 @@ report_printer(papi_service_t svc, char *name, papi_printer_t printer,
case 0x05: /* stopped */
printf(gettext("disabled"));
break;
+ case 0x07: /* faulted printer */
+ printf(gettext("faulted. enabled"));
+ break;
+ case 0x08: /* waiting for auto retry */
+ printf(gettext("waiting for auto-retry."));
+ break;
default:
printf(gettext("unknown state(0x%x)."), pstat);
break;
}
- (void) time(&curr);
- (void) papiAttributeListGetDatetime(attrs, NULL,
- "printer-up-time", &curr);
- (void) papiAttributeListGetDatetime(attrs, NULL,
- "printer-state-time", &curr);
- (void) papiAttributeListGetDatetime(attrs, NULL,
- "lpsched-disable-date", &curr);
- printf(gettext(" since %s. available.\n"), nctime(&curr));
+ if (pstat == 0x08)
+ printf(gettext(" available.\n"));
+ else {
+ (void) time(&curr);
+ (void) papiAttributeListGetDatetime(attrs, NULL,
+ "printer-up-time", &curr);
+ (void) papiAttributeListGetDatetime(attrs, NULL,
+ "printer-state-time", &curr);
+ (void) papiAttributeListGetDatetime(attrs, NULL,
+ "lpsched-disable-date", &curr);
+ printf(gettext(" since %s. available.\n"), nctime(&curr));
+ }
- if (pstat == 0x05) {
+ if ((pstat == 0x05) ||
+ (pstat == 0x06) ||
+ (pstat == 0x07) ||
+ (pstat == 0x08)) {
char *reason = "unknown reason";
(void) papiAttributeListGetString(attrs, NULL,