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