getrpcent_r.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) 1986-1992 by Sun Microsystems Inc.
*
* Rentrant (MT-safe) getrpcYY interfaces.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <ctype.h>
#include <nss_dbdefs.h>
#include <stdlib.h>
#include <string.h>
int str2rpcent(const char *, int, void *,
char *, int);
static int rpc_stayopen; /* Unsynchronized, but it affects only */
/* efficiency, not correctness */
static DEFINE_NSS_DB_ROOT(db_root);
static DEFINE_NSS_GETENT(context);
void
nss_db_params_t *p;
{
trace1(TR__nss_initf_rpc, 0);
p->name = NSS_DBNAM_RPC;
}
struct rpcent *
const char *name;
char *buffer;
int buflen;
{
NSS_XbyY_FINI(&arg);
}
struct rpcent *
const int number;
char *buffer;
int buflen;
{
NSS_XbyY_FINI(&arg);
}
void
const int stay;
{
trace1(TR_setrpcent, 0);
rpc_stayopen |= stay;
}
void
{
trace1(TR_endrpcent, 0);
rpc_stayopen = 0;
}
struct rpcent *
char *buffer;
int buflen;
{
/* No key, no stayopen */
NSS_XbyY_FINI(&arg);
}
int
const char *instr;
int lenstr;
void *ent;
char *buffer;
int buflen;
{
char numbuf[12];
char *numend;
return NSS_STR_PARSE_PARSE;
}
p = instr;
p++;
}
namestart = p;
p++; /* Skip over the canonical name */
}
return NSS_STR_PARSE_ERANGE;
}
p++;
}
if (p >= limit) {
/* Syntax error -- no RPC number */
return NSS_STR_PARSE_PARSE;
}
numstart = p;
do {
p++; /* Find the end of the RPC number */
/* Syntax error -- supposed number is too long */
return NSS_STR_PARSE_PARSE;
}
if (*numend != '\0') {
return NSS_STR_PARSE_PARSE;
}
p++;
}
/*
* Although nss_files_XY_all calls us with # stripped,
* we should be able to deal with it here in order to
* be more useful.
*/
char **ptr;
sizeof (char *));
return NSS_STR_PARSE_ERANGE;
} else {
*ptr = 0;
return NSS_STR_PARSE_SUCCESS;
}
}
return NSS_STR_PARSE_SUCCESS;
}