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 22 typedef long errcode_t; 23 24 struct error_table { 25 char const * const * msgs; 26 long base; 27 int n_msgs; 28 }; 29 struct et_list; 30 31 extern void com_err (const char *, long, const char *, ...) 32 COM_ERR_ATTR((format(printf, 3, 4))); 33 34 extern 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 38 extern char const *error_message (long); 39 extern void (*com_err_hook) (const char *, long, const char *, va_list); 40 extern void (*set_com_err_hook (void (*) (const char *, long, 41 const char *, va_list))) 42 (const char *, long, const char *, va_list); 43 extern void (*reset_com_err_hook (void)) (const char *, long, 44 const char *, va_list); 45 extern int init_error_table(const char * const *msgs, long base, int count); 46 extern char *(*set_com_err_gettext (char *(*) (const char *))) 47 (const char *); 48 49 extern errcode_t add_error_table(const struct error_table * et); 50 extern errcode_t remove_error_table(const struct error_table * et); 51 extern void add_to_error_table(struct et_list *new_table); 52 53 /* Provided for Heimdall compatibility */ 54 extern const char *com_right(struct et_list *list, long code); 55 extern const char *com_right_r(struct et_list *list, long code, char *str, size_t len); 56 extern void initialize_error_table_r(struct et_list **list, 57 const char **messages, 58 int num_errors, 59 long base); 60 extern void free_error_table(struct et_list *et); 61 62 /* Provided for compatibility with other com_err libraries */ 63 extern int et_list_lock(void); 64 extern int et_list_unlock(void); 65 66 #define __COM_ERR_H 67 #define __COM_ERR_H__ 68 #endif /* !defined(__COM_ERR_H) && !defined(__COM_ERR_H__)*/ 69