Add -DSMALL so that this can be used in libhack.
This commit is contained in:
parent
6101c5d9b5
commit
0b1d0cb383
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: getcap.c,v 1.40 2004/04/23 14:47:52 christos Exp $ */
|
||||
/* $NetBSD: getcap.c,v 1.41 2004/04/25 06:45:29 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -41,17 +41,21 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)getcap.c 8.3 (Berkeley) 3/25/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: getcap.c,v 1.40 2004/04/23 14:47:52 christos Exp $");
|
||||
__RCSID("$NetBSD: getcap.c,v 1.41 2004/04/25 06:45:29 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#ifndef SMALL
|
||||
#include "namespace.h"
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#ifndef SMALL
|
||||
#include <db.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
|
@ -87,7 +91,9 @@ static size_t topreclen; /* toprec length */
|
|||
static char *toprec; /* Additional record specified by cgetset() */
|
||||
static int gottoprec; /* Flag indicating retrieval of toprecord */
|
||||
|
||||
#ifndef SMALL
|
||||
static int cdbget(DB *, char **, const char *);
|
||||
#endif
|
||||
static int getent(char **, size_t *, const char * const *, int,
|
||||
const char *, int, char *);
|
||||
static int nfcmp(char *, char *);
|
||||
|
@ -241,14 +247,18 @@ static int
|
|||
getent(char **cap, size_t *len, const char * const *db_array, int fd,
|
||||
const char *name, int depth, char *nfield)
|
||||
{
|
||||
#ifndef SMALL
|
||||
DB *capdbp;
|
||||
char pbuf[MAXPATHLEN];
|
||||
char *cbuf;
|
||||
int retval;
|
||||
size_t clen;
|
||||
#endif
|
||||
char *record, *newrecord;
|
||||
char *r_end, *rp = NULL; /* pacify gcc */
|
||||
const char * const *db_p;
|
||||
int myfd = 0, eof, foundit, retval;
|
||||
size_t clen;
|
||||
char *record, *cbuf, *newrecord;
|
||||
int myfd = 0, eof, foundit;
|
||||
int tc_not_resolved;
|
||||
char pbuf[MAXPATHLEN];
|
||||
|
||||
_DIAGASSERT(cap != NULL);
|
||||
_DIAGASSERT(len != NULL);
|
||||
|
@ -301,6 +311,7 @@ getent(char **cap, size_t *len, const char * const *db_array, int fd,
|
|||
if (fd >= 0) {
|
||||
(void)lseek(fd, (off_t)0, SEEK_SET);
|
||||
} else {
|
||||
#ifndef SMALL
|
||||
(void)snprintf(pbuf, sizeof(pbuf), "%s.db", *db_p);
|
||||
if ((capdbp = dbopen(pbuf, O_RDONLY, 0, DB_HASH, 0))
|
||||
!= NULL) {
|
||||
|
@ -325,7 +336,9 @@ getent(char **cap, size_t *len, const char * const *db_array, int fd,
|
|||
*len = clen;
|
||||
*cap = cbuf;
|
||||
return (retval);
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
fd = open(*db_p, O_RDONLY, 0);
|
||||
if (fd < 0) {
|
||||
/* No error on unfound file. */
|
||||
|
@ -632,6 +645,7 @@ tc_exp: {
|
|||
return (0);
|
||||
}
|
||||
|
||||
#ifndef SMALL
|
||||
static int
|
||||
cdbget(DB *capdbp, char **bp, const char *name)
|
||||
{
|
||||
|
@ -666,6 +680,7 @@ cdbget(DB *capdbp, char **bp, const char *name)
|
|||
*bp = (char *)data.data + 1;
|
||||
return (((char *)(data.data))[0] == TCERR ? 1 : 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Cgetmatch will return 0 if name is one of the names of the capability
|
||||
|
|
Loading…
Reference in New Issue