diff options
Diffstat (limited to 'usr/src/cmd')
-rw-r--r-- | usr/src/cmd/hal/addons/network-devices/network-discovery.xml | 3 | ||||
-rw-r--r-- | usr/src/cmd/lp/lib/papi/job.c | 8 | ||||
-rw-r--r-- | usr/src/cmd/lp/lib/papi/lpsched-jobs.c | 52 | ||||
-rw-r--r-- | usr/src/cmd/print/bsd-sysv-commands/in.lpd.c | 24 | ||||
-rw-r--r-- | usr/src/cmd/print/bsd-sysv-commands/lp.c | 22 |
5 files changed, 55 insertions, 54 deletions
diff --git a/usr/src/cmd/hal/addons/network-devices/network-discovery.xml b/usr/src/cmd/hal/addons/network-devices/network-discovery.xml index 8844dee0fa..d17d2cf5cc 100644 --- a/usr/src/cmd/hal/addons/network-devices/network-discovery.xml +++ b/usr/src/cmd/hal/addons/network-devices/network-discovery.xml @@ -93,6 +93,9 @@ </property_group> <property_group name='config' type='framework'> + <!-- authorization to add/delete config properties --> + <propval name='modify_authorization' type='astring' + value='solaris.smf.value.discovery.printers.snmp' /> <!-- authorization to modify config properties --> <propval name='value_authorization' type='astring' value='solaris.smf.value.discovery.printers.snmp' /> diff --git a/usr/src/cmd/lp/lib/papi/job.c b/usr/src/cmd/lp/lib/papi/job.c index b139224464..4ee09858ce 100644 --- a/usr/src/cmd/lp/lib/papi/job.c +++ b/usr/src/cmd/lp/lib/papi/job.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -623,7 +623,7 @@ papiJobValidate(papi_service_t handle, char *printer, int i; papiAttributeListAddString(&attributes, PAPI_ATTR_REPLACE, - "job-hold-until", "hold"); + "job-hold-until", "indefinite"); for (i = 0; job_attributes[i]; i++) list_append(&attributes, job_attributes[i]); @@ -1032,6 +1032,10 @@ papiJobModify(papi_service_t handle, char *printer, int32_t job_id, status = lpsched_end_change(svc, dest, job_id); lpsched_request_to_job_attributes(r, j); + + papiAttributeListAddInteger(&j->attributes, PAPI_ATTR_REPLACE, + "job-id", job_id); + freerequest(r); return (status); diff --git a/usr/src/cmd/lp/lib/papi/lpsched-jobs.c b/usr/src/cmd/lp/lib/papi/lpsched-jobs.c index 08d7f68524..933e2fc3af 100644 --- a/usr/src/cmd/lp/lib/papi/lpsched-jobs.c +++ b/usr/src/cmd/lp/lib/papi/lpsched-jobs.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -47,6 +47,7 @@ job_attributes_to_lpsched_request(papi_service_t svc, REQUEST *r, papi_status_t status = PAPI_OK; papi_attribute_t *attr; papi_attribute_t **unmapped = NULL; + papi_attribute_t *tmp[2]; int i; char *s; @@ -68,7 +69,7 @@ job_attributes_to_lpsched_request(papi_service_t svc, REQUEST *r, "job-originating-user-name", "job-printer", "job-sheets", "lp-charset", "lp-modes", "number-up", "orienttation-requested", "page-ranges", "pr-filter", - "pr-indent", "pr-title", "pr-width", "priority", + "pr-indent", "pr-title", "pr-width", "job-priority", "requesting-user-name", "job-originating-host-name", NULL }; @@ -90,11 +91,11 @@ job_attributes_to_lpsched_request(papi_service_t svc, REQUEST *r, * set the priority. PAPI/IPP uses 1-100, lpsched use 0-39, so we * have to convert it. */ - if (papiAttributeListGetInteger(attributes, NULL, "priority", &i) + if (papiAttributeListGetInteger(attributes, NULL, "job-priority", &i) == PAPI_OK) { if ((i < 1) || (i > 100)) i = 50; - i = (i + 1) / 2.5; + i = 40 - (i / 2.5); r->priority = i; } if ((r->priority < 0) || (r->priority > 39)) @@ -104,23 +105,15 @@ job_attributes_to_lpsched_request(papi_service_t svc, REQUEST *r, papiAttributeListGetLPString(attributes, "form", &r->form); /* set the page range */ -#ifndef LP_USE_PAPI_ATTR - papiAttributeListGetLPString(attributes, "page-ranges", &r->pages); -#else - for (status = papiAttributeListGetRange(attributes, &iterator, - "page-ranges", &lower, &upper); - status == PAPI_OK; - status = papiAttributeListGetRange(attributes, &iterator, - "page-ranges", &lower, &upper)) { - if (r->pages != NULL) { - snprintf(buf, sizeof (buf), "%s,%d-%d", - r->pages, lower, upper); - free(r->pages); - } else - snprintf(buf, sizeof (buf), "%d-%d", lower, upper); - r->pages = (char *)strdup(buf); - } -#endif + memset(tmp, NULL, sizeof (tmp)); + tmp[0] = papiAttributeListFind(attributes, "page-ranges"); + if (tmp[0] != NULL) { + char buf[BUFSIZ]; + + papiAttributeListToString(tmp, " ", buf, sizeof (buf)); + if ((s = strchr(buf, '=')) != NULL) + r->pages = (char *)strdup(++s); + } /* * set the document format, converting to old format names as @@ -167,13 +160,14 @@ job_attributes_to_lpsched_request(papi_service_t svc, REQUEST *r, s = NULL; papiAttributeListGetString(attributes, NULL, "job-hold-until", &s); if (s != NULL) { - if (strcmp(s, "immediate") == 0) - r->actions |= ACT_IMMEDIATE; - else if ((strcmp(s, "resume") == 0) || - (strcmp(s, "no-hold") == 0)) + r->actions &= ~(ACT_SPECIAL); /* strip immediate/hold/resume */ + if (strcmp(s, "resume") == 0) r->actions |= ACT_RESUME; - else if ((strcmp(s, "hold") == 0) || - (strcmp(s, "indefinite") == 0)) + else if ((strcmp(s, "immediate") == 0) || + (strcmp(s, "no-hold") == 0)) + r->actions |= ACT_IMMEDIATE; + else if ((strcmp(s, "indefinite") == 0) || + (strcmp(s, "hold") == 0)) r->actions |= ACT_HOLD; } @@ -281,7 +275,7 @@ job_attributes_to_lpsched_request(papi_service_t svc, REQUEST *r, char *buf = malloc(1024); ssize_t size = 1024; - while (papiAttributeListToString(unmapped, ", ", buf, size) + while (papiAttributeListToString(unmapped, " ", buf, size) != PAPI_OK) { size += 1024; buf = realloc(buf, size); @@ -417,7 +411,7 @@ lpsched_request_to_job_attributes(REQUEST *r, job_t *j) /* priority (map 0-39 to 1-100) */ papiAttributeListAddInteger(&j->attributes, PAPI_ATTR_REPLACE, - "job-priority", (int)((r->priority + 1) * 2.5)); + "job-priority", (int)(100 - (r->priority * 2.5))); /* pages */ papiAttributeListAddLPString(&j->attributes, PAPI_ATTR_REPLACE, 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 7782ee9a36..6a012adcb1 100644 --- a/usr/src/cmd/print/bsd-sysv-commands/in.lpd.c +++ b/usr/src/cmd/print/bsd-sysv-commands/in.lpd.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. * */ @@ -308,14 +308,10 @@ parse_cf(papi_service_t svc, char *cf, char **files) papiAttributeListAddString(&list, PAPI_ATTR_EXCL, "job-hold-until", "indefinite"); - else if (strcasecmp(entry, "release") == 0) + else if (strcasecmp(entry, "immediate") == 0) papiAttributeListAddString(&list, PAPI_ATTR_EXCL, "job-hold-until", "no-hold"); - else if (strcasecmp(entry, "immediate") == 0) - papiAttributeListAddInteger(&list, - PAPI_ATTR_EXCL, - "job-priority", 100); else papiAttributeListAddString(&list, PAPI_ATTR_EXCL, @@ -325,19 +321,23 @@ parse_cf(papi_service_t svc, char *cf, char **files) papiAttributeListAddBoolean(&list, PAPI_ATTR_EXCL, "rfc-1179-mail", 1); break; - case 'P': /* Solaris page list */ - papiAttributeListAddString(&list, - PAPI_ATTR_EXCL, - "page-ranges", ++entry); + case 'P': { /* Solaris page list */ + char buf[BUFSIZ]; + + snprintf(buf, sizeof (buf), "page-ranges=%s", + ++entry); + papiAttributeListFromString(&list, + PAPI_ATTR_EXCL, buf); + } break; case 'q': { /* Solaris priority */ int i = atoi(optarg); - i = 99 * (39 - i) / 39 + 1; + i = 100 - (i * 2.5); if ((i < 1) || (i > 100)) i = 50; papiAttributeListAddInteger(&list, - PAPI_ATTR_EXCL, "priority", i); + PAPI_ATTR_EXCL, "job-priority", i); } break; case 'S': /* Solaris character set */ diff --git a/usr/src/cmd/print/bsd-sysv-commands/lp.c b/usr/src/cmd/print/bsd-sysv-commands/lp.c index 5abe7ae7e8..aeec532e54 100644 --- a/usr/src/cmd/print/bsd-sysv-commands/lp.c +++ b/usr/src/cmd/print/bsd-sysv-commands/lp.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. * */ @@ -89,22 +89,22 @@ main(int ac, char *av[]) papiAttributeListAddString(&list, PAPI_ATTR_EXCL, "job-hold-until", "indefinite"); - else if (strcasecmp(optarg, "release") == 0) + else if (strcasecmp(optarg, "immediate") == 0) papiAttributeListAddString(&list, PAPI_ATTR_EXCL, "job-hold-until", "no-hold"); - else if (strcasecmp(optarg, "immediate") == 0) - papiAttributeListAddInteger(&list, - PAPI_ATTR_EXCL, - "job-priority", 100); else papiAttributeListAddString(&list, PAPI_ATTR_EXCL, "job-hold-until", optarg); break; - case 'P': /* page list */ - papiAttributeListAddString(&list, PAPI_ATTR_EXCL, - "page-ranges", optarg); + case 'P': { /* page list */ + char buf[BUFSIZ]; + + snprintf(buf, sizeof (buf), "page-ranges=%s", optarg); + papiAttributeListFromString(&list, + PAPI_ATTR_EXCL, buf); + } break; case 'S': /* charset */ papiAttributeListAddString(&list, PAPI_ATTR_EXCL, @@ -156,14 +156,14 @@ main(int ac, char *av[]) case 'q': { /* priority */ int i = atoi(optarg); - i = 99 * (39 - i) / 39 + 1; + i = 100 - (i * 2.5); if ((i < 1) || (i > 100)) { fprintf(stderr, gettext( "priority must be between 0 and 39.\n")); exit(1); } papiAttributeListAddInteger(&list, PAPI_ATTR_EXCL, - "priority", i); + "job-priority", i); } break; case 'r': /* "raw" mode */ |