diff options
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | match.c | 10 | ||||
-rw-r--r-- | txr.1 | 10 | ||||
-rw-r--r-- | txr.c | 10 |
4 files changed, 33 insertions, 9 deletions
@@ -1,3 +1,15 @@ +2012-02-27 Kaz Kylheku <kaz@kylheku.com> + + * match.c (extract): Check for negative value of opt_nobindings, + which forces the printing. + + * txr.c (help): Under -b, mention that printing the word false is + suppressed also. Added documentation for -B. + (main): Implemented -B option. + + * txr.1: Documented -B option and added clarifying text under -b + option explaining the conditions under which bindings are printed. + 2012-02-26 Kaz Kylheku <kaz@kylheku.com> Fix the issue properly, once and for all, of how to determine @@ -3590,12 +3590,10 @@ int extract(val spec, val files, val predefined_bindings) predefined_bindings, t, nil))); - if (!output_produced) { - if (!opt_nobindings) { - if (bindings) { - bindings = nreverse(bindings); - dump_bindings(bindings); - } + if ((!output_produced && opt_nobindings <= 0) || opt_nobindings < 0) { + if (bindings) { + bindings = nreverse(bindings); + dump_bindings(bindings); } if (!success) @@ -107,7 +107,15 @@ Suppresses the printing of variable bindings for a successful query, and the word . IR false for a failed query. The program still sets an appropriate -termination status. +termination status. Bindings are implicitly suppressed if the TXR query +performs an output operation on any file stream other than *stddebug*. +(Internal streams like string streams do not count as output.) + +.IP -B +Force the printing of variable bindings for a successful query, and the +word . +IR false +for a failed query, even if the program produced output. .IP "-l or --lisp-bindings" Print the variable bindings in Lisp syntax instead of shell syntax. @@ -90,8 +90,11 @@ static void help(void) "-Dvar Predefine variable var, with empty string value.\n" "-q Quiet: don't report errors during query matching.\n" "-v Verbose: extra logging from matcher.\n" -"-b Don't dump list of bindings.\n" -"-l If dumping bindings, use a Lisp format.\n" +"-b Don't dump list of bindings, or 'false'\n" +" on unsuccessful termination.\n" +"-B Force list of bindings to be dumped, or false\n" +" if termination is unsuccessful.\n" +"-l If dumping bindings, use TXR Lisp format.\n" "-d Debugger mode.\n" "-a num Generate array variables up to num-dimensions.\n" " Default is 1. Additional dimensions are fudged\n" @@ -329,6 +332,9 @@ int txr_main(int argc, char **argv) case 'b': opt_nobindings = 1; break; + case 'B': + opt_nobindings = -1; + break; case 'l': opt_lisp_bindings = 1; break; |