# HG changeset patch # User Rik # Date 1657399391 25200 # Node ID 05a64f60bc1e490fa19f60368d6d43991d8b7b8b # Parent b8d37c022e4033c3312d9fb4bc9c2e863c4aa03f 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. diff -r b8d37c022e40 -r 05a64f60bc1e libinterp/corefcn/file-io.cc --- 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 */) {