Mercurial > octave
changeset 31135:05a64f60bc1e
Return -1 rather than platform-dependent EOF from puts, fputs (bug #62725)
* file-io.cc (puts_internal): Modify return logic to return -1 on failure, 0 on
success.
* file-io.cc (Fputs, Ffputs): Document return value as -1 or 0.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 09 Jul 2022 13:43:11 -0700 |
parents | b8d37c022e40 |
children | cbfe8318566a |
files | libinterp/corefcn/file-io.cc |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/file-io.cc Sat Jul 09 11:46:06 2022 -0700 +++ b/libinterp/corefcn/file-io.cc Sat Jul 09 13:43:11 2022 -0700 @@ -886,7 +886,7 @@ stream os = streams.lookup (args(0), who); - return ovl (os.puts (args(1), who)); + return ovl (- (os.puts (args(1), who) < 0)); } DEFMETHOD (fputs, interp, args, , @@ -898,7 +898,8 @@ @code{fdisp} instead to automatically append a newline character appropriate for the local machine. -Return a non-negative number on success or EOF on error. +The optional output @var{status} is 0 for success, or -1 if an error was +encountered. @seealso{fdisp, fprintf, fwrite, fopen} @end deftypefn */) { @@ -943,7 +944,8 @@ The string is written verbatim to the standard output. Use @code{disp} to automatically append a newline character appropriate for the local machine. -Return a non-negative number on success and EOF on error. +The optional output @var{status} is 0 for success, or -1 if an error was +encountered. @seealso{fputs, disp} @end deftypefn */) {