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

Revision 23740, 1018 bytes checked in by broder, 15 years ago (diff)
In moira: * New CVS snapshot (Trac: #195) * Drop patches that have been incorporated upstream. * Update to build without krb4 on systems that no longer have it. This doesn't build yet on squeeze, which lacks a krb4 library, but I'm committing now before I start hacking away at a patch to fix that.
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,v 1.2 1998-02-05 22:13:10 danw Exp $";
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.