lpsched-msgs.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*LINTLIBRARY*/
#include <stdio.h>
#include <stdarg.h>
#include <libintl.h>
#include <string.h>
#include <stdlib.h>
/* lpsched include files */
#include "lp.h"
#include "msgs.h"
#include "printers.h"
#include <papi_impl.h>
/*
* Format and send message to lpsched (die if any errors occur)
*/
/*VARARGS1*/
int
{
int rc = -1;
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
{
int rc = -1;
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:
return (PAPI_DEVICE_ERROR);
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 MOK:
case MOKMORE:
return (PAPI_OK);
}
return (PAPI_INTERNAL_ERROR);
}
char *
lpsched_status_string(short status)
{
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("An error occured in submission"));
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: {
static char result[16];
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);
}
{
short status;
char *req_id;
char *dest;
return (PAPI_BAD_ARGUMENT);
}
return (result);
}
const char *message)
{
short status;
char *req_id;
char *dest;
return (PAPI_BAD_ARGUMENT);
message = "stopped by user";
}
return (result);
}