diff options
author | Michael Riss <Michael.Riss@gmx.de> | 2013-02-11 22:57:40 +0100 |
---|---|---|
committer | Michael Riss <Michael.Riss@gmx.de> | 2013-02-27 16:37:20 +0100 |
commit | 8967ffb2faa23fdaac8179cc3ff379dc984fc09c (patch) | |
tree | 7d198f4c90dfcb72d77f576f69ec0a25dc4413b8 | |
parent | a28b5d53d75b428b1bee1efd39ac6d01d68d56d2 (diff) |
Fixed the following problems in the perror function:
- putc is not declared -> replaced by fputc
- puts was used to output the user message which automatically
introduced an unwanted newline between user message and error
description -> replaced by fputs which does not add the newline
Signed-off-by: Michael Riss <Michael.Riss@gmx.de>
-rw-r--r-- | src/library.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/library.js b/src/library.js index 38399632..83e1b115 100644 --- a/src/library.js +++ b/src/library.js @@ -3363,14 +3363,15 @@ LibraryManager.library = { ___setErrNo(ERRNO_CODES.ECHILD); return -1; }, - perror__deps: ['puts', 'putc', 'strerror', '__errno_location'], + perror__deps: ['puts', 'fputs', 'fputc', 'strerror', '__errno_location'], perror: function(s) { // void perror(const char *s); // http://pubs.opengroup.org/onlinepubs/000095399/functions/perror.html + var stdout = {{{ makeGetValue(makeGlobalUse('_stdout'), '0', 'void*') }}}; if (s) { - _puts(s); - _putc(':'.charCodeAt(0)); - _putc(' '.charCodeAt(0)); + _fputs(s, stdout); + _fputc(':'.charCodeAt(0), stdout); + _fputc(' '.charCodeAt(0), stdout); } var errnum = {{{ makeGetValue('___errno_location()', '0', 'i32') }}}; _puts(_strerror(errnum)); |