summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/l64a.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-08-17 22:58:35 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-08-17 22:58:35 +0000
commit60bc132b385fbae6257c2da60bf75f22933de26d (patch)
tree41396498051c1448ff13ebbdff662e2f88927f51 /lib/libc/stdlib/l64a.c
parent581c9d45f651d2c40755c920da5dc637753a7734 (diff)
Man page for a64l(3) and l64a(3), based on a64l.3 from the MiNT docs 0.1.
Also make a64l(3) and l64a(3) deal reasonably with inapropriate input. The standard does not require this, but it does not disallow it either.
Diffstat (limited to 'lib/libc/stdlib/l64a.c')
-rw-r--r--lib/libc/stdlib/l64a.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/libc/stdlib/l64a.c b/lib/libc/stdlib/l64a.c
index 630f9e33652..4e99391254f 100644
--- a/lib/libc/stdlib/l64a.c
+++ b/lib/libc/stdlib/l64a.c
@@ -4,13 +4,14 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: l64a.c,v 1.2 1996/08/19 08:33:33 tholo Exp $";
+static char *rcsid = "$OpenBSD: l64a.c,v 1.3 1997/08/17 22:58:34 millert Exp $";
#endif /* LIBC_SCCS and not lint */
+#include <errno.h>
#include <stdlib.h>
char *
-l64a (value)
+l64a(value)
long value;
{
static char buf[8];
@@ -18,8 +19,10 @@ l64a (value)
int digit;
int i;
- if (!value)
- return NULL;
+ if (value < 0) {
+ errno = EINVAL;
+ return(NULL);
+ }
for (i = 0; value != 0 && i < 6; i++) {
digit = value & 0x3f;
@@ -39,5 +42,5 @@ l64a (value)
*s = '\0';
- return buf;
+ return(buf);
}