From: ceriel Date: Mon, 9 Feb 1987 14:55:59 +0000 (+0000) Subject: Initial revision X-Git-Tag: release-5-5~4711 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=375e023d8b89b64d6e2ef975edaa6a4a079e319e;p=ack.git Initial revision --- diff --git a/modules/src/assert/BadAssert.c b/modules/src/assert/BadAssert.c new file mode 100644 index 000000000..aa0995009 --- /dev/null +++ b/modules/src/assert/BadAssert.c @@ -0,0 +1,34 @@ +/* _BadAssertion: used for debugging purposes. It should give an error message + indicated by the parameters, and then give a core dump +*/ + +#include + +static +wr_num(fd, n) + File *fd; + int n; +{ + char s[2]; + + s[1] = '\0'; + if (n >= 10) { + wr_num(fd, n/10); + } + s[0] = (n % 10) + '0'; + (void) sys_write(fd, s, 1); +} + +_BadAssertion(file, lineno, assertion) + char *file, *assertion; + int lineno; +{ + + (void) sys_write(STDERR, file, strlen(file)); + (void) sys_write(STDERR, ", line ", 7); + wr_num(STDERR, lineno); + (void) sys_write(STDERR, ": assertion \"", 13); + (void) sys_write(STDERR, assertion, strlen(assertion)); + (void) sys_write(STDERR, "\" failed\n", 9); + sys_stop(S_ABORT); +}