xref: /netbsd-src/external/bsd/openldap/dist/libraries/liblber/assert.c (revision b1c86f5f087524e68db12794ee9c3e3da1ab17a0)
1 /*	$NetBSD: assert.c,v 1.1.1.2 2010/03/08 02:14:20 lukem Exp $	*/
2 
3 /* OpenLDAP: pkg/ldap/libraries/liblber/assert.c,v 1.13.2.4 2009/01/22 00:00:53 kurt Exp */
4 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5  *
6  * Copyright 1998-2009 The OpenLDAP Foundation.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted only as authorized by the OpenLDAP
11  * Public License.
12  *
13  * A copy of this license is available in the file LICENSE in the
14  * top-level directory of the distribution or, alternatively, at
15  * <http://www.OpenLDAP.org/license.html>.
16  */
17 
18 #include "portable.h"
19 
20 #ifdef LDAP_NEED_ASSERT
21 
22 #include <stdio.h>
23 
24 /*
25  * helper for our private assert() macro
26  *
27  * note: if assert() doesn't exist, like abort() or raise() won't either.
28  * could use kill() but that might be problematic.  I'll just ignore this
29  * issue for now.
30  */
31 
32 void
33 ber_pvt_assert( const char *file, int line, const char *test )
34 {
35 	fprintf(stderr,
36 		_("Assertion failed: %s, file %s, line %d\n"),
37 			test, file, line);
38 
39 	abort();
40 }
41 
42 #endif
43