| version 1.39, 2003/10/27 00:12:42 |
version 1.40, 2004/04/23 14:47:52 |
| Line 87 static size_t topreclen; /* toprec leng |
|
| Line 87 static size_t topreclen; /* toprec leng |
|
| static char *toprec; /* Additional record specified by cgetset() */ |
static char *toprec; /* Additional record specified by cgetset() */ |
| static int gottoprec; /* Flag indicating retrieval of toprecord */ |
static int gottoprec; /* Flag indicating retrieval of toprecord */ |
| |
|
| static int cdbget __P((DB *, char **, const char *)); |
static int cdbget(DB *, char **, const char *); |
| static int getent __P((char **, size_t *, char **, int, const char *, int, char *)); |
static int getent(char **, size_t *, const char * const *, int, |
| static int nfcmp __P((char *, char *)); |
const char *, int, char *); |
| |
static int nfcmp(char *, char *); |
| |
|
| /* |
/* |
| * Cgetset() allows the addition of a user specified buffer to be added |
* Cgetset() allows the addition of a user specified buffer to be added |
| Line 97 static int nfcmp __P((char *, char *)); |
|
| Line 98 static int nfcmp __P((char *, char *)); |
|
| * virtual database. 0 is returned on success, -1 on failure. |
* virtual database. 0 is returned on success, -1 on failure. |
| */ |
*/ |
| int |
int |
| cgetset(ent) |
cgetset(const char *ent) |
| const char *ent; |
|
| { |
{ |
| const char *source, *check; |
const char *source, *check; |
| char *dest; |
char *dest; |
| Line 208 cgetcap(buf, cap, type) |
|
| Line 208 cgetcap(buf, cap, type) |
|
| * reference loop is detected. |
* reference loop is detected. |
| */ |
*/ |
| int |
int |
| cgetent(buf, db_array, name) |
cgetent(char **buf, const char * const *db_array, const char *name) |
| char **buf, **db_array; |
|
| const char *name; |
|
| { |
{ |
| size_t dummy; |
size_t dummy; |
| |
|
| Line 240 cgetent(buf, db_array, name) |
|
| Line 238 cgetent(buf, db_array, name) |
|
| * MAX_RECURSION. |
* MAX_RECURSION. |
| */ |
*/ |
| static int |
static int |
| getent(cap, len, db_array, fd, name, depth, nfield) |
getent(char **cap, size_t *len, const char * const *db_array, int fd, |
| char **cap, **db_array, *nfield; |
const char *name, int depth, char *nfield) |
| const char *name; |
|
| size_t *len; |
|
| int fd, depth; |
|
| { |
{ |
| DB *capdbp; |
DB *capdbp; |
| char *r_end, *rp = NULL, **db_p; /* pacify gcc */ |
char *r_end, *rp = NULL; /* pacify gcc */ |
| |
const char * const *db_p; |
| int myfd = 0, eof, foundit, retval; |
int myfd = 0, eof, foundit, retval; |
| size_t clen; |
size_t clen; |
| char *record, *cbuf, *newrecord; |
char *record, *cbuf, *newrecord; |
|
|
| } |
} |
| |
|
| static int |
static int |
| cdbget(capdbp, bp, name) |
cdbget(DB *capdbp, char **bp, const char *name) |
| DB *capdbp; |
|
| char **bp; |
|
| const char *name; |
|
| { |
{ |
| DBT key; |
DBT key; |
| DBT data; |
DBT data; |
| Line 679 cdbget(capdbp, bp, name) |
|
| Line 672 cdbget(capdbp, bp, name) |
|
| * record buf, -1 if not. |
* record buf, -1 if not. |
| */ |
*/ |
| int |
int |
| cgetmatch(buf, name) |
cgetmatch(const char *buf, const char *name) |
| const char *buf, *name; |
|
| { |
{ |
| const char *np, *bp; |
const char *np, *bp; |
| |
|
| Line 723 cgetmatch(buf, name) |
|
| Line 715 cgetmatch(buf, name) |
|
| } |
} |
| |
|
| int |
int |
| cgetfirst(buf, db_array) |
cgetfirst(char **buf, const char * const *db_array) |
| char **buf, **db_array; |
|
| { |
{ |
| |
|
| _DIAGASSERT(buf != NULL); |
_DIAGASSERT(buf != NULL); |
| Line 736 cgetfirst(buf, db_array) |
|
| Line 727 cgetfirst(buf, db_array) |
|
| |
|
| static FILE *pfp; |
static FILE *pfp; |
| static int slash; |
static int slash; |
| static char **dbp; |
static const char * const *dbp; |
| |
|
| int |
int |
| cgetclose() |
cgetclose(void) |
| { |
{ |
| if (pfp != NULL) { |
if (pfp != NULL) { |
| (void)fclose(pfp); |
(void)fclose(pfp); |
|
|
| * upon returning an entry with more remaining, and -1 if an error occurs. |
* upon returning an entry with more remaining, and -1 if an error occurs. |
| */ |
*/ |
| int |
int |
| cgetnext(bp, db_array) |
cgetnext(char **bp, const char * const *db_array) |
| char **bp; |
|
| char **db_array; |
|
| { |
{ |
| size_t len; |
size_t len; |
| int status, done; |
int status, done; |
| Line 893 cgetnext(bp, db_array) |
|
| Line 882 cgetnext(bp, db_array) |
|
| * allocation failure). |
* allocation failure). |
| */ |
*/ |
| int |
int |
| cgetstr(buf, cap, str) |
cgetstr(char *buf, const char *cap, char **str) |
| char *buf; |
|
| const char *cap; |
|
| char **str; |
|
| { |
{ |
| u_int m_room; |
u_int m_room; |
| const char *bp; |
const char *bp; |
| Line 1031 cgetstr(buf, cap, str) |
|
| Line 1017 cgetstr(buf, cap, str) |
|
| * error was encountered (storage allocation failure). |
* error was encountered (storage allocation failure). |
| */ |
*/ |
| int |
int |
| cgetustr(buf, cap, str) |
cgetustr(char *buf, const char *cap, char **str) |
| char *buf; |
|
| const char *cap; |
|
| char **str; |
|
| { |
{ |
| u_int m_room; |
u_int m_room; |
| const char *bp; |
const char *bp; |
| Line 1114 cgetustr(buf, cap, str) |
|
| Line 1097 cgetustr(buf, cap, str) |
|
| * numeric capability couldn't be found. |
* numeric capability couldn't be found. |
| */ |
*/ |
| int |
int |
| cgetnum(buf, cap, num) |
cgetnum(char *buf, const char *cap, long *num) |
| char *buf; |
|
| const char *cap; |
|
| long *num; |
|
| { |
{ |
| long n; |
long n; |
| int base, digit; |
int base, digit; |
| Line 1183 cgetnum(buf, cap, num) |
|
| Line 1163 cgetnum(buf, cap, num) |
|
| * Compare name field of record. |
* Compare name field of record. |
| */ |
*/ |
| static int |
static int |
| nfcmp(nf, rec) |
nfcmp(char *nf, char *rec) |
| char *nf, *rec; |
|
| { |
{ |
| char *cp, tmp; |
char *cp, tmp; |
| int ret; |
int ret; |