Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/gen Add -DSMALL so that this can be used in libhack.
details: https://anonhg.NetBSD.org/src/rev/2e0ee8d1d3e1
branches: trunk
changeset: 566006:2e0ee8d1d3e1
user: christos <christos%NetBSD.org@localhost>
date: Sun Apr 25 06:45:29 2004 +0000
description:
Add -DSMALL so that this can be used in libhack.
diffstat:
lib/libc/gen/getcap.c | 29 ++++++++++++++++++++++-------
1 files changed, 22 insertions(+), 7 deletions(-)
diffs (100 lines):
diff -r 695d6fcae3e2 -r 2e0ee8d1d3e1 lib/libc/gen/getcap.c
--- a/lib/libc/gen/getcap.c Sun Apr 25 06:45:02 2004 +0000
+++ b/lib/libc/gen/getcap.c Sun Apr 25 06:45:29 2004 +0000
@@ -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 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 @@
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 @@
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 @@
*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 @@
return (0);
}
+#ifndef SMALL
static int
cdbget(DB *capdbp, char **bp, const char *name)
{
@@ -666,6 +680,7 @@
*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
Home |
Main Index |
Thread Index |
Old Index