/usr/include/libguytools2/toolerror.h is in libguytools2-dev 2.0.1-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | // ****************************************************************************
// Project: libguytools
// ****************************************************************************
// Programmer: Guy Voncken
// Police Grand-Ducale
// Service de Police Judiciaire
// Section Nouvelles Technologies
// ****************************************************************************
// Module: Error handling
// ****************************************************************************
#ifndef __TOOLERROR_H__
#define __TOOLERROR_H__
#ifndef __FFL__
#define __FFL__ (char *) __FILE__, (char *)__FUNCTION__, __LINE__
#endif
// -----------
// Constants
// -----------
#define NO_ERROR 0
// ---------------------------------------
// Macros for comfortable error checking
// ---------------------------------------
#define CHK(Func) \
/*lint -save -e506 -e774*/ /*Warning 506: Constant value Boolean; Info 774: Boolean within 'if' always evaluates to True */ \
{ \
APIRET ec; \
if ((ec = Func) != NO_ERROR) \
{ \
(void)ToolErrorCheck (__FFL__, ec); \
return ec; \
} \
} \
/*lint -restore*/
#define CHK_CONST(ec) \
{ \
(void)ToolErrorCheck (__FFL__, ec); \
return ec; \
} \
#define CHK_RET(Func) \
{ \
APIRET ec; \
if ((ec = Func) != NO_ERROR) \
return ec; \
}
#define CHK_NORET(Func) \
{ \
APIRET ec; \
if ((ec = Func) != NO_ERROR) \
(void)ToolErrorCheck (__FFL__, ec); \
}
#define TOOL_CHK(Fn) \
{ \
APIRET ec; \
if ((ec=Fn) != NO_ERROR) \
return ec; \
}
// ------------------
// Type definitions
// ------------------
typedef long APIRET;
typedef long * pAPIRET;
// -----------------------------
// ToolError's own error codes
// -----------------------------
enum
{
TOOL_ERROR_ENTRY_NOT_FOUND = ERROR_BASE_TOOL_ERROR + 1,
TOOL_ERROR_DUPLICATE_ENTRY ,
TOOL_ERROR_NOT_INITIALISED ,
TOOL_ERROR_ALREADY_INITIALISED
};
// -------------------------------
// Prototypes and wrapper macros
// -------------------------------
typedef void (* t_pToolErrorLogFn)(const char *pFileName, const char *pFunctionName, int LineNr, const char *pFormat, va_list pArguments);
APIRET ToolErrorSetLogFn (t_pToolErrorLogFn pLogFn);
APIRET ToolErrorRegisterError (int ErrorCode, const char *pErrorMsg);
APIRET ToolErrorGetMessage (int ErrorCode, const char **ppMessage);
const char *ToolErrorMessage (int ErrorCode);
const char *ToolErrorTranslateErrno (int Errno);
APIRET ToolErrorInit (int MaxErrors);
APIRET ToolErrorDeInit (void);
APIRET ToolErrorCheck (char const *pFileName, char const *pFunctionName, int LineNr, int ErrorCode);
APIRET ToolErrorLog (char const *pFileName, char const *pFunctionName, int LineNr, const char * pFormat, ...) __attribute__ ((format (printf, 4, 5)));
#define TOOL_ERROR_REGISTER_CODE(ErrorCode) ToolErrorRegisterError(ErrorCode, #ErrorCode)
#endif
|