diff options
Diffstat (limited to 'src/library.js')
-rw-r--r-- | src/library.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/library.js b/src/library.js index d5e22ade..0e413a08 100644 --- a/src/library.js +++ b/src/library.js @@ -275,7 +275,11 @@ var Library = { IHEAP[_stderr] = this.prepare('<<stderr>>', null, true); } catch(e){} }, + cleanFilename: function(filename) { + return filename.replace('./', ''); + }, prepare: function(filename, data, print_) { + filename = this.cleanFilename(filename); var stream = this.counter++; this.streams[stream] = { filename: filename, @@ -289,6 +293,7 @@ var Library = { return stream; }, open: function(filename) { + filename = this.cleanFilename(filename); var stream = _STDIO.filenames[filename]; if (!stream) { // Not already cached; try to load it right now @@ -489,11 +494,18 @@ var Library = { _free(start); // FIXME: not really correct at all }, - setvbuf: function(stream, buffer, mode, size) { + setbuf: function(stream, buffer) { // just a stub assert(!buffer); }, + setvbuf: 'setbuf', + + access: function(filename) { + filename = Pointer_stringify(filename); + return _STDIO.open(filename) ? 0 : -1; + }, + // stdlib.h malloc: Runtime.staticAlloc, |