diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-05-15 18:31:55 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-05-15 18:31:55 +0000 |
commit | 04d75f9797ce3d117e0f8a18f925c096014ed1fa (patch) | |
tree | 3aec2ba937c52b5f12e3bc75703cbb668eb0a17f /src/var.c | |
parent | bd1fd16d2eab21688a1e9b536821eae4970cedfd (diff) | |
download | gdbm-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')
-rw-r--r-- | src/var.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -59,6 +59,7 @@ static struct variable vartab[] = { | |||
59 | { "mmap", VART_BOOL, VARF_INIT, { num: 1 } }, | 59 | { "mmap", VART_BOOL, VARF_INIT, { num: 1 } }, |
60 | { "sync", VART_BOOL, VARF_INIT, { num: 0 } }, | 60 | { "sync", VART_BOOL, VARF_INIT, { num: 0 } }, |
61 | { "pager", VART_STRING, VARF_DFL }, | 61 | { "pager", VART_STRING, VARF_DFL }, |
62 | { "quiet", VART_BOOL, VARF_DFL }, | ||
62 | { NULL } | 63 | { NULL } |
63 | }; | 64 | }; |
64 | 65 | ||
@@ -355,7 +356,7 @@ variable_is_true (const char *name) | |||
355 | { | 356 | { |
356 | int n; | 357 | int n; |
357 | 358 | ||
358 | if (variable_get (name, VART_BOOL, (void **) &n)) | 359 | if (variable_get (name, VART_BOOL, (void **) &n) == VAR_OK) |
359 | return 1; | 360 | return n; |
360 | return n; | 361 | return 0; |
361 | } | 362 | } |