util: Tidy header includes
[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
14 #include <roken.h>
15
16 #include "afsutil.h"
17
18 #ifdef AFS_NT40_ENV
19 void
20 afs_NTAbort(void)
21 {
22     DebugBreak();
23 }
24 #endif
25
26 #define TIMESTAMP_BUFFER_SIZE 26  /* including the null */
27 #define TIMESTAMP_NEWLINE_POS 24  /* offset to the newline placed by ctime */
28
29 void
30 AssertionFailed(char *file, int line)
31 {
32     char tdate[TIMESTAMP_BUFFER_SIZE];
33     time_t when;
34
35     time(&when);
36     (void)afs_ctime(&when, tdate, sizeof(tdate));
37     tdate[TIMESTAMP_NEWLINE_POS] = ' ';
38     fprintf(stderr, "%sAssertion failed! file %s, line %d.\n", tdate, file,
39             line);
40     fflush(stderr);
41     afs_abort();
42 }