2 * Copyright 1987 by MIT Student Information Processing Board
4 * For copyright info, see mit-sipb-copyright.h.
10 #define ERRCODE_RANGE 8 /* # of bits to shift table number */
11 #define BITS_PER_CHAR 6 /* # bits to shift per character in name */
14 static const char char_set
[] =
15 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
17 /* Prototypes for -Wmissing-prototypes */
18 const char * error_table_name(int num
);
19 const char * error_table_name_r(int num
, char *buf
);
21 const char * error_table_name_r(int num
, char *buf
)
27 /* num = aa aaa abb bbb bcc ccc cdd ddd d?? ??? ??? */
29 num
>>= ERRCODE_RANGE
;
30 /* num = ?? ??? ??? aaa aaa bbb bbb ccc ccc ddd ddd */
32 /* num = 00 000 000 aaa aaa bbb bbb ccc ccc ddd ddd */
33 for (i
= 4; i
>= 0; i
--) {
34 ch
= (num
>> BITS_PER_CHAR
* i
) & ((1 << BITS_PER_CHAR
) - 1);
36 *p
++ = char_set
[ch
-1];
42 const char * error_table_name(int num
)
46 return(error_table_name_r(num
, buf
));