Mercurial > illumos > illumos-gate
changeset 10338:d5edb1b8521a
6854839 job id is different between lpstat -o and lpstat -p when lpd protocol is used
author | sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM> |
---|---|
date | Tue, 18 Aug 2009 11:38:50 +0530 |
parents | 75ffadc191c9 |
children | c22e58c7f4e3 |
files | usr/src/cmd/print/bsd-sysv-commands/lpstat.c |
diffstat | 1 files changed, 24 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/print/bsd-sysv-commands/lpstat.c Mon Aug 17 23:06:26 2009 -0700 +++ b/usr/src/cmd/print/bsd-sysv-commands/lpstat.c Tue Aug 18 11:38:50 2009 +0530 @@ -414,7 +414,6 @@ int i = 0; int32_t jobid = 0; int32_t jstate = 0; - int flag = 0; for (i = 0; j[i] != NULL; ++i) { papi_attribute_t **attr = @@ -424,18 +423,33 @@ NULL, "job-state", &jstate); papiAttributeListGetInteger(attr, NULL, "job-id", &jobid); + /* + * For lpd protocol "job-id-requested" + * should be read. + */ + papiAttributeListGetInteger(attr, + NULL, "job-id-requested", &jobid); /* - * If the job-state is in - * RS_PRINTING then only print. + * When lpd protocol is used job-state + * cannot be retrieved, therefore + * job-state will be 0. + * When ipp protocol is used, the + * active/printing job-state will be + * RS_PRINTING (0x0008) post s10u5. + * For pre-s10u5 job-state will be + * RS_ACTIVE (0x05). So print only when + * the job-state is RS_PRINTING (0x0008) + * or RS_ACTIVE (0x05) or 0 */ - if (jstate == 0x0008) { - if (flag == 0) - printf(gettext - ("now printing"\ - " %s-%d. enabled"), - name, jobid); - flag = 1; + if ((jstate == 0x0008) || + (jstate == 0x05) || + (jstate == 0)) { + printf(gettext + ("now printing"\ + " %s-%d. enabled"), + name, jobid); + break; } } papiJobListFree(j);