process.c revision f928ce67ef743c33ea27c573c9c7e2d4a4833cbd
/*
* 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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <assert.h>
#include <locale.h>
#include "lp.h"
#include "printers.h"
#include "class.h"
#include "msgs.h"
#include "requests.h"
#include "oam.h"
#include "oam_def.h"
#include "lpc.h"
struct prnames {
char *printer;
};
int got_all_prnames;
extern int When;
extern char *Reason;
#if defined (__STDC__)
static void unlinkf(char *);
#else
static void unlinkf();
#endif
/**
** Obtain all printer names from LPSCHED and save them in
** a linked list of printer names.
**/
static void
#if defined(__STDC__)
get_all_prnames(void)
#else
#endif
{
char *printer,
*form,
*char_set,
short printer_status,
long enable_date,
int rc;
if (got_all_prnames)
return;
/*
* Send a message to LPSCHED to retrive all printer names
* This is done by sending a: S_INQUIRE_PRINTER_STATUS to LPSCHED.
* This will return the current status of the job underway on
* all the printers on the system.
*/
do {
&printer,
&form,
&char_set,
&reject_date);
/*NOTREACHED*/
}
else
/* Copy : printer name
* Increment the entry count.
*/
got_all_prnames = 1;
return;
}
/*
** The actual work in passing the commands to LPCSHED is done here
** canceling jobs and the temporary files etc
**/
/*
** Disable the queue to a printer.
**/
void
#if defined(__STDC__)
#else
char *dest;
#endif
{
short status;
if (!reason)
reason = "unknown reason";
switch (status) {
case MOK:
case MERRDEST:
break;
case MNODEST:
break;
case MNOPERM:
break;
default:
/*NOTREACHED*/
}
}
/*
** Enable the queue to a printer.
**/
void
#if defined(__STDC__)
#else
char *dest;
#endif
{
short status;
switch (status) {
case MOK:
case MERRDEST:
break;
case MNODEST:
break;
case MNOPERM:
break;
default:
/*NOTREACHED*/
}
}
/*
** Enable printing on the given printer.
**/
void
#if defined(__STDC__)
#else
char *dest;
#endif
{
short status;
switch (status) {
case MOK:
case MERRDEST:
break;
case MNODEST:
break;
case MNOPERM:
break;
default:
/*NOTREACHED*/
}
}
/*
** Disable printing on the named printer.
**/
void
#if defined(__STDC__)
#else
char *dest;
#endif
{
short status;
char *req_id;
if (!reason)
reason = "stopped by user";
switch (status) {
case MOK:
case MERRDEST:
break;
case MNODEST:
break;
case MNOPERM:
break;
default:
/*NOTREACHED*/
}
return;
}
void
#if defined(__STDC__)
#else
char *printer;
#endif
{
char *tprinter;
int rc, entry_count;
char *user,
*form,
*file,
*char_set,
short printer_status,
long size,
date;
char buff[100];
entry_count = 0;
&tprinter,
&form,
&char_set,
&reject_date);
switch (status) {
case MOK:
case MOKMORE:
break;
case MNODEST:
return;
default:
/*NOTREACHED*/
}
gettext("enabled"));
gettext("enabled"));
do {
&user,
&size,
&date,
&state,
&tprinter,
&form,
&char_set,
&rank,
&file);
switch (status) {
case MOK:
case MOKMORE:
entry_count++;
break;
case MNOINFO:
break;
default:
/*NOTREACHED*/
}
if (entry_count == 0 )
else if (entry_count == 1)
else
if (entry_count) {
else if (printer_status & PS_FAULTED)
}
/*??? what to do for remote printers:
possible status:
"waiting for RM to come up"
"waiting for queue to be enabled on RM"
"sending to RM"
"no space on remote; waiting for queue to drain"
*/
}
void
#if defined(__STDC__)
#else
char *dest;
#endif
{
}
void
#if defined(__STDC__)
#else
char *dest;
#endif
{
}
void
#if defined(__STDC__)
#else
char *dest;
#endif
{
}
/* avoids compiler type checking problem */
static int
#if defined(__STDC__)
#else
void *s1;
void *s2;
#endif
{
}
void
#if defined(__STDC__)
#else
char *dest;
#endif
{
int i;
short more;
long status;
char * req_id;
do {
switch (status) {
case MOK:
break;
case M2LATE:
break;
case MUNKNOWN:
case MNOINFO:
case MNOPERM:
break;
default:
status);
exit (1);
}
return;
}
static void
#if defined(__STDC__)
#else
char *name;
#endif
{
else
}
void
#if defined(__STDC__)
#else
void (*func)();
#endif
{
}