1/* 2 * Header file for common error description library. 3 * 4 * Copyright 1988, Student Information Processing Board of the 5 * Massachusetts Institute of Technology. 6 * 7 * For copyright and distribution info, see the documentation supplied 8 * with this package. 9 */ 10 11#if !defined(__COM_ERR_H) && !defined(__COM_ERR_H__) 12 13#ifdef __GNUC__ 14#define COM_ERR_ATTR(x) __attribute__(x) 15#else 16#define COM_ERR_ATTR(x) 17#endif 18 19#include <stddef.h> 20#include <stdarg.h> 21 22typedef long errcode_t; 23 24struct error_table { 25 char const * const * msgs; 26 long base; 27 int n_msgs; 28}; 29struct et_list; 30 31extern void com_err (const char *, long, const char *, ...) 32 COM_ERR_ATTR((format(printf, 3, 4))); 33 34extern void com_err_va (const char *whoami, errcode_t code, const char *fmt, 35 va_list args) 36 COM_ERR_ATTR((format(printf, 3, 0))); 37 38extern char const *error_message (long); 39extern void (*com_err_hook) (const char *, long, const char *, va_list); 40extern void (*set_com_err_hook (void (*) (const char *, long, 41 const char *, va_list))) 42 (const char *, long, const char *, va_list); 43extern void (*reset_com_err_hook (void)) (const char *, long, 44 const char *, va_list); 45extern int init_error_table(const char * const *msgs, long base, int count); 46 47extern errcode_t add_error_table(const struct error_table * et); 48extern errcode_t remove_error_table(const struct error_table * et); 49extern void add_to_error_table(struct et_list *new_table); 50 51/* Provided for Heimdall compatibility */ 52extern const char *com_right(struct et_list *list, long code); 53extern const char *com_right_r(struct et_list *list, long code, char *str, size_t len); 54extern void initialize_error_table_r(struct et_list **list, 55 const char **messages, 56 int num_errors, 57 long base); 58extern void free_error_table(struct et_list *et); 59 60/* Provided for compatibility with other com_err libraries */ 61extern int et_list_lock(void); 62extern int et_list_unlock(void); 63 64#define __COM_ERR_H 65#define __COM_ERR_H__ 66#endif /* !defined(__COM_ERR_H) && !defined(__COM_ERR_H__)*/ 67