Wed, 01 Oct 2003 07:15:53 +0000
[gaim-migrate @ 7673]
Put the rest of util.[ch] into namespaces and sectioned off the functions.
| 2086 | 1 | /* |
| 2 | * Copyright 1987 by MIT Student Information Processing Board | |
| 3 | * | |
| 4 | * For copyright info, see mit-sipb-copyright.h. | |
| 5 | */ | |
| 6 | ||
| 7 | #include <sysdep.h> | |
| 8 | #include "error_table.h" | |
| 9 | #include "mit-sipb-copyright.h" | |
| 10 | ||
| 11 | #ifndef lint | |
| 12 | static const char copyright[] = | |
| 13 | "Copyright 1987,1988 by Student Information Processing Board, Massachusetts Institute of Technology"; | |
| 14 | static const char rcsid_et_name_c[] = | |
| 15 | "$Header$"; | |
| 16 | #endif | |
| 17 | ||
| 18 | static const char char_set[] = | |
| 19 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"; | |
| 20 | ||
| 21 | const char * error_table_name_r(num, buf) | |
| 22 | int num; | |
| 23 | char *buf; | |
| 24 | { | |
| 25 | int ch; | |
| 26 | int i; | |
| 27 | char *p; | |
| 28 | ||
| 29 | /* num = aa aaa abb bbb bcc ccc cdd ddd d?? ??? ??? */ | |
| 30 | p = buf; | |
| 31 | num >>= ERRCODE_RANGE; | |
| 32 | /* num = ?? ??? ??? aaa aaa bbb bbb ccc ccc ddd ddd */ | |
| 33 | num &= 077777777; | |
| 34 | /* num = 00 000 000 aaa aaa bbb bbb ccc ccc ddd ddd */ | |
| 35 | for (i = 4; i >= 0; i--) { | |
| 36 | ch = (num >> BITS_PER_CHAR * i) & ((1 << BITS_PER_CHAR) - 1); | |
| 37 | if (ch != 0) | |
| 38 | *p++ = char_set[ch-1]; | |
| 39 | } | |
| 40 | *p = '\0'; | |
| 41 | return(buf); | |
| 42 | } | |
| 43 | ||
| 44 | const char * error_table_name(num) | |
| 45 | int num; | |
| 46 | { | |
| 47 | static char buf[6]; | |
| 48 | ||
| 49 | return(error_table_name_r(num, buf)); | |
| 50 | } | |
| 51 |