util-cleanup-20071031
[openafs.git] / src / util / assert.c
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 /* ReallyAbort:  called from assert. May/85 */
11 #include <afsconfig.h>
12 #include <afs/param.h>
13 #include <stdlib.h>
14 #ifdef HAVE_SYS_TIME_H
15 #include <sys/time.h>
16 #endif
17 #include <string.h>
18
19 RCSID
20     ("$Header$");
21
22 #include <stdio.h>
23 #include "afsutil.h"
24
25 #ifdef AFS_NT40_ENV
26 void
27 afs_NTAbort(void)
28 {
29     DebugBreak();
30 }
31 #endif
32
33
34 void
35 AssertionFailed(char *file, int line)
36 {
37     char tdate[26];
38     time_t when;
39
40     time(&when);
41     (void)afs_ctime(&when, tdate, 25);
42     fprintf(stderr, "%s: Assertion failed! file %s, line %d.\n", tdate, file,
43             line);
44     fflush(stderr);
45 #ifdef AFS_NT40_ENV
46     afs_NTAbort();
47 #else
48     abort();
49 #endif
50 }