From e5353c0f447a8628985722296f57fc02dd2e0063 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 11 May 2012 15:05:35 +0300 Subject: Move to use of bool type, true, false, everywhere. --- msg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'msg.c') diff --git a/msg.c b/msg.c index 78818187..c579b628 100644 --- a/msg.c +++ b/msg.c @@ -33,7 +33,7 @@ static const char *srcfile = NULL; static int srcline; jmp_buf fatal_tag; -int fatal_tag_valid = FALSE; +bool fatal_tag_valid = false; /* err --- print an error message with source line and file and record */ -- cgit v1.2.3 From 21a01e3ad4e2e77dccf73e8fd069370749880757 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Wed, 6 Jun 2012 22:14:32 +0300 Subject: Hook in extension at_exit functions. --- msg.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'msg.c') diff --git a/msg.c b/msg.c index c579b628..22cf5562 100644 --- a/msg.c +++ b/msg.c @@ -158,5 +158,9 @@ gawk_exit(int status) exit_val = status; longjmp(fatal_tag, 1); } + + /* run any extension exit handlers */ + run_ext_exit_handlers(status); + exit(status); } -- cgit v1.2.3 From 8ce87087172ee5be4ee72a1513daad3821185bf7 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 12 Jun 2012 23:11:37 +0300 Subject: More API implementations and testext improvements. --- msg.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'msg.c') diff --git a/msg.c b/msg.c index 22cf5562..b94e840b 100644 --- a/msg.c +++ b/msg.c @@ -159,6 +159,14 @@ gawk_exit(int status) longjmp(fatal_tag, 1); } + final_exit(status); +} + +/* final_exit --- run extension exit handlers and exit */ + +void +final_exit(int status) +{ /* run any extension exit handlers */ run_ext_exit_handlers(status); -- cgit v1.2.3 From 3a40be8a79f9d4e4bb205cca4eb15b1ee811f60c Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 19 Jun 2012 20:42:51 +0300 Subject: Fix code duplication in gawkapi.c from msg.c. --- msg.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'msg.c') diff --git a/msg.c b/msg.c index b94e840b..bc446a14 100644 --- a/msg.c +++ b/msg.c @@ -39,7 +39,7 @@ bool fatal_tag_valid = false; /* VARARGS2 */ void -err(const char *s, const char *emsg, va_list argp) +err(bool isfatal, const char *s, const char *emsg, va_list argp) { char *file; const char *me; @@ -89,6 +89,13 @@ err(const char *s, const char *emsg, va_list argp) vfprintf(stderr, emsg, argp); (void) fprintf(stderr, "\n"); (void) fflush(stderr); + + if (isfatal) { +#ifdef GAWKDEBUG + abort(); +#endif + gawk_exit(EXIT_FATAL); + } } /* msg --- take a varargs error message and print it */ @@ -98,7 +105,7 @@ msg(const char *mesg, ...) { va_list args; va_start(args, mesg); - err("", mesg, args); + err(false, "", mesg, args); va_end(args); } @@ -109,7 +116,7 @@ warning(const char *mesg, ...) { va_list args; va_start(args, mesg); - err(_("warning: "), mesg, args); + err(false, _("warning: "), mesg, args); va_end(args); } @@ -118,7 +125,7 @@ error(const char *mesg, ...) { va_list args; va_start(args, mesg); - err(_("error: "), mesg, args); + err(false, _("error: "), mesg, args); va_end(args); } @@ -141,12 +148,8 @@ r_fatal(const char *mesg, ...) { va_list args; va_start(args, mesg); - err(_("fatal: "), mesg, args); + err(true, _("fatal: "), mesg, args); va_end(args); -#ifdef GAWKDEBUG - abort(); -#endif - gawk_exit(EXIT_FATAL); } /* gawk_exit --- longjmp out if necessary */ -- cgit v1.2.3