diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2011-04-29 10:35:31 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2011-04-29 10:35:31 +0300 |
commit | 70a498e0df48c71699797024fcb4c8154599ea5d (patch) | |
tree | 544ce76df279e47303dd1deb532986b655bd2853 /debug.c | |
parent | 04746bc5c0301fac55badc956225f486607dffd9 (diff) | |
download | egawk-70a498e0df48c71699797024fcb4c8154599ea5d.tar.gz egawk-70a498e0df48c71699797024fcb4c8154599ea5d.tar.bz2 egawk-70a498e0df48c71699797024fcb4c8154599ea5d.zip |
Bug fixes from John and Pat.
Diffstat (limited to 'debug.c')
-rw-r--r-- | debug.c | 22 |
1 files changed, 14 insertions, 8 deletions
@@ -346,11 +346,6 @@ static struct command_source *cmd_src = NULL; } \ } while (FALSE) -#define r_format_arg static NODE * format_arg -#define fmt_msg d_error -#include "awkprintf.h" -#undef fmt_msg -#undef r_format_arg /* g_readline -- read a line of text; the interface is like 'readline' but * without any command-line editing; used when not compiled with @@ -4865,8 +4860,9 @@ do_print_f(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) int i; CMDARG *a; NODE **tmp; - NODE *r; char *name; + NODE *r; + volatile jmp_buf fatal_tag_stack; /* count maximum required size for tmp */ for (a = arg; a != NULL ; a = a->next) @@ -4944,8 +4940,18 @@ do_print_f(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) } force_string(tmp[0]); - r = format_arg(tmp[0]->stptr, tmp[0]->stlen, tmp, i); - if (r != NULL) { + + PUSH_BINDING(fatal_tag_stack, fatal_tag, fatal_tag_valid); + if (setjmp(fatal_tag) == 0) + r = format_tree(tmp[0]->stptr, tmp[0]->stlen, tmp, i); + else { + /* fatal error, restore exit_val of program */ + exit_val = EXIT_SUCCESS; + r = NULL; + } + POP_BINDING(fatal_tag_stack, fatal_tag, fatal_tag_valid); + + if (r != NULL) { (void) fwrite(r->stptr, sizeof(char), r->stlen, out_fp); unref(r); } |