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 <stdarg.h> 20 21 typedef long errcode_t; 22 23 struct error_table { 24 char const * const * msgs; 25 long base; 26 int n_msgs; 27 }; 28 struct et_list; 29 30 extern void com_err (const char *, long, const char *, ...) 31 COM_ERR_ATTR((format(printf, 3, 4))); 32 33 extern void com_err_va (const char *whoami, errcode_t code, const char *fmt, 34 va_list args) 35 COM_ERR_ATTR((format(printf, 3, 0))); 36 37 extern char const *error_message (long); 38 extern void (*com_err_hook) (const char *, long, const char *, va_list); 39 extern void (*set_com_err_hook (void (*) (const char *, long, 40 const char *, va_list))) 41 (const char *, long, const char *, va_list); 42 extern void (*reset_com_err_hook (void)) (const char *, long, 43 const char *, va_list); 44 extern int init_error_table(const char * const *msgs, long base, int count); 45 46 extern errcode_t add_error_table(const struct error_table * et); 47 extern errcode_t remove_error_table(const struct error_table * et); 48 extern void add_to_error_table(struct et_list *new_table); 49 50 /* Provided for Heimdall compatibility */ 51 extern const char *com_right(struct et_list *list, long code); 52 extern void initialize_error_table_r(struct et_list **list, 53 const char **messages, 54 int num_errors, 55 long base); 56 extern void free_error_table(struct et_list *et); 57 58 #define __COM_ERR_H 59 #define __COM_ERR_H__ 60 #endif /* !defined(__COM_ERR_H) && !defined(__COM_ERR_H__)*/ 61