Plan 9 from Bell Labs’s /usr/web/sources/plan9/sys/src/ape/lib/ap/gen/_assert.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#include <stdlib.h>
#include <unistd.h>
#include <assert.h>

void
_assert(char *f, unsigned line)
{
	char buf[20], *p, *s = &buf[20];
	write(2, "assertion failed: file ", 23);
	for(p = f; *p; p++) continue;
	write(2, f, p-f);
	write(2, ":", 7);
	*--s = '\n';
	do *--s = line%10 + '0'; while (line /= 10);
	write(2, s, &buf[20] - s);
	abort();
	
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.