1993-10-22 20:26:43 +03:00
|
|
|
/*
|
1995-05-12 03:03:44 +04:00
|
|
|
* Written by J.T. Conklin <jtc@netbsd.org>.
|
|
|
|
* Public domain.
|
1993-10-22 20:26:43 +03:00
|
|
|
*/
|
|
|
|
|
1997-07-14 00:16:31 +04:00
|
|
|
#include <sys/cdefs.h>
|
1993-10-22 20:26:43 +03:00
|
|
|
#if defined(LIBC_SCCS) && !defined(lint)
|
1997-07-14 00:16:31 +04:00
|
|
|
__RCSID("$NetBSD: l64a.c,v 1.5 1997/07/13 20:16:44 christos Exp $");
|
1993-10-22 20:26:43 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
char *
|
|
|
|
l64a (value)
|
|
|
|
long value;
|
|
|
|
{
|
|
|
|
static char buf[8];
|
|
|
|
char *s = buf;
|
|
|
|
int digit;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!value)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
for (i = 0; value != 0 && i < 6; i++) {
|
|
|
|
digit = value & 0x3f;
|
|
|
|
|
|
|
|
if (digit < 2)
|
|
|
|
*s = digit + '.';
|
|
|
|
else if (digit < 12)
|
|
|
|
*s = digit + '0' - 2;
|
|
|
|
else if (digit < 38)
|
|
|
|
*s = digit + 'A' - 12;
|
|
|
|
else
|
|
|
|
*s = digit + 'a' - 38;
|
|
|
|
|
|
|
|
value >>= 6;
|
|
|
|
s++;
|
|
|
|
}
|
|
|
|
|
|
|
|
*s = '\0';
|
|
|
|
|
|
|
|
return buf;
|
|
|
|
}
|