summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/l64a.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/stdlib/l64a.c')
-rw-r--r--src/lib/libc/stdlib/l64a.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/lib/libc/stdlib/l64a.c b/src/lib/libc/stdlib/l64a.c
index 3069b31bf6..325b41b33b 100644
--- a/src/lib/libc/stdlib/l64a.c
+++ b/src/lib/libc/stdlib/l64a.c
@@ -4,22 +4,24 @@
4 */ 4 */
5 5
6#if defined(LIBC_SCCS) && !defined(lint) 6#if defined(LIBC_SCCS) && !defined(lint)
7static char *rcsid = "$NetBSD: l64a.c,v 1.4 1995/05/11 23:04:52 jtc Exp $"; 7static char *rcsid = "$OpenBSD: l64a.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
8#endif 8#endif /* LIBC_SCCS and not lint */
9 9
10#include <errno.h>
10#include <stdlib.h> 11#include <stdlib.h>
11 12
12char * 13char *
13l64a (value) 14l64a(long value)
14 long value;
15{ 15{
16 static char buf[8]; 16 static char buf[8];
17 char *s = buf; 17 char *s = buf;
18 int digit; 18 int digit;
19 int i; 19 int i;
20 20
21 if (!value) 21 if (value < 0) {
22 return NULL; 22 errno = EINVAL;
23 return(NULL);
24 }
23 25
24 for (i = 0; value != 0 && i < 6; i++) { 26 for (i = 0; value != 0 && i < 6; i++) {
25 digit = value & 0x3f; 27 digit = value & 0x3f;
@@ -39,5 +41,5 @@ l64a (value)
39 41
40 *s = '\0'; 42 *s = '\0';
41 43
42 return buf; 44 return(buf);
43} 45}