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

standard.

Requested by:	bde
This commit is contained in:
mike 2001-10-29 07:07:25 +00:00
parent 73a8314696
commit a535f37a5c
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();
}