Make the output from assert() look more like the example in the C99

standard.

Requested by:	bde
This commit is contained in:
Mike Barcroft 2001-10-29 07:07:25 +00:00
parent b5f7b8be86
commit 762e881bab
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=85671
2 changed files with 6 additions and 6 deletions

View File

@ -52,11 +52,11 @@ __assert(func, file, line, failedexpr)
{
if (func == NULL)
(void)fprintf(stderr,
"assertion (%s) failed: file %s:%d\n", failedexpr,
"Assertion failed: (%s), file %s, line %d.\n", failedexpr,
file, line);
else
(void)fprintf(stderr,
"assertion (%s) failed: function %s(), file %s:%d\n",
"Assertion failed: (%s), function %s, file %s, line %d.\n",
failedexpr, func, file, line);
abort();
/* NOTREACHED */

View File

@ -35,10 +35,10 @@ void
__assert(const char *func, const char *file, int line, const char *expression)
{
if (func == NULL)
printf("assertion (%s) failed: file %s:%d\n", expression,
file, line);
printf("Assertion failed: (%s), file %s, line %d.\n",
expression, file, line);
else
printf("assertion (%s) failed: function %s(), file %s:%d\n",
expression, func, file, line);
printf("Assertion failed: (%s), function %s, file %s, line "
"%d.\n", expression, func, file, line);
exit();
}