/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*LINTLIBRARY*/
#include <stdio.h>
#include <stdarg.h>
#include <libintl.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
/* lpsched include files */
#include "lp.h"
#include "msgs.h"
#include "printers.h"
#include "class.h"
#include <papi_impl.h>
/*
* Format and send message to lpsched (die if any errors occur)
*/
/*VARARGS1*/
int
{
return (-1);
/* fill the message buffer */
if (rc < 0) {
gettext("unable to build message for scheduler: %s"),
return (rc);
}
/* write the message */
}
if (rc < 0)
gettext("unable to send message to scheduler: %s"),
return (rc);
}
/*
* Receive message from lpsched (die if any errors occur)
*/
int
{
return (-1);
/* read the message */
}
if (rc < 0)
gettext("unable to read message from scheduler: %s"),
else {
if (rc < 0)
gettext("unable to parse message from scheduler: %s"),
}
return (rc);
}
{
switch (status) {
case MNOMEM:
return (PAPI_TEMPORARY_ERROR);
case MNOFILTER:
return (PAPI_DOCUMENT_FORMAT_ERROR);
case MNOOPEN:
return (PAPI_DOCUMENT_ACCESS_ERROR);
case MERRDEST:
case MDENYDEST:
return (PAPI_NOT_ACCEPTING);
case MNOMEDIA:
return (PAPI_PRINT_SUPPORT_FILE_NOT_FOUND);
case MDENYMEDIA:
case MNOPERM:
return (PAPI_NOT_AUTHORIZED);
case MUNKNOWN:
case MNODEST:
case MNOINFO:
return (PAPI_NOT_FOUND);
case MTRANSMITERR:
return (PAPI_SERVICE_UNAVAILABLE);
case M2LATE:
return (PAPI_GONE);
case MBUSY:
return (PAPI_PRINTER_BUSY);
case MOK:
case MOKMORE:
return (PAPI_OK);
}
return (PAPI_INTERNAL_ERROR);
}
char *
{
switch (status) {
case MNOMEM:
return (gettext("lpsched: out of memory"));
case MNOFILTER:
return (gettext("No filter available to convert job"));
case MNOOPEN:
return (gettext("lpsched: could not open request"));
case MERRDEST:
return (gettext("queue disabled"));
case MDENYDEST:
return (gettext("destination denied request"));
case MNOMEDIA:
return (gettext("unknown form specified in job"));
case MDENYMEDIA:
return (gettext("access denied to form specified in job"));
case MUNKNOWN:
return (gettext("no such resource"));
case MNODEST:
return (gettext("unknown destination"));
case MNOPERM:
return (gettext("permission denied"));
case MNOINFO:
return (gettext("no information available"));
case MTRANSMITERR:
return (gettext("failure to communicate with lpsched"));
default: {
status);
return (result);
}
}
}
{
return (PAPI_BAD_ARGUMENT);
gettext("failed to allocate %d file(s) for request: %s"),
}
return (result);
}
{
long bits;
return (PAPI_BAD_ARGUMENT);
}
return (result);
}
char **tmp)
{
char *dest;
return (PAPI_BAD_ARGUMENT);
gettext("failed to initiate change for job (%s-%d): %s"),
}
return (result);
}
{
long bits;
char *dest;
return (PAPI_BAD_ARGUMENT);
}
return (result);
}
{
char *req_id;
char *dest;
return (PAPI_BAD_ARGUMENT);
}
return (result);
}
{
char *req_id;
char *dest;
return (PAPI_BAD_ARGUMENT);
message = "stopped by user";
}
return (result);
}
{
char *req_id;
char *dest;
return (PAPI_BAD_ARGUMENT);
}
return (result);
}
{
char *req_id;
char *dest;
return (PAPI_BAD_ARGUMENT);
message = "stopped by user";
}
return (result);
}
{
/* tell the scheduler it's going */
return (PAPI_SERVICE_UNAVAILABLE);
switch (type) {
case S_LOAD_PRINTER:
break;
case S_UNLOAD_PRINTER:
break;
case S_LOAD_CLASS:
type = R_LOAD_CLASS;
break;
case S_UNLOAD_CLASS:
}
return (PAPI_SERVICE_UNAVAILABLE);
return (result);
}
{
/* tell the scheduler it's going */
/* remove the scheduler config files */
}
return (result);
}
static void
{
(void) lpsched_load_unload_dest(handle,
} else
}
}
{
/* tell the scheduler it's going */
char *dflt;
/* remove the scheduler config files */
return (PAPI_SERVICE_UNAVAILABLE);
/* remove from any classes */
}
/* reset the default if it needs to be done */
}
return (result);
}
{
char *member;
/*
* The only attribute that we can modify for a class is the set of
* members. Anything else will be ignored.
*/
"member-names", &member);
/* modify the configuration file */
else
} else
} else
/* tell the scheduler about the changes */
return (result);
}
{
PRINTER *p;
p->banner = BAN_ALWAYS;
else
} else
freeprinter(p);
}
/* tell the scheduler about the changes */
return (result);
}
{
PRINTER *p;
if (type == 0) {
p->banner = BAN_ALWAYS;
}
} else
p = getprinter(dest);
if (p != NULL) {
else
} else
freeprinter(p);
} else
/* tell the scheduler about the changes */
return (result);
}