freebsd-dev/eBones/compile_et/et_name.c
Geoff Rehmet 60643d379b Initial import of eBones.
(Including all changes for FreeBSD - importing the original eBones distribution
would be too complex at this stage, since I don't have access to Piero's 
CVS.)
(If you want to include eBones in your system, don't forget to include
MAKE_EBONES in /etc/make.conf.)
(This stuff is now also suppable from braae.ru.ac.za.)

Bones originally from MIT SIPB.
Original port to FreeBSD 1.x  by Piero Serini.
Moved to FreeBSD 2.0 by Doug Rabson and Geoff Rehmet.
Nice bug fixes from Doug Rabson.
1994-09-30 14:50:09 +00:00

45 lines
925 B
C

/*
* Copyright 1987 by MIT Student Information Processing Board
* For copyright info, see Copyright.SIPB.
*
* $Id: et_name.c,v 1.2 1994/07/19 19:21:27 g89r4222 Exp $
*/
#include "error_table.h"
static char copyright[] = "Copyright 1987 by MIT Student Information Processing Board";
char *malloc();
char *
error_table_name(num)
int num;
{
register int ch;
register int i;
register char *buf, *p;
/* num = aa aaa abb bbb bcc ccc cdd ddd d?? ??? ??? */
buf = malloc(5);
p = buf;
num >>= ERRCODE_RANGE;
/* num = ?? ??? ??? aaa aaa bbb bbb ccc ccc ddd ddd */
num &= 077777777;
/* num = 00 000 000 aaa aaa bbb bbb ccc ccc ddd ddd */
for (i = 0; i < 5; i++) {
ch = (num >> 24-6*i) & 077;
if (ch == 0)
continue;
else if (ch < 27)
*p++ = ch - 1 + 'A';
else if (ch < 53)
*p++ = ch - 27 + 'a';
else if (ch < 63)
*p++ = ch - 53 + '0';
else /* ch == 63 */
*p++ = '_';
}
return(buf);
}