summaryrefslogtreecommitdiffabout
path: root/src/var.c
authorSergey Poznyakoff <gray@gnu.org.ua>2013-05-15 18:31:55 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2013-05-15 18:31:55 (GMT)
commit04d75f9797ce3d117e0f8a18f925c096014ed1fa (patch) (side-by-side diff)
tree3aec2ba937c52b5f12e3bc75703cbb668eb0a17f /src/var.c
parentbd1fd16d2eab21688a1e9b536821eae4970cedfd (diff)
downloadgdbm-04d75f9797ce3d117e0f8a18f925c096014ed1fa.tar.gz
gdbm-04d75f9797ce3d117e0f8a18f925c096014ed1fa.tar.bz2
Implement the "quiet" variable.
* src/var.c (vartab) <quiet>: New variable. (variable_is_true): Return 0 if the value cannot be retrieved. * src/gdbmtool.c (optab): New option --file (-f). (main): Handle the --file option. Retrieve the "quiet" setting from the variable. * src/lex.l (context_pop): Clear both point.file and yylloc.
Diffstat (limited to 'src/var.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/var.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/var.c b/src/var.c
index a080483..20db896 100644
--- a/src/var.c
+++ b/src/var.c
@@ -59,6 +59,7 @@ static struct variable vartab[] = {
{ "mmap", VART_BOOL, VARF_INIT, { num: 1 } },
{ "sync", VART_BOOL, VARF_INIT, { num: 0 } },
{ "pager", VART_STRING, VARF_DFL },
+ { "quiet", VART_BOOL, VARF_DFL },
{ NULL }
};
@@ -355,7 +356,7 @@ variable_is_true (const char *name)
{
int n;
- if (variable_get (name, VART_BOOL, (void **) &n))
- return 1;
- return n;
+ if (variable_get (name, VART_BOOL, (void **) &n) == VAR_OK)
+ return n;
+ return 0;
}

Return to:

Send suggestions and report system problems to the System administrator.