summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/l64a.c
diff options
context:
space:
mode:
authormillert <>1997-08-17 22:58:34 +0000
committermillert <>1997-08-17 22:58:34 +0000
commit8a261abefde3eb7c4a3ecb94acbb4b500b8cd1aa (patch)
tree212dd7f0f17b38e109915044266255b50045cbfd /src/lib/libc/stdlib/l64a.c
parentcba49e2afc06b0931ffbc483c4bb576c342c3384 (diff)
downloadopenbsd-8a261abefde3eb7c4a3ecb94acbb4b500b8cd1aa.tar.gz
openbsd-8a261abefde3eb7c4a3ecb94acbb4b500b8cd1aa.tar.bz2
openbsd-8a261abefde3eb7c4a3ecb94acbb4b500b8cd1aa.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 'src/lib/libc/stdlib/l64a.c')
-rw-r--r--src/lib/libc/stdlib/l64a.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/libc/stdlib/l64a.c b/src/lib/libc/stdlib/l64a.c
index 630f9e3365..4e99391254 100644
--- a/src/lib/libc/stdlib/l64a.c
+++ b/src/lib/libc/stdlib/l64a.c
@@ -4,13 +4,14 @@
4 */ 4 */
5 5
6#if defined(LIBC_SCCS) && !defined(lint) 6#if defined(LIBC_SCCS) && !defined(lint)
7static char *rcsid = "$OpenBSD: l64a.c,v 1.2 1996/08/19 08:33:33 tholo Exp $"; 7static char *rcsid = "$OpenBSD: l64a.c,v 1.3 1997/08/17 22:58:34 millert Exp $";
8#endif /* LIBC_SCCS and not lint */ 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(value)
14 long value; 15 long value;
15{ 16{
16 static char buf[8]; 17 static char buf[8];
@@ -18,8 +19,10 @@ l64a (value)
18 int digit; 19 int digit;
19 int i; 20 int i;
20 21
21 if (!value) 22 if (value < 0) {
22 return NULL; 23 errno = EINVAL;
24 return(NULL);
25 }
23 26
24 for (i = 0; value != 0 && i < 6; i++) { 27 for (i = 0; value != 0 && i < 6; i++) {
25 digit = value & 0x3f; 28 digit = value & 0x3f;
@@ -39,5 +42,5 @@ l64a (value)
39 42
40 *s = '\0'; 43 *s = '\0';
41 44
42 return buf; 45 return(buf);
43} 46}