aboutsummaryrefslogtreecommitdiff
path: root/src/library.js
diff options
context:
space:
mode:
authortim.dawborn <tim.dawborn@gmail.com>2011-06-23 13:50:19 +1000
committertim.dawborn <tim.dawborn@gmail.com>2011-06-23 13:50:19 +1000
commit89ecb3e21c105df110a3c62a2d3366864fc5fe3c (patch)
tree787cede07897558a047b8da4295f35ba2d6c1b76 /src/library.js
parent68b06527633437767bbeaeb7cdf6a122db78ef56 (diff)
* propogated return value from main back to the return value from Module.run
* improved the behaviour of ungetc * added optional argument to intArrayFromString to not add the trailing NULL -- useful when adding JS strings as the data in the virtual file system
Diffstat (limited to 'src/library.js')
-rw-r--r--src/library.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/library.js b/src/library.js
index 97f7f61e..4875c7dc 100644
--- a/src/library.js
+++ b/src/library.js
@@ -476,6 +476,11 @@ var Library = {
_IO_getc: 'getc',
ungetc: function(chr, stream) {
+ var f = STDIO.streams[stream];
+ if (!f)
+ return -1; // EOF
+ if (!f.interactiveInput)
+ f.position--;
return chr;
},