6 * Copyright 1987 by the Student Information Processing Board
7 * of the Massachusetts Institute of Technology
9 * For copyright info, see "mit-sipb-copyright.h".
13 #include "error_table.h"
14 #include "mit-sipb-copyright.h"
17 static const char rcsid
[] =
19 static const char copyright
[] =
20 "Copyright 1986, 1987, 1988 by the Student Information Processing Board\nand the department of Information Systems\nof the Massachusetts Institute of Technology";
22 char *error_table_name_r
__P((int, char *));
24 struct et_list
* _et_list
= (struct et_list
*) NULL
;
26 const char * error_message (code
)
29 static char buf
[COM_ERR_BUF_LEN
];
31 return(error_message_r(code
, buf
));
34 const char * error_message_r (code
, buf
)
44 offset
= code
& ((1<<ERRCODE_RANGE
)-1);
45 table_num
= code
- offset
;
47 return strerror(offset
);
48 for (et
= _et_list
; et
; et
= et
->next
) {
49 if (et
->table
->base
== table_num
) {
50 /* This is the right table */
51 if (et
->table
->n_msgs
<= offset
)
53 return(et
->table
->msgs
[offset
]);
57 strcpy (buf
, "Unknown code ");
59 strcat (buf
, error_table_name_r (table_num
, namebuf
));
62 for (cp
= buf
; *cp
; cp
++)
65 *cp
++ = '0' + offset
/ 100;
69 if (started
|| offset
>= 10) {
70 *cp
++ = '0' + offset
/ 10;