aboutsummaryrefslogtreecommitdiffstats
path: root/debug.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2011-04-29 10:35:31 +0300
committerArnold D. Robbins <arnold@skeeve.com>2011-04-29 10:35:31 +0300
commit70a498e0df48c71699797024fcb4c8154599ea5d (patch)
tree544ce76df279e47303dd1deb532986b655bd2853 /debug.c
parent04746bc5c0301fac55badc956225f486607dffd9 (diff)
downloadegawk-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.c22
1 files changed, 14 insertions, 8 deletions
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);
}