status.c revision 0a44ef6d9afbfe052a7e975f55ea0d2954b62a82
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "stdlib.h"
#include "string.h"
#include "unistd.h"
#include <syslog.h>
#include "lpsched.h"
static void load_pstatus ( void );
static void load_fault_status ( void );
static void load_cstatus ( void );
static void put_multi_line ( int , char * );
static PFSTATUS * parseFormList ( char *,short *);
static void markFormsMounted( PSTATUS *);
#define FAULT_MESSAGE_FILE "faultMessage"
static char *pstatus = 0,
*cstatus = 0;
/**
**/
void
load_status(void)
{
load_pstatus ();
load_cstatus ();
return;
}
/**
** load_pstatus() - LOAD PRITNER STATUS FILE
**/
static void
load_pstatus(void)
{
char *rej_reason,
*name,
*p;
short status;
int i,
len,
int fd;
register int f;
short numForms;
if (!pstatus)
status = 0;
total = 0;
name = 0;
rej_reason = 0;
dis_reason = 0;
ppfs = 0;
errno = 0;
for (f = 0;
f++) {
*p = '\0';
switch (f) {
case PST_BRK:
break;
case PST_NAME:
break;
case PST_STATUS:
status |= PS_DISABLED;
if (!p || !*(++p))
break;
if (NCMP(p, NAME_REJECTING))
status |= PS_REJECTED;
break;
case PST_DATE:
if (!p || !*(++p))
break;
break;
case PST_DISREAS:
f--;
}
if (dis_reason) {
total+1
);
} else {
}
break;
case PST_REJREAS:
f--;
}
if (rej_reason) {
total+1
);
} else {
}
break;
case PST_PWHEEL:
if (*buf) {
} else {
ppws = 0;
pwheel_name = 0;
}
break;
case PST_FORM:
break;
}
}
return;
}
pps->dis_reason =
} else {
}
} else {
if (ppfs)
if (dis_reason)
Free (dis_reason);
if (rej_reason)
Free (rej_reason);
}
if (name)
}
}
if (fd >= 0) {
if (errno != 0) {
return;
}
}
}
return;
}
/**
** load_fault_status() - LOAD PRITNER Fault STATUS FILE
**/
static void
load_fault_status(void)
{
char *fault_reason = NULL,
*p;
int i,
len,
int fd;
if (printerName) {
FAULT_MESSAGE_FILE , (char *) 0);
fault_reason = NULL;
total = 0;
if (fault_reason) {
total+1);
} else {
}
}
if (fault_reason &&
- 1;
if (*p == '\n')
*p = 0;
}
if (fault_reason)
}
}
}
}
/**
** load_cstatus() - LOAD CLASS STATUS FILE
**/
static void
load_cstatus(void)
{
char *rej_reason,
*name,
*p;
short status;
int i,
len,
int fd;
register int f;
if (!cstatus)
errno = 0;
status = 0;
total = 0;
name = 0;
rej_reason = 0;
for (f = 0;
f++) {
*p = '\0';
switch (f) {
case CST_BRK:
break;
case CST_NAME:
break;
case CST_STATUS:
status |= PS_REJECTED;
break;
case CST_DATE:
break;
case CST_REJREAS:
f--;
}
if (rej_reason) {
total+1
);
} else {
}
break;
}
}
return;
}
} else
if (rej_reason)
Free (rej_reason);
if (name)
}
}
if (fd >= 0) {
if (errno != 0) {
return;
}
}
}
return;
}
/**
** showForms()
**/
char *
{
int i;
char buf[100];
short numForms;
if (ppfs) {
for (i = 0; i < numForms; i++) {
if (formList) {
}
return(NULL);
}
}
}
return(formList);
}
/**
** markFormsMounted()
**/
void
{
int i;
int numTrays;
if (ppfs) {
for (i = 0; i < numTrays; i++) {
if (pfs)
}
}
}
/**
** parseFormList()
**/
static PFSTATUS *
{
int i;
short numForms=0;
while (ptr) {
numForms++;
}
numForms = 1;
if (numForms &&
if (!endPtr)
*endPtr = 0;
}
} else {
*num = 0;
}
return(ppfs);
}
/**
** dump_pstatus() - DUMP PRINTER STATUS FILE
**/
void
dump_pstatus(void)
{
int fd;
register int f;
int i;
if (!pstatus)
return;
}
for (f = 0; f < PST_MAX; f++) switch (f) {
case PST_BRK:
break;
case PST_NAME:
break;
case PST_STATUS:
break;
case PST_DATE:
break;
case PST_DISREAS:
break;
case PST_REJREAS:
break;
case PST_PWHEEL:
break;
case PST_FORM: {
char *list;
if (list)
break;
}
}
}
return;
}
/**
** dump_fault_status() - DUMP PRINTER FAULT STATUS FILE
**/
void
{
int fd;
char *fault_status, *printerName;
(char *) 0);
} else {
}
return;
}
/**
** dump_cstatus() - DUMP CLASS STATUS FILE
**/
void
dump_cstatus(void)
{
int fd;
register int f;
int i;
if (!cstatus)
return;
}
for (f = 0; f < CST_MAX; f++) switch (f) {
case CST_BRK:
break;
case CST_NAME:
break;
case CST_STATUS:
);
break;
case CST_DATE:
break;
case CST_REJREAS:
break;
}
}
return;
}
/**
** put_multi_line() - PRINT OUT MULTI-LINE TEXT
**/
static void
{
register char *cp,
*p;
if (!buf) {
return;
}
*cp++ = 0;
p = cp;
}
return;
}