summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/l64a.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1997-08-17 22:58:33 +0000
committermillert <millert@openbsd.org>1997-08-17 22:58:33 +0000
commita8eb249e6b6cfe7f1e9c62e091bd36f05cdaaeba (patch)
tree0d6263eef264d2a564f2863caec4e8e6e4c6504f /lib/libc/stdlib/l64a.c
parentAdd quirk for MATSHITA CR-574, from Berndt Josef Wulf <wulf@ping.net.au> (diff)
downloadwireguard-openbsd-a8eb249e6b6cfe7f1e9c62e091bd36f05cdaaeba.tar.xz
wireguard-openbsd-a8eb249e6b6cfe7f1e9c62e091bd36f05cdaaeba.zip
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);
}