b144466216a816cee0f307be15067a6d4118c5bc
[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
15 RCSID("$Header$");
16
17 #include <stdio.h>
18
19 #ifdef AFS_NT40_ENV
20 void afs_NTAbort(void)
21 {
22     _asm int 3h; /* always trap. */
23 }
24 #endif
25
26
27 void AssertionFailed(char *file, int line)
28 {
29     char tdate[26];
30     time_t when;
31
32     time(&when);
33     strcpy(tdate, ctime(&when));
34     tdate[24] = '0';
35     fprintf(stderr, "%s: Assertion failed! file %s, line %d.\n",
36         tdate, file, line);
37     fflush(stderr);
38 #ifdef AFS_NT40_ENV
39     afs_NTAbort();
40 #else
41     abort();
42 #endif
43 }
44