Addresses-Sourceforge-Bug: #2963865
Addresses-Debian-Bug: #558910
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
#define COM_ERR_ATTR(x)
#endif
+#include <stddef.h>
#include <stdarg.h>
typedef long errcode_t;
/* Provided for Heimdall compatibility */
extern const char *com_right(struct et_list *list, long code);
+extern const char *com_right_r(struct et_list *list, long code, char *str, size_t len);
extern void initialize_error_table_r(struct et_list **list,
const char **messages,
int num_errors,
return NULL;
}
+const char *
+com_right_r(struct et_list *list, long code, char *str, size_t len)
+{
+ struct et_list *p;
+ for (p = list; p; p = p->next) {
+ if ((code >= p->table->base) &&
+ (code < p->table->base + p->table->n_msgs)) {
+ strncpy(str, p->table->msgs[code - p->table->base], len);
+ str[len-1] = '\0';
+ return str;
+ }
+ }
+ return NULL;
+}
+
struct foobar {
struct et_list etl;
struct error_table tab;