fncs.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 (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright 2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
#include "unistd.h"
#include "errno.h"
#include "fcntl.h"
#include "stdlib.h"
#include "string.h"
#include "lpsched.h"
/**
** walk_ptable() - WALK PRINTER TABLE, RETURNING ACTIVE ENTRIES
** walk_ftable() - WALK FORMS TABLE, RETURNING ACTIVE ENTRIES
** walk_ctable() - WALK CLASS TABLE, RETURNING ACTIVE ENTRIES
** walk_pwtable() - WALK PRINT WHEEL TABLE, RETURNING ACTIVE ENTRIES
**/
PSTATUS *
walk_ptable(int start)
{
*ps = 0;
}
ps++;
return (ps = 0);
else
return (ps++);
}
FSTATUS *
walk_ftable(int start)
{
*ps = 0;
}
ps++;
return (ps = 0);
else
return (ps++);
}
CSTATUS *
walk_ctable (int start)
{
*ps = 0;
}
ps++;
return (ps = 0);
else
return (ps++);
}
PWSTATUS *
walk_pwtable(int start)
{
*ps = 0;
}
ps++;
return (ps = 0);
else
return (ps++);
}
/**
** search_ptable() - SEARCH PRINTER TABLE
** search_ftable() - SEARCH FORMS TABLE
** search_ctable() - SEARCH CLASS TABLE
** search_pwtable() - SEARCH PRINT WHEEL TABLE
**/
PSTATUS *
search_ptable(register char *name)
{
*psend;
for (
ps++
)
;
ps = 0;
return (ps);
}
FSTATUS *
search_ftable(register char *name)
{
ps = 0;
return (ps);
}
FSTATUS *
search_fptable(register char *paper)
{
break;
} else if (!cand)
}
return (cand);
}
CSTATUS *
search_ctable(register char *name)
{
*psend;
for (
ps++
)
;
ps = 0;
return (ps);
}
PWSTATUS *
search_pwtable(register char *name)
{
*psend;
for (
ps++
)
;
ps = 0;
return (ps);
}
/**
** load_str() - LOAD STRING WHERE ALLOC'D STRING MAY BE
** unload_str() - REMOVE POSSIBLE ALLOC'D STRING
**/
void
{
if (*pdst)
return;
}
void
unload_str(char **pdst)
{
if (*pdst)
*pdst = 0;
return;
}
/**
** unload_list() - REMOVE POSSIBLE ALLOC'D LIST
**/
void
unload_list(char ***plist)
{
if (*plist)
*plist = 0;
return;
}
/**
** load_sdn() - LOAD STRING WITH ASCII VERSION OF SCALED DECIMAL NUMBER
**/
void
{
if (!p)
return;
if (*p)
Free (*p);
*p = 0;
return;
*p = Malloc(sizeof("999999.999x"));
sprintf (
*p,
"%.3f%s",
);
return;
}
/**
** Getform() - EASIER INTERFACE TO "getform()"
**/
_FORM *
{
int ret;
while (
)
;
if (ret == -1)
return (0);
} else {
}
return (&_formbuf);
}
/**
** Getprinter()
** Getrequest()
** Getuser()
** Getclass()
** Getpwheel()
** Getsecure()
** Getsystem()
** Loadfilters()
**/
PRINTER *
Getprinter(char *name)
{
;
return (ret);
}
REQUEST *
Getrequest(char *file)
{
;
return (ret);
}
USER *
{
;
return (ret);
}
CLASS *
{
;
return (ret);
}
PWHEEL *
{
;
return (ret);
}
SECURE *
{
;
}
int
Loadfilters(char *file)
{
register int ret;
;
return (ret);
}
/**
** free_form() - FREE MEMORY ALLOCATED FOR _FORM STRUCTURE
**/
void
{
if (!pf)
return;
return;
}
/**
** getreqno() - GET NUMBER PART OF REQUEST ID
**/
char *
{
register char *cp;
else
cp++;
return (cp);
}
/* Putsecure(): Insurance for writing out the secure request file.
* input: char ptr to name of the request file,
* ptr to the SECURE structure to be written.
* ouput: 0 if successful, -1 otherwise.
*
* Description:
* The normal call to putsecure() is woefully lacking.
* The bottom line here is that there
* is no way to make sure that the file has been written out
* as expected. This can cause rude behaviour later on.
*
* This routine calls putsecure(), and then does a getsecure().
* The results are compared to the original structure. If the
* info obtained by getsecure() doesn't match, we retry a few
* times before giving up (presumably something is very seriously
* wrong at that point).
*/
int
{
int status; /* 0 = success, nonzero otherwise */
while (retries--) {
continue;
}
status = 2;
continue;
}
/* now compare each field */
/*
* A comparison is only valid if secbufp and pls point to
* different locations. In reality getsecure() will have
* already been called, allocating the same STATIC memory
* location to both structures making the following compare
* meaningless.
* Therefore test for this condition to prevent us from
* calling freesecure which will destroy uid, system and
* req_id fields in the strucure
*/
status = 0;
status = 3;
continue;
}
status = 4;
continue;
}
status = 5;
continue;
}
status = 6;
continue;
}
status = 7;
continue;
}
status = 8;
continue;
}
status = 9;
continue;
}
}
break;
}
if (status != 0) {
return -1;
}
return 0;
}
{
*ptr++ = *r++;
}
char *r;
r++;
else
r = buf;
} else
return;
}
/**
** _Malloc()
** _Realloc()
** _Calloc()
** _Strdup()
** _Free()
**/
void (*lp_alloc_fail_handler)( void ) = 0;
typedef void *alloc_type;
extern etext;
{
if (!ret) {
(*lp_alloc_fail_handler)();
}
return (ret);
}
{
if (!ret) {
(*lp_alloc_fail_handler)();
}
return (ret);
}
{
if (!ret) {
(*lp_alloc_fail_handler)();
}
return (ret);
}
char *
{
char * ret;
if (!s)
return( (char *) 0);
if (!ret) {
(*lp_alloc_fail_handler)();
}
return (ret);
}
void
{
return;
}