355b4669e025ff377602b6fc7caaf30dbc218371jacobs * CDDL HEADER START
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * The contents of this file are subject to the terms of the
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * Common Development and Distribution License (the "License").
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * You may not use this file except in compliance with the License.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * See the License for the specific language governing permissions
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * and limitations under the License.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * When distributing Covered Code, include this CDDL HEADER in each
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * If applicable, add the following below this CDDL HEADER, with the
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * fields enclosed by brackets "[]" replaced with your own identifying
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * information: Portions Copyright [yyyy] [name of copyright owner]
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * CDDL HEADER END
dd850934386c395d7dd28457dab735df80de144cKeerthi Kondaka * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * Use is subject to license terms.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs/* $Id: lpc.c 146 2006-03-24 00:26:54Z njacobs $ */
355b4669e025ff377602b6fc7caaf30dbc218371jacobsstatic papi_encryption_t encryption = PAPI_ENCRYPT_NEVER;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs/* ARGSUSED0 */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* NOTREACHED */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (0);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs char *pattrs[] = { "printer-state", "printer-state-reasons",
355b4669e025ff377602b6fc7caaf30dbc218371jacobs status = papiPrinterQuery(svc, destination, pattrs, NULL, &p);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papi_attribute_t **list = papiPrinterGetAttributeList(p);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs (accepting ? gettext("enabled") : gettext("disabled")));
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (-1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (0);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs fprintf(stderr, gettext("Usage: abort (destination)\n"));
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (-1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs status = papiPrinterPause(svc, destination, "paused via lpc abort");
355b4669e025ff377602b6fc7caaf30dbc218371jacobs printf(gettext("%s: processing disabled after current job\n"),
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (0);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs fprintf(stderr, gettext("Usage: clean (destination)\n"));
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (-1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs status = papiPrinterPurgeJobs(svc, destination, &jobs);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs fprintf(stderr, gettext("clean: %s: %s\n"), destination,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (-1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (0);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs fprintf(stderr, gettext("Usage: disable: (destination)\n"));
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (-1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs fprintf(stderr, gettext("disable: %s: %s\n"), destination,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (-1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (0);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs fprintf(stderr, gettext("Usage: enable: (destination)\n"));
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (-1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs fprintf(stderr, gettext("enable: %s: %s\n"), destination,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (-1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (0);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs fprintf(stderr, gettext("Usage: start (destination)\n"));
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (-1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs fprintf(stderr, gettext("start: %s: %s\n"), destination,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (-1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (0);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs fprintf(stderr, gettext("Usage: stop (destination)\n"));
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (-1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs status = papiPrinterPause(svc, destination, "paused via lpc");
355b4669e025ff377602b6fc7caaf30dbc218371jacobs fprintf(stderr, gettext("stop: %s: %s\n"), destination,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (-1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (0);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs fprintf(stderr, gettext("Usage: topq (destination) (id)\n"));
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (-1);
dd850934386c395d7dd28457dab735df80de144cKeerthi Kondaka fprintf(stderr, gettext("topq: %s-%d: %s\n"), destination, id,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (-1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (0);
355b4669e025ff377602b6fc7caaf30dbc218371jacobsstatic int lpc_help(papi_service_t svc, char **args); /* forward reference */
355b4669e025ff377602b6fc7caaf30dbc218371jacobsstatic char help_status[] = "show status of daemon and queue";
355b4669e025ff377602b6fc7caaf30dbc218371jacobs "disable print queue terminating any active job processing";
355b4669e025ff377602b6fc7caaf30dbc218371jacobsstatic char help_clean[] = "remove all jobs from a queue";
355b4669e025ff377602b6fc7caaf30dbc218371jacobsstatic char help_disable[] = "turn off spooling to a queue";
355b4669e025ff377602b6fc7caaf30dbc218371jacobs "turn off queueing and printing for a queue and set a reason";
355b4669e025ff377602b6fc7caaf30dbc218371jacobsstatic char help_enable[] = "turn on spooling to a queue";
355b4669e025ff377602b6fc7caaf30dbc218371jacobsstatic char help_restart[] = "restart job processing for a queue";
355b4669e025ff377602b6fc7caaf30dbc218371jacobsstatic char help_start[] = "turn on printing from a queue";
355b4669e025ff377602b6fc7caaf30dbc218371jacobsstatic char help_stop[] = "turn off printing from a queue";
355b4669e025ff377602b6fc7caaf30dbc218371jacobsstatic char help_up[] = "turn on queueing and printing for a queue";
355b4669e025ff377602b6fc7caaf30dbc218371jacobsstatic char help_topq[] = "put a job at the top of the queue";
355b4669e025ff377602b6fc7caaf30dbc218371jacobsstatic struct {
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (-1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobsstatic char *
355b4669e025ff377602b6fc7caaf30dbc218371jacobs/* ARGSUSED0 */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (0);
355b4669e025ff377602b6fc7caaf30dbc218371jacobsprocess_one(int (*handler)(papi_service_t, char **), char **av, int expected)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs status = papiServiceCreate(&svc, printer, NULL, NULL,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs "Failed to contact service for %s: %s\n"),
355b4669e025ff377602b6fc7caaf30dbc218371jacobsprocess_all(int (*handler)(papi_service_t, char **), char **av, int expected)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs status = papiServiceCreate(&svc, NULL, NULL, NULL, NULL,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs fprintf(stderr, gettext("Failed to contact service: %s\n"),
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (-1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (-1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* prompt */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* get command */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs switch (c) {