Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added std streams

  • Loading branch information...
commit 0e9f3f5c520720b3ebfe311ed22ffcb02bf6aa51 1 parent d001a59
Edwin Brady authored
Showing with 18 additions and 2 deletions.
  1. +1 −1  epic.cabal
  2. +13 −1 evm/stdfuns.c
  3. +4 −0 evm/stdfuns.h
View
2  epic.cabal
@@ -1,5 +1,5 @@
Name: epic
-Version: 0.9.3.1
+Version: 0.9.3.2
Author: Edwin Brady
License: BSD3
License-file: LICENSE
View
14 evm/stdfuns.c
@@ -41,6 +41,18 @@ int readInt() {
return atoi(readStr());
}
+FILE* get_stdin() {
+ return stdin;
+}
+
+FILE* get_stdout() {
+ return stdout;
+}
+
+FILE* get_stderr() {
+ return stderr;
+}
+
// FIXME: Do this properly!
char* readStr() {
char *buf = NULL;
@@ -102,7 +114,7 @@ int strToInt(char* str)
if (str == NULL) return 0;
int v = strtol(str,&end,10);
- if (*end != '\0') return 0; else return v;
+ if (*end != '\0' && *end != '\n' && *end != '\r') return 0; else return v;
}
char* intToStr(int x)
View
4 evm/stdfuns.h
@@ -25,6 +25,10 @@ void epicMemInfo();
// Force garbage collection
void epicGC();
+FILE* get_stdin();
+FILE* get_stdout();
+FILE* get_stderr();
+
int readInt();
char* readStr();
int streq(char* x, char* y);
Please sign in to comment.
Something went wrong with that request. Please try again.