mirror of
https://github.com/openbsd/src.git
synced 2025-01-04 23:35:36 -08:00
Make ndbm match POSIX. A datum consists of a void *dptr and a size_t dsize.
Also make the open functions take a mode_t, not int. OK deraadt@
This commit is contained in:
parent
22036547e1
commit
cbc29a2bee
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ndbm.h,v 1.5 2003/06/02 19:34:12 millert Exp $ */
|
||||
/* $OpenBSD: ndbm.h,v 1.6 2004/05/03 17:27:50 millert Exp $ */
|
||||
/* $NetBSD: ndbm.h,v 1.6 1995/07/20 23:31:11 jtc Exp $ */
|
||||
|
||||
/*-
|
||||
@ -54,25 +54,24 @@
|
||||
#define DBM_SUFFIX ".db"
|
||||
|
||||
typedef struct {
|
||||
char *dptr;
|
||||
int dsize;
|
||||
void *dptr;
|
||||
size_t dsize;
|
||||
} datum;
|
||||
|
||||
typedef DB DBM;
|
||||
#define dbm_pagfno(a) DBM_PAGFNO_NOT_AVAILABLE
|
||||
|
||||
__BEGIN_DECLS
|
||||
int dbm_clearerr(DBM *);
|
||||
void dbm_close(DBM *);
|
||||
int dbm_delete(DBM *, datum);
|
||||
int dbm_error(DBM *);
|
||||
datum dbm_fetch(DBM *, datum);
|
||||
datum dbm_firstkey(DBM *);
|
||||
long dbm_forder(DBM *, datum);
|
||||
datum dbm_nextkey(DBM *);
|
||||
DBM *dbm_open(const char *, int, int);
|
||||
DBM *dbm_open(const char *, int, mode_t);
|
||||
int dbm_store(DBM *, datum, datum, int);
|
||||
int dbm_dirfno(DBM *);
|
||||
int dbm_error(DBM *);
|
||||
int dbm_clearerr(DBM *);
|
||||
int dbm_rdonly(DBM *);
|
||||
__END_DECLS
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ndbm.c,v 1.17 2003/06/25 21:15:05 deraadt Exp $ */
|
||||
/* $OpenBSD: ndbm.c,v 1.18 2004/05/03 17:27:50 millert Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
@ -36,7 +36,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dbm.c 8.6 (Berkeley) 11/7/95";
|
||||
#else
|
||||
static const char rcsid[] = "$OpenBSD: ndbm.c,v 1.17 2003/06/25 21:15:05 deraadt Exp $";
|
||||
static const char rcsid[] = "$OpenBSD: ndbm.c,v 1.18 2004/05/03 17:27:50 millert Exp $";
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@ -59,7 +59,7 @@ static const char rcsid[] = "$OpenBSD: ndbm.c,v 1.17 2003/06/25 21:15:05 deraadt
|
||||
*/
|
||||
static DBM *__cur_db;
|
||||
|
||||
static DBM *_dbm_open(const char *, const char *, int, int);
|
||||
static DBM *_dbm_open(const char *, const char *, int, mode_t);
|
||||
|
||||
/*
|
||||
* Returns:
|
||||
@ -192,7 +192,8 @@ static DBM *
|
||||
_dbm_open(file, suff, flags, mode)
|
||||
const char *file;
|
||||
const char *suff;
|
||||
int flags, mode;
|
||||
int flags;
|
||||
mode_t mode;
|
||||
{
|
||||
HASHINFO info;
|
||||
char path[MAXPATHLEN];
|
||||
@ -224,7 +225,8 @@ _dbm_open(file, suff, flags, mode)
|
||||
DBM *
|
||||
dbm_open(file, flags, mode)
|
||||
const char *file;
|
||||
int flags, mode;
|
||||
int flags;
|
||||
mode_t mode;
|
||||
{
|
||||
|
||||
return(_dbm_open(file, DBM_SUFFIX, flags, mode));
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: dbm.3,v 1.8 2003/06/17 21:56:23 millert Exp $
|
||||
.\" $OpenBSD: dbm.3,v 1.9 2004/05/03 17:27:50 millert Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1999 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
.\"
|
||||
@ -53,8 +53,8 @@ The key and the content data are described by the
|
||||
data structure:
|
||||
.Bd -literal -offset indent
|
||||
typedef struct {
|
||||
char *dptr;
|
||||
int dsize;
|
||||
void *dptr;
|
||||
size_t dsize;
|
||||
} datum
|
||||
.Ed
|
||||
.Pp
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" David Leonard, 1998. Placed in the public domain.
|
||||
.\" $OpenBSD: ndbm.3,v 1.13 2003/10/21 20:30:16 jmc Exp $
|
||||
.\" $OpenBSD: ndbm.3,v 1.14 2004/05/03 17:27:50 millert Exp $
|
||||
.Dd May 13, 1998
|
||||
.Dt NDBM 3
|
||||
.Os
|
||||
@ -35,7 +35,7 @@
|
||||
.Ft datum
|
||||
.Fn dbm_nextkey "DBM *db"
|
||||
.Ft "DBM *"
|
||||
.Fn dbm_open "const char *file" "int flags" "int mode"
|
||||
.Fn dbm_open "const char *file" "int flags" "mode_t mode"
|
||||
.Ft int
|
||||
.Fn dbm_pagfno "DBM *db"
|
||||
.Ft int
|
||||
@ -51,8 +51,8 @@ The key and the content data are described by the
|
||||
data structure:
|
||||
.Bd -literal -offset indent
|
||||
typedef struct {
|
||||
char *dptr;
|
||||
int dsize;
|
||||
void *dptr;
|
||||
size_t dsize;
|
||||
} datum
|
||||
.Ed
|
||||
.Pp
|
||||
@ -198,4 +198,5 @@ and corresponds to those errors described in
|
||||
.Sh SEE ALSO
|
||||
.Xr open 2 ,
|
||||
.Xr db 3 ,
|
||||
.Xr dbm 3 ,
|
||||
.Xr hash 3
|
||||
|
Loading…
Reference in New Issue
Block a user