blob: b39a37627edce2f3b8f2fa1b3d5ad2f8a9ca5c4b [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001
2#include "headers.h"
3#include "util.h"
4
5/* -------------------------------------------------------------------
6 * warn
7 *
8 * Prints message and return
9 * ------------------------------------------------------------------- */
10
11void warn(const char *inMessage, const char *inFile, int inLine)
12{
13 fflush(0);
14
15//#ifdef NDEBUG
16// fprintf( stderr, "%s failed\n", inMessage );
17//#else
18
19 /* while debugging output file/line number also */
20 fprintf(stderr, "%s failed (%s:%d)\n", inMessage, inFile, inLine);
21//#endif
22} /* end warn */
23
24/* -------------------------------------------------------------------
25 * warn_errno
26 *
27 * Prints message and errno message, and return.
28 * ------------------------------------------------------------------- */
29
30void warn_errno(const char *inMessage, const char *inFile, int inLine)
31{
32 int my_err;
33 const char* my_str;
34
35 /* get platform's errno and error message */
36 my_err = errno;
37 my_str = strerror(my_err);
38
39 fflush(0);
40
41//#ifdef NDEBUG
42// fprintf( stderr, "%s failed: %s\n", inMessage, my_str );
43//#else
44
45 /* while debugging output file/line number and errno value also */
46 fprintf(stderr, "%s failed (%s:%d): %s (%d)\n",
47 inMessage, inFile, inLine, my_str, my_err);
48//#endif
49} /* end warn_errno */