aboutsummaryrefslogtreecommitdiffstats
path: root/src/stdlib.c
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2018-02-12 11:23:59 -0500
committerClyne Sullivan <tullivan99@gmail.com>2018-02-12 11:23:59 -0500
commit100cb2f84ac5c44a904f7d7145cdc2ce1dcf59ba (patch)
tree73079f311b8ff81069bfd615eed0b55c52a5e4b6 /src/stdlib.c
parent025ed8530ce92d4a2282af8bba1b9e3e93afbb99 (diff)
libinterp, actually works
Diffstat (limited to 'src/stdlib.c')
-rw-r--r--src/stdlib.c38
1 files changed, 0 insertions, 38 deletions
diff --git a/src/stdlib.c b/src/stdlib.c
index 1832033..3f11d57 100644
--- a/src/stdlib.c
+++ b/src/stdlib.c
@@ -1,44 +1,6 @@
-#include <stdarg.h>
-#include <stdint.h>
-#include <string.h>
-
-#include <heap.h>
-
-extern char *itoa(int, char *, int);
-
void _exit(int code)
{
(void)code;
for (;;);
}
-int ksnprintf(char *buf, unsigned int count, const char *format, ...)
-{
- (void)count;
-
- va_list args;
- va_start(args, format);
-
- unsigned int i = 0, o = 0;
- while (o < count && format[i] != '\0') {
- if (format[i] == '%') {
- if (format[i + 1] == 'd') {
- char *s = itoa(va_arg(args, int), malloc(16), 10);
- strncpy(buf + o, s, count - o);
- o += strlen(s);
- free(s);
- } else if (format[i + 1] == 'f') {
- strncpy(buf + o, "float", count - o);
- o += 5;
- }
- i++;
- } else {
- buf[o++] = format[i];
- }
-
- i++;
- }
-
- return o;
-}
-