aboutsummaryrefslogtreecommitdiff
path: root/src/gdbmsetopt.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-08-11 12:07:32 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2011-08-11 12:07:32 +0000
commitbd2e0f98caf08c5c0448773cd1cf91dceee557bb (patch)
tree54fbebdabf744f926d120b777801cc048b6adc8f /src/gdbmsetopt.c
parente8a2a215a7b73924da50b1407f107cfccd4fe979 (diff)
downloadgdbm-bd2e0f98caf08c5c0448773cd1cf91dceee557bb.tar.gz
gdbm-bd2e0f98caf08c5c0448773cd1cf91dceee557bb.tar.bz2
New option GDBM_GETDBNAME.
* src/gdbm.h.in (GDBM_GETDBNAME): New option. * src/gdbmsetopt.c (gdbm_setopt): Handle GDBM_GETDBNAME. * doc/gdbm.texinfo (Options): Document GDBM_GETDBNAME.
Diffstat (limited to 'src/gdbmsetopt.c')
-rw-r--r--src/gdbmsetopt.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gdbmsetopt.c b/src/gdbmsetopt.c
index 7961304..c31cdd5 100644
--- a/src/gdbmsetopt.c
+++ b/src/gdbmsetopt.c
@@ -231,6 +231,24 @@ gdbm_setopt (GDBM_FILE dbf, int optflag, void *optval, int optlen)
}
break;
+ case GDBM_GETDBNAME:
+ if (!optval || optlen != sizeof (char*))
+ {
+ gdbm_errno = GDBM_OPT_ILLEGAL;
+ return -1;
+ }
+ else
+ {
+ char *p = strdup (dbf->name);
+ if (!p)
+ {
+ gdbm_errno = GDBM_MALLOC_ERROR;
+ return -1;
+ }
+ *(char**) optval = p;
+ }
+ break;
+
default:
gdbm_errno = GDBM_OPT_ILLEGAL;
return -1;

Return to:

Send suggestions and report system problems to the System administrator.