]> andersk Git - moira.git/blob - util/et/et_name.c
Command line printer manipulation client, and build goo.
[moira.git] / util / et / et_name.c
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
10 static const char copyright[] =
11     "Copyright 1987,1988 by Student Information Processing Board, Massachusetts Institute of Technology";
12 static const char rcsid_et[] = "$Id$";
13
14 static const char char_set[] =
15         "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
16
17 static char buf[6];
18
19 const 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 }
This page took 0.041258 seconds and 5 git commands to generate.