diff options
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/print/bsd-sysv-commands/accept.c | 12 | ||||
-rw-r--r-- | usr/src/cmd/print/bsd-sysv-commands/disable.c | 11 | ||||
-rw-r--r-- | usr/src/cmd/print/bsd-sysv-commands/enable.c | 10 | ||||
-rw-r--r-- | usr/src/cmd/print/bsd-sysv-commands/reject.c | 10 | ||||
-rw-r--r-- | usr/src/lib/print/libpapi-lpd/common/mapfile | 8 | ||||
-rw-r--r-- | usr/src/lib/print/libpapi-lpd/common/printer.c | 78 |
6 files changed, 106 insertions, 23 deletions
diff --git a/usr/src/cmd/print/bsd-sysv-commands/accept.c b/usr/src/cmd/print/bsd-sysv-commands/accept.c index 903d7728ba..74f392c9c3 100644 --- a/usr/src/cmd/print/bsd-sysv-commands/accept.c +++ b/usr/src/cmd/print/bsd-sysv-commands/accept.c @@ -1,3 +1,4 @@ + /* * CDDL HEADER START * @@ -99,9 +100,14 @@ main(int ac, char *av[]) "accepting requests.\n"), printer); exit_status = 1; } else { - fprintf(stderr, gettext("accept: %s: %s\n"), printer, - verbose_papi_message(svc, status)); - exit_status = 1; + if (status == PAPI_OPERATION_NOT_SUPPORTED) { + fprintf(stderr, + verbose_papi_message(svc, status)); + } else { + fprintf(stderr, gettext("accept: %s: %s\n"), + printer, verbose_papi_message(svc, status)); + exit_status = 1; + } } papiServiceDestroy(svc); diff --git a/usr/src/cmd/print/bsd-sysv-commands/disable.c b/usr/src/cmd/print/bsd-sysv-commands/disable.c index 95f6dbd230..0b3cb71f0c 100644 --- a/usr/src/cmd/print/bsd-sysv-commands/disable.c +++ b/usr/src/cmd/print/bsd-sysv-commands/disable.c @@ -1,3 +1,4 @@ + /* * CDDL HEADER START * @@ -141,8 +142,14 @@ main(int ac, char *av[]) printer); exit_status = 1; } else { - fprintf(stderr, gettext("disable: %s: %s\n"), printer, - verbose_papi_message(svc, status)); + /* The operation is not supported in lpd protocol */ + if (status == PAPI_OPERATION_NOT_SUPPORTED) { + fprintf(stderr, + verbose_papi_message(svc, status)); + } else { + fprintf(stderr, gettext("disable: %s: %s\n"), + printer, verbose_papi_message(svc, status)); + } exit_status = 1; } diff --git a/usr/src/cmd/print/bsd-sysv-commands/enable.c b/usr/src/cmd/print/bsd-sysv-commands/enable.c index f67ace102c..c197337e1e 100644 --- a/usr/src/cmd/print/bsd-sysv-commands/enable.c +++ b/usr/src/cmd/print/bsd-sysv-commands/enable.c @@ -99,8 +99,14 @@ main(int ac, char *av[]) printer); exit_status = 1; } else { - fprintf(stderr, gettext("enable: %s: %s\n"), printer, - verbose_papi_message(svc, status)); + /* The operation is not supported in lpd protocol */ + if (status == PAPI_OPERATION_NOT_SUPPORTED) { + fprintf(stderr, + verbose_papi_message(svc, status)); + } else { + fprintf(stderr, gettext("enable: %s: %s\n"), + printer, verbose_papi_message(svc, status)); + } exit_status = 1; } diff --git a/usr/src/cmd/print/bsd-sysv-commands/reject.c b/usr/src/cmd/print/bsd-sysv-commands/reject.c index 777172f2fa..2952bafba6 100644 --- a/usr/src/cmd/print/bsd-sysv-commands/reject.c +++ b/usr/src/cmd/print/bsd-sysv-commands/reject.c @@ -104,8 +104,14 @@ main(int ac, char *av[]) "accepting requests.\n"), printer); exit_status = 1; } else { - fprintf(stderr, gettext("reject: %s: %s\n"), printer, - verbose_papi_message(svc, status)); + /* The operation is not supported in lpd protocol */ + if (status == PAPI_OPERATION_NOT_SUPPORTED) { + fprintf(stderr, + verbose_papi_message(svc, status)); + } else { + fprintf(stderr, gettext("reject: %s: %s\n"), + printer, verbose_papi_message(svc, status)); + } exit_status = 1; } diff --git a/usr/src/lib/print/libpapi-lpd/common/mapfile b/usr/src/lib/print/libpapi-lpd/common/mapfile index d8c1da6ca9..d113b208a2 100644 --- a/usr/src/lib/print/libpapi-lpd/common/mapfile +++ b/usr/src/lib/print/libpapi-lpd/common/mapfile @@ -97,10 +97,10 @@ SUNW_1.0 { papiPrinterAdd = FUNCTION FILTER libpapi-common.so ; papiPrinterModify = FUNCTION FILTER libpapi-common.so ; papiPrinterRemove = FUNCTION FILTER libpapi-common.so ; - papiPrinterDisable = FUNCTION FILTER libpapi-common.so ; - papiPrinterEnable = FUNCTION FILTER libpapi-common.so ; - papiPrinterPause = FUNCTION FILTER libpapi-common.so ; - papiPrinterResume = FUNCTION FILTER libpapi-common.so ; + papiPrinterDisable ; + papiPrinterEnable ; + papiPrinterPause ; + papiPrinterResume ; papiPrinterPurgeJobs ; papiPrinterListJobs ; papiPrinterGetAttributeList ; diff --git a/usr/src/lib/print/libpapi-lpd/common/printer.c b/usr/src/lib/print/libpapi-lpd/common/printer.c index 653540f9de..308d9c9443 100644 --- a/usr/src/lib/print/libpapi-lpd/common/printer.c +++ b/usr/src/lib/print/libpapi-lpd/common/printer.c @@ -20,18 +20,17 @@ */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * */ /* $Id: printer.c 149 2006-04-25 16:55:01Z njacobs $ */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdlib.h> #include <strings.h> #include <papi_impl.h> +#include <libintl.h> static int contains(char *value, char **list) @@ -67,7 +66,7 @@ papiPrinterQuery(papi_service_t handle, char *name, if ((contains("printer-state", requested_attrs) == 1) || (contains("printer-state-reasons", requested_attrs) == 1)) status = lpd_find_printer_info(svc, - (printer_t **)printer); + (printer_t **)printer); if ((status == PAPI_OK) && (*printer == NULL)) { char buf[BUFSIZ]; @@ -75,19 +74,19 @@ papiPrinterQuery(papi_service_t handle, char *name, *printer = p = calloc(1, sizeof (*p)); papiAttributeListAddString(&(p->attributes), - PAPI_ATTR_APPEND, "printer-name", - queue_name_from_uri(svc->uri)); + PAPI_ATTR_APPEND, "printer-name", + queue_name_from_uri(svc->uri)); if (uri_to_string(svc->uri, buf, sizeof (buf)) == 0) papiAttributeListAddString(&(p->attributes), - PAPI_ATTR_APPEND, - "printer-uri-supported", buf); + PAPI_ATTR_APPEND, + "printer-uri-supported", buf); } /* Set printer accepting: mimic prepapi behavior */ if ((p = *printer) != NULL) papiAttributeListAddBoolean(&(p->attributes), - PAPI_ATTR_REPLACE, - "printer-is-accepting-jobs", PAPI_TRUE); + PAPI_ATTR_REPLACE, + "printer-is-accepting-jobs", PAPI_TRUE); } @@ -160,3 +159,62 @@ papiPrinterListFree(papi_printer_t *printers) free(printers); } } + + +papi_status_t +papiPrinterDisable(papi_service_t handle, char *name, char *message) +{ + service_t *svc = handle; + papi_status_t status; + + if ((status = service_fill_in(svc, name)) == PAPI_OK) { + detailed_error(svc, + gettext("Warning: %s is remote, disable has no meaning."), + queue_name_from_uri(svc->uri)); + } + return (PAPI_OPERATION_NOT_SUPPORTED); +} + +papi_status_t +papiPrinterEnable(papi_service_t handle, char *name) +{ + service_t *svc = handle; + papi_status_t status; + + if ((status = service_fill_in(svc, name)) == PAPI_OK) { + detailed_error(svc, + gettext("Warning: %s is remote, enable has no meaning."), + queue_name_from_uri(svc->uri)); + } + return (PAPI_OPERATION_NOT_SUPPORTED); +} + + +papi_status_t +papiPrinterResume(papi_service_t handle, char *name) +{ + service_t *svc = handle; + papi_status_t status; + + if ((status = service_fill_in(svc, name)) == PAPI_OK) { + detailed_error(svc, + gettext("Warning: %s is remote, accept has no meaning."), + queue_name_from_uri(svc->uri)); + } + return (PAPI_OPERATION_NOT_SUPPORTED); +} + + +papi_status_t +papiPrinterPause(papi_service_t handle, char *name, char *message) +{ + service_t *svc = handle; + papi_status_t status; + + if ((status = service_fill_in(svc, name)) == PAPI_OK) { + detailed_error(svc, + gettext("Warning: %s is remote, reject has no meaning."), + queue_name_from_uri(svc->uri)); + } + return (PAPI_OPERATION_NOT_SUPPORTED); +} |