diff options
Diffstat (limited to 'src/lib/libc/stdlib/a64l.c')
-rw-r--r-- | src/lib/libc/stdlib/a64l.c | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/src/lib/libc/stdlib/a64l.c b/src/lib/libc/stdlib/a64l.c deleted file mode 100644 index 5312929c6f..0000000000 --- a/src/lib/libc/stdlib/a64l.c +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | /* $OpenBSD: a64l.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */ | ||
2 | /* | ||
3 | * Written by J.T. Conklin <jtc@netbsd.org>. | ||
4 | * Public domain. | ||
5 | */ | ||
6 | |||
7 | #include <errno.h> | ||
8 | #include <stdlib.h> | ||
9 | |||
10 | long | ||
11 | a64l(const char *s) | ||
12 | { | ||
13 | long value, digit, shift; | ||
14 | int i; | ||
15 | |||
16 | if (s == NULL) { | ||
17 | errno = EINVAL; | ||
18 | return(-1L); | ||
19 | } | ||
20 | |||
21 | value = 0; | ||
22 | shift = 0; | ||
23 | for (i = 0; *s && i < 6; i++, s++) { | ||
24 | if (*s >= '.' && *s <= '/') | ||
25 | digit = *s - '.'; | ||
26 | else if (*s >= '0' && *s <= '9') | ||
27 | digit = *s - '0' + 2; | ||
28 | else if (*s >= 'A' && *s <= 'Z') | ||
29 | digit = *s - 'A' + 12; | ||
30 | else if (*s >= 'a' && *s <= 'z') | ||
31 | digit = *s - 'a' + 38; | ||
32 | else { | ||
33 | errno = EINVAL; | ||
34 | return(-1L); | ||
35 | } | ||
36 | |||
37 | value |= digit << shift; | ||
38 | shift += 6; | ||
39 | } | ||
40 | |||
41 | return(value); | ||
42 | } | ||