From ca19774c913739ef2bea9586a847d8719f19840f Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 1 Mar 2012 23:43:31 -0500 Subject: [PATCH] implement a64l and l64a (legacy xsi stuff) --- src/misc/a64l.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/misc/a64l.c diff --git a/src/misc/a64l.c b/src/misc/a64l.c new file mode 100644 index 00000000..86aeefe0 --- /dev/null +++ b/src/misc/a64l.c @@ -0,0 +1,26 @@ +#include +#include +#include + +static const char digits[] = + "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + +long a64l(const char *s) +{ + int e; + uint32_t x = 0; + for (e=0; e<36 && *s; e+=6, s++) + x |= (strchr(digits, *s)-digits)<>=6) + *p = digits[x&63]; + *p = 0; + return s; +}