source: trunk/third/moira/util/et/et_name.c @ 24319

Revision 24319, 1018 bytes checked in by broder, 14 years ago (diff)
New Moira snapshot from SVN.
Line 
1/*
2 * Copyright 1987 by MIT Student Information Processing Board
3 *
4 * For copyright info, see mit-sipb-copyright.h.
5 */
6
7#include "error_table.h"
8#include "mit-sipb-copyright.h"
9
10static const char copyright[] =
11    "Copyright 1987,1988 by Student Information Processing Board, Massachusetts Institute of Technology";
12static const char rcsid_et[] = "$Id: et_name.c 3956 2010-01-05 20:56:56Z zacheiss $";
13
14static const char char_set[] =
15        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
16
17static char buf[6];
18
19const char *error_table_name(int num)
20{
21    int ch;
22    int i;
23    char *p;
24
25    /* num = aa aaa abb bbb bcc ccc cdd ddd d?? ??? ??? */
26    p = buf;
27    num >>= ERRCODE_RANGE;
28    /* num = ?? ??? ??? aaa aaa bbb bbb ccc ccc ddd ddd */
29    num &= 077777777;
30    /* num = 00 000 000 aaa aaa bbb bbb ccc ccc ddd ddd */
31    for (i = 4; i >= 0; i--) {
32        ch = (num >> BITS_PER_CHAR * i) & ((1 << BITS_PER_CHAR) - 1);
33        if (ch != 0)
34            *p++ = char_set[ch-1];
35    }
36    *p = '\0';
37    return(buf);
38}
Note: See TracBrowser for help on using the repository browser.