reindent-20030715
[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 #ifdef HAVE_STRING_H
18 #include <string.h>
19 #else
20 #ifdef HAVE_STRINGS_H
21 #include <strings.h>
22 #endif
23 #endif
24
25 RCSID
26     ("$Header$");
27
28 #include <stdio.h>
29 #include "afsutil.h"
30
31 #ifdef AFS_NT40_ENV
32 void
33 afs_NTAbort(void)
34 {
35     _asm int 3 h;               /* always trap. */
36 }
37 #endif
38
39
40 void
41 AssertionFailed(char *file, int line)
42 {
43     char tdate[26];
44     time_t when;
45
46     time(&when);
47     afs_ctime(&when, tdate, 25);
48     fprintf(stderr, "%s: Assertion failed! file %s, line %d.\n", tdate, file,
49             line);
50     fflush(stderr);
51 #ifdef AFS_NT40_ENV
52     afs_NTAbort();
53 #else
54     abort();
55 #endif
56 }