diff options
Diffstat (limited to 'src/lib/libc/stdlib/l64a.c')
-rw-r--r-- | src/lib/libc/stdlib/l64a.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/lib/libc/stdlib/l64a.c b/src/lib/libc/stdlib/l64a.c index 3069b31bf6..4f33df37b2 100644 --- a/src/lib/libc/stdlib/l64a.c +++ b/src/lib/libc/stdlib/l64a.c | |||
@@ -1,25 +1,24 @@ | |||
1 | /* $OpenBSD: l64a.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Written by J.T. Conklin <jtc@netbsd.org>. | 3 | * Written by J.T. Conklin <jtc@netbsd.org>. |
3 | * Public domain. | 4 | * Public domain. |
4 | */ | 5 | */ |
5 | 6 | ||
6 | #if defined(LIBC_SCCS) && !defined(lint) | 7 | #include <errno.h> |
7 | static char *rcsid = "$NetBSD: l64a.c,v 1.4 1995/05/11 23:04:52 jtc Exp $"; | ||
8 | #endif | ||
9 | |||
10 | #include <stdlib.h> | 8 | #include <stdlib.h> |
11 | 9 | ||
12 | char * | 10 | char * |
13 | l64a (value) | 11 | l64a(long value) |
14 | long value; | ||
15 | { | 12 | { |
16 | static char buf[8]; | 13 | static char buf[8]; |
17 | char *s = buf; | 14 | char *s = buf; |
18 | int digit; | 15 | int digit; |
19 | int i; | 16 | int i; |
20 | 17 | ||
21 | if (!value) | 18 | if (value < 0) { |
22 | return NULL; | 19 | errno = EINVAL; |
20 | return(NULL); | ||
21 | } | ||
23 | 22 | ||
24 | for (i = 0; value != 0 && i < 6; i++) { | 23 | for (i = 0; value != 0 && i < 6; i++) { |
25 | digit = value & 0x3f; | 24 | digit = value & 0x3f; |
@@ -39,5 +38,5 @@ l64a (value) | |||
39 | 38 | ||
40 | *s = '\0'; | 39 | *s = '\0'; |
41 | 40 | ||
42 | return buf; | 41 | return(buf); |
43 | } | 42 | } |