ndbm.h(7POSIX)

✨ ndbm.h β€” bestie edition πŸ’ΎπŸ’–

okay so this is the ndbm.h page from the POSIX Programmer's Manual (yes, section 7POSIX, we love a niche header). buckle up πŸŽ€


🌸 PROLOG 🌸

so like, this manual page is part of the POSIX Programmer's Manual, bestie. but heads up πŸ‘€ β€” the Linux implementation of this interface may differ (so pls consult the corresponding Linux manual page for the tea on Linux behavior), or honestly the interface may not even be implemented on Linux at all. it's giving "results may vary" 😭


πŸ’… NAME πŸ’…

ndbm.h β€” definitions for ndbm database operations. iconic, no notes. ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <ndbm.h>

that's it. that's the whole vibe. include it and you're in. πŸ’«


πŸ‘‘ DESCRIPTION πŸ‘‘

okay so the <ndbm.h> header shall define the datum type as a structure, and that structure shall include at least these members, periodt:

void   *dptr  A pointer to the application's data.
size_t  dsize The size of the object pointed to by dptr.

like, dptr is a pointer to the application's data, and dsize is the size of the object that dptr points to. slay. 🫢

the <ndbm.h> header shall also define the size_t type as described in <stddef.h>. yes bestie, same size_t as always, no new lore. πŸ’–

and the <ndbm.h> header shall define the DBM type. it's a type, it's mysterious, it's the moment. ✨

the header shall define these symbolic constants as possible values for the store_mode argument to dbm_store():

  • DBM_INSERT β€” insertion of new entries only. no touching what's already there, we respect boundaries πŸ’…
  • DBM_REPLACE β€” allow replacing existing entries. out with the old, in with the new πŸ”₯

the following shall be declared as functions, and may also be defined as macros. function prototypes shall be provided. (so yes, macros are allowed to exist, but you still get real prototypes β€” the way that POSIX does both, honestly obsessed πŸŽ€)

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 *);
datum   dbm_nextkey(DBM *);
DBM    *dbm_open(const char *, int, mode_t);
int     dbm_store(DBM *, datum, datum, int);

copy that exactly, character for character, bestie. do not freestyle the prototypes. πŸ™ˆ

the <ndbm.h> header shall define the mode_t type through typedef, as described in <sys/types.h>. (look at dbm_open up there β€” that third arg is a mode_t, iykyk πŸ‘€)

also lowkey important: the following sections are informative. so like, the tea below is context, not requirements. πŸ’€


🌈 APPLICATION USAGE 🌈

None.

literally nothing. empty. a void. she said nothing and left πŸ’€βœ¨


πŸ“ RATIONALE πŸ“

None.

no reasoning given, no thoughts, head empty, still iconic πŸŽ€


🧚 FUTURE DIRECTIONS 🧚

None.

the future is... unchanged. no cap. πŸ’œ


πŸ”₯ SEE ALSO πŸ”₯

go read these next bestie, they're all connected:

  • <stddef.h>
  • <sys_types.h>
  • The System Interfaces volume of POSIX.1‐2017, dbm_clearerr()

okay legal moment, stay with me, this part matters and we keep it exactly:

Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


🫢 and that's the whole page bestie β€” every flag, every prototype, every "None." preserved with love. no cap. πŸ’…

that's a wrap from your girl at IEEE/The Open Group, 2017 β€” ndbm.h(7POSIX), signing off πŸŒΈβœ¨πŸ’–