From 70a498e0df48c71699797024fcb4c8154599ea5d Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 29 Apr 2011 10:35:31 +0300 Subject: Bug fixes from John and Pat. --- debug.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'debug.c') diff --git a/debug.c b/debug.c index bcb030f7..ee1b311d 100644 --- a/debug.c +++ b/debug.c @@ -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); } -- cgit v1.2.3