getprinter.c revision c77e7dfd49d61dee08f2ca4d47808f8e78b13bc1
/*
* 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
*/
/*
* files/printers_getbyname.c -- "files" backend for
* nsswitch "printers" database.
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
static const char *printers = "/etc/printers.conf";
#include "files_common.h"
#include <stdlib.h>
#include <strings.h>
#include <ctype.h>
static int
{
/*
* find the name in the namelist a|b|c...:
*/
return (1);
} else {
linep++;
return (0);
if (*linep == '|')
linep++;
}
}
return (0);
}
const char *filter; /* advisory, to speed up */
/* string search */
{
int parsestat;
int (*func)();
return (NSS_NOTFOUND);
return (NSS_UNAVAIL); /* really panic, malloc failed */
}
return (res);
}
}
res = NSS_NOTFOUND;
/*CONSTCOND*/
while (1) {
int linelen;
/* End of file */
break;
}
/* begin at the first non-blank character */
instr++;
linelen--;
}
/* comment line, skip it. */
if (*instr == '#')
continue;
/* blank line, skip it */
continue;
/*
* Optimization: if the entry doesn't contain the
* filter string then it can't be the entry we want,
* so don't bother looking more closely at it.
*/
continue;
}
continue;
if (parsestat == NSS_STR_PARSE_SUCCESS) {
res = NSS_SUCCESS;
break;
} else if (parsestat == NSS_STR_PARSE_ERANGE) {
break;
} else if (parsestat == NSS_STR_PARSE_PARSE)
continue;
}
/*
* stayopen is set to 0 by default in order to close the opened
* file. Some applications may break if it is set to 1.
*/
(void) _nss_files_endent(be, 0);
}
return (res);
}
static nss_status_t
void *a;
{
(files_XY_check_func)0));
}
static nss_status_t
void *a;
{
}
static files_backend_op_t printers_ops[] = {
};
/*ARGSUSED*/
{
return (_nss_files_constr(printers_ops,
sizeof (printers_ops) / sizeof (printers_ops[0]),
NULL));
}