/*
* 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"
/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
#include "stdio.h"
#include "string.h"
#include "errno.h"
#include "stdlib.h"
#include <syslog.h>
#include "lp.h"
#include "printers.h"
extern struct {
char *v;
short len,
} prtrheadings[];
/**
** getprinter() - EXTRACT PRINTER STRUCTURE FROM DISK FILE
**/
PRINTER *
{
short daisy;
int fld;
int fd;
register char * p;
register char ** pp;
register char *** ppp;
register char * path;
int isNameAll;
return (0);
}
/*
* Getting ``all''? If so, jump into the directory
* wherever we left off.
*/
for (; ; ) {
/* fix for bug 1117241
* occasionally when a printer is removed, a printer directory
* is left behind, but the CONFIGFILE is removed. In this
* case this directory terminates the search for additional
* printers as we have been returning 0 in this case.
* Now, we loop back and try the next directory until
* we have no more directories or we find a directory with
* a CONFIGFILE
*/
if (isNameAll) {
return (0);
} else
lastdir = -1;
/*
* Get the printer configuration information.
*/
if (!path) {
if (isNameAll)
return (0);
}
* go around to loop again for
* NAME_ALL case
*/
if (!isNameAll) /* fix for bug 1117241 */
return(0);
else
}
else
break;
}
/*
* Initialize the entire structure, to ensure no random
* values get in it. However, make sure some values won't
* be null or empty. Do the latter here as opposed to
* after reading the file, because sometimes the file
*/
if (isNameAll)
#if defined(CAN_DO_MODULES)
#endif
/*
* Read the file.
*/
errno = 0;
if (
prtrheadings[fld].v
&& STRNEQU(
buf,
prtrheadings[fld].v,
)
) {
while (*p && *p == ' ')
p++;
break;
}
/*
* To allow future extensions to not impact applications
* using old versions of this routine, ignore strange
* fields.
*/
continue;
switch (fld) {
case PR_BAN:
else /* default to the LP default */
}
}
break;
case PR_LOGIN:
break;
case PR_CPI:
break;
case PR_LPI:
break;
case PR_LEN:
break;
case PR_WIDTH:
break;
case PR_CS:
goto CharStarStar;
case PR_ITYPES:
CharStarStar: if (*ppp)
break;
case PR_DEV:
goto CharStar;
case PR_DIAL:
goto CharStar;
case PR_RECOV:
goto CharStar;
case PR_INTFC:
goto CharStar;
case PR_PTYPE:
goto CharStarStar;
case PR_REMOTE:
goto CharStar;
case PR_SPEED:
goto CharStar;
case PR_STTY:
break;
#if defined(CAN_DO_MODULES)
case PR_MODULES:
goto CharStarStar;
#endif
case PR_OPTIONS:
goto CharStarStar;
break;
case PR_PPD:
{
goto CharStar;
}
}
}
if (errno != 0) {
freeprinter (prp);
errno = save_errno;
return (0);
}
/*
* Get the printer description (if it exists).
*/
return (0);
freeprinter (prp);
return (0);
}
/*
* Get the information for the alert. Don't fail if we can't
* read it because of access permission UNLESS we're "root"
* or "lp"
*/
if (
&& (
|| !getpid() /* we be root */
)
) {
freeprinter (prp);
return (0);
}
} else
/*
* Now go through the structure and see if we have
* anything strange.
*/
freeprinter (prp);
return (0);
}
/*
* Just in case somebody tried to pull a fast one
* by giving a printer type header by itself....
*/
if (!prp->printer_types)
/*
* If there are more than one printer type, then we can't
* have any input types, except perhaps ``simple''.
*/
if (
&& prp->input_types
&& (
)
) {
freeprinter (prp);
return (0);
}
/*
* If there are more than one printer types, none can
* be ``unknown''.
*/
if (
) {
freeprinter (prp);
return (0);
}
/*
* All the printer types had better agree on whether the
* printer takes print wheels!
*/
if (daisy == -1)
daisy = 0;
freeprinter (prp);
return (0);
}
}
/*
* Help out those who are still using the obsolete
* "printer_type" member.
*/
return (prp);
}