changeset 21633:dcf8922b724b

Deprecate printf, puts, and scanf. Make fputs a M-file. * libinterp/corefcn/file-io.cc: extracted printf, puts, and scanf to M-files. * scripts/deprecated/printf.m: new function, equivalent to version file-io.cc. * scripts/deprecated/puts.m: new function, equivalent to version file-io.cc. * scripts/deprecated/scanf.m: new function, equivalent to version file-io.cc. * scripts/deprecated/module.mk: added printf, puts, and scanf. * scripts/io/fputs.m: new function, equivalent to version file-io.cc. * scripts/io/module.mk: added fputs. * doc/interpreter/io.txi: adapted documentation to current implementation. * NEWS: announced changes. * doc/interpreter/basics.txi: replaced printf by fprintf. * doc/interpreter/stmt.txi: replaced printf by fprintf. * doc/interpreter/var.txi: replaced printf by fprintf. * doc/refcard/refcard.tex: removed printf and scanf. * examples/code/@FIRfilter/display.m: replaced printf by fprintf. * examples/code/@polynomial/display.m: replaced printf by fprintf. * scripts/@ftp/display.m: replaced printf by fprintf. * scripts/general/inputParser.m: replaced printf by fprintf. * scripts/general/methods.m: replaced printf by fprintf. * scripts/general/profexplore.m: replaced printf by fprintf. * scripts/general/profshow.m: replaced printf by fprintf. * scripts/help/help.m: replaced puts by fputs and printf by fprintf. * scripts/help/lookfor.m: replaced puts by fputs and printf by fprintf. * scripts/help/which.m: replaced printf by fprintf. * scripts/image/imformats.m: replaced printf by fprintf. * scripts/io/beep.m: replaced puts by fputs. * scripts/io/textread.m: replaced printf by fprintf. * scripts/java/javaclasspath.m: replaced printf by fprintf. * scripts/java/javamem.m: replaced printf by fprintf. * scripts/miscellaneous/dir.m: replaced printf by fprintf. * scripts/miscellaneous/dos.m: replaced printf by fprintf. * scripts/miscellaneous/fact.m: replaced printf by fprintf. * scripts/miscellaneous/info.m: replaced printf by fprintf. * scripts/miscellaneous/license.m: replaced printf by fprintf. * scripts/miscellaneous/ls.m: replaced puts by fputs. * scripts/miscellaneous/menu.m: replaced printf by fprintf. * scripts/miscellaneous/mkoctfile.m: replaced printf by fprintf. * scripts/miscellaneous/private/display_info_file.m: * scripts/miscellaneous/unix.m: replaced printf by fprintf. * scripts/miscellaneous/ver.m: replaced printf by fprintf. * scripts/miscellaneous/what.m: replaced printf by fprintf. * scripts/ode/ode23.m: replaced printf by fprintf. * scripts/ode/ode45.m: replaced printf by fprintf. * scripts/optimization/fminbnd.m: replaced printf by fprintf. * scripts/optimization/optimset.m: replaced puts by fputs and printf by fprintf. * scripts/optimization/sqp.m: replaced printf by fprintf. * scripts/pkg/pkg.m: replaced printf by fprintf. * scripts/pkg/private/describe.m: replaced printf by fprintf. * scripts/pkg/private/install.m: replaced printf by fprintf. * scripts/pkg/private/installed_packages.m: replaced printf by fprintf. * scripts/pkg/private/list_forge_packages.m: replaced puts by fputs and printf by fprintf. * scripts/pkg/private/rebuild.m: replaced printf by fprintf. * scripts/plot/util/__gnuplot_drawnow__.m: replaced puts by fputs and printf by fprintf. * scripts/signal/stft.m: replaced printf by fprintf. * scripts/sparse/bicg.m: replaced printf by fprintf. * scripts/sparse/bicgstab.m: replaced printf by fprintf. * scripts/sparse/cgs.m: replaced printf by fprintf. * scripts/sparse/pcg.m: replaced printf by fprintf. * scripts/sparse/pcr.m: replaced printf by fprintf. * scripts/sparse/qmr.m: replaced printf by fprintf. * scripts/statistics/models/logistic_regression.m: replaced printf by fprintf. * scripts/statistics/tests/anova.m: replaced printf by fprintf. * scripts/statistics/tests/bartlett_test.m: replaced printf by fprintf. * scripts/statistics/tests/chisquare_test_homogeneity.m: replaced printf by fprintf. * scripts/statistics/tests/chisquare_test_independence.m: replaced printf by fprintf. * scripts/statistics/tests/cor_test.m: replaced printf by fprintf. * scripts/statistics/tests/f_test_regression.m: replaced printf by fprintf. * scripts/statistics/tests/hotelling_test.m: replaced printf by fprintf. * scripts/statistics/tests/hotelling_test_2.m: replaced printf by fprintf. * scripts/statistics/tests/kolmogorov_smirnov_test.m: replaced printf by fprintf. * scripts/statistics/tests/kolmogorov_smirnov_test_2.m: replaced printf by fprintf. * scripts/statistics/tests/kruskal_wallis_test.m: replaced printf by fprintf. * scripts/statistics/tests/manova.m: replaced printf by fprintf. * scripts/statistics/tests/mcnemar_test.m: replaced printf by fprintf. * scripts/statistics/tests/prop_test_2.m: replaced printf by fprintf. * scripts/statistics/tests/run_test.m: replaced printf by fprintf. * scripts/statistics/tests/sign_test.m: replaced printf by fprintf. * scripts/statistics/tests/t_test.m: replaced printf by fprintf. * scripts/statistics/tests/t_test_2.m: replaced printf by fprintf. * scripts/statistics/tests/t_test_regression.m: replaced printf by fprintf. * scripts/statistics/tests/u_test.m: replaced printf by fprintf. * scripts/statistics/tests/var_test.m: replaced printf by fprintf. * scripts/statistics/tests/welch_test.m: replaced printf by fprintf. * scripts/statistics/tests/wilcoxon_test.m: replaced printf by fprintf. * scripts/statistics/tests/z_test.m: replaced printf by fprintf. * scripts/statistics/tests/z_test_2.m: replaced printf by fprintf. * scripts/strings/strtok.m: replaced printf by fprintf. * scripts/testfun/__run_test_suite__.m: replaced puts by fputs and printf by fprintf. * scripts/testfun/demo.m: replaced printf by fprintf. * scripts/testfun/example.m: replaced printf by fprintf. * scripts/testfun/private/compare_plot_demos.m: replaced printf by fprintf. * scripts/testfun/rundemos.m: replaced printf by fprintf. * scripts/testfun/runtests.m: replaced puts by fputs and printf by fprintf. * scripts/testfun/speed.m: replaced printf by fprintf. * scripts/testfun/test.m: replaced printf by fprintf. * scripts/time/calendar.m: replaced puts by fputs and printf by fprintf. * test/io.tst: replaced printf by fprintf.
author Kai T. Ohlhus <k.ohlhus@gmail.com>
date Wed, 20 Apr 2016 17:53:10 +0200
parents e3c44a120a8c
children 96518f623c91
files NEWS doc/interpreter/basics.txi doc/interpreter/func.txi doc/interpreter/io.txi doc/interpreter/stmt.txi doc/interpreter/var.txi doc/refcard/refcard.tex examples/code/@FIRfilter/display.m examples/code/@polynomial/display.m libinterp/corefcn/file-io.cc libinterp/dldfcn/__init_gnuplot__.cc scripts/@ftp/display.m scripts/deprecated/module.mk scripts/deprecated/printf.m scripts/deprecated/puts.m scripts/deprecated/scanf.m scripts/general/inputParser.m scripts/general/methods.m scripts/general/profexplore.m scripts/general/profshow.m scripts/help/help.m scripts/help/lookfor.m scripts/help/which.m scripts/image/imformats.m scripts/io/beep.m scripts/io/fputs.m scripts/io/module.mk scripts/io/textread.m scripts/java/javaclasspath.m scripts/java/javamem.m scripts/miscellaneous/dir.m scripts/miscellaneous/dos.m scripts/miscellaneous/fact.m scripts/miscellaneous/info.m scripts/miscellaneous/license.m scripts/miscellaneous/ls.m scripts/miscellaneous/menu.m scripts/miscellaneous/mkoctfile.m scripts/miscellaneous/private/display_info_file.m scripts/miscellaneous/unix.m scripts/miscellaneous/ver.m scripts/miscellaneous/what.m scripts/ode/ode23.m scripts/ode/ode45.m scripts/optimization/fminbnd.m scripts/optimization/optimset.m scripts/optimization/sqp.m scripts/pkg/pkg.m scripts/pkg/private/describe.m scripts/pkg/private/install.m scripts/pkg/private/installed_packages.m scripts/pkg/private/list_forge_packages.m scripts/pkg/private/rebuild.m scripts/plot/util/__gnuplot_drawnow__.m scripts/signal/stft.m scripts/sparse/bicg.m scripts/sparse/bicgstab.m scripts/sparse/cgs.m scripts/sparse/pcg.m scripts/sparse/pcr.m scripts/sparse/qmr.m scripts/statistics/models/logistic_regression.m scripts/statistics/tests/anova.m scripts/statistics/tests/bartlett_test.m scripts/statistics/tests/chisquare_test_homogeneity.m scripts/statistics/tests/chisquare_test_independence.m scripts/statistics/tests/cor_test.m scripts/statistics/tests/f_test_regression.m scripts/statistics/tests/hotelling_test.m scripts/statistics/tests/hotelling_test_2.m scripts/statistics/tests/kolmogorov_smirnov_test.m scripts/statistics/tests/kolmogorov_smirnov_test_2.m scripts/statistics/tests/kruskal_wallis_test.m scripts/statistics/tests/manova.m scripts/statistics/tests/mcnemar_test.m scripts/statistics/tests/prop_test_2.m scripts/statistics/tests/run_test.m scripts/statistics/tests/sign_test.m scripts/statistics/tests/t_test.m scripts/statistics/tests/t_test_2.m scripts/statistics/tests/t_test_regression.m scripts/statistics/tests/u_test.m scripts/statistics/tests/var_test.m scripts/statistics/tests/welch_test.m scripts/statistics/tests/wilcoxon_test.m scripts/statistics/tests/z_test.m scripts/statistics/tests/z_test_2.m scripts/strings/strtok.m scripts/testfun/__run_test_suite__.m scripts/testfun/demo.m scripts/testfun/example.m scripts/testfun/private/compare_plot_demos.m scripts/testfun/rundemos.m scripts/testfun/runtests.m scripts/testfun/speed.m scripts/testfun/test.m scripts/time/calendar.m test/io.tst
diffstat 98 files changed, 656 insertions(+), 584 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Wed Apr 20 09:19:06 2016 +0200
+++ b/NEWS	Wed Apr 20 17:53:10 2016 +0200
@@ -71,6 +71,10 @@
  ** The textscan function is now built-in and is much faster and much
     more Matlab-compatible than the previous m-file version.
 
+ ** The fputs function now allows to ommit the file descriptor to
+    print the string to stdout and returns the number of bytes written
+    to the file descriptor or stdout, respectively.
+
  ** Dialog boxes, errordlg, helpdlg, inputdlg, errordlg, listdlg,
     msgbox, questdlg, and warndlg, now exclusively use QT.  Java based
     versions are removed.
@@ -100,6 +104,9 @@
       mahalanobis          | mahal in Octave-Forge statistics pkg
       md5sum               | hash
       octve_config_info    | __octave_config_info__
+      printf               | fprintf
+      puts                 | fputs
+      scanf                | fscanf
       sleep                | pause
       usleep               | pause
       wavread              | audioread
--- a/doc/interpreter/basics.txi	Wed Apr 20 09:19:06 2016 +0200
+++ b/doc/interpreter/basics.txi	Wed Apr 20 17:53:10 2016 +0200
@@ -310,12 +310,12 @@
 
 @example
 @group
-printf ("%s", program_name ());
+fprintf ("%s", program_name ());
 arg_list = argv ();
 for i = 1:nargin
-  printf (" %s", arg_list@{i@});
+  fprintf (" %s", arg_list@{i@});
 endfor
-printf ("\n");
+fprintf ("\n");
 @end group
 @end example
 
@@ -1038,7 +1038,7 @@
 printf ("%s", program_name ());
 arg_list = argv ();
 for i = 1:nargin
-  printf (" %s", arg_list@{i@});
+  fprintf (" %s", arg_list@{i@});
 endfor
 printf ("\n");
 @end group
--- a/doc/interpreter/func.txi	Wed Apr 20 09:19:06 2016 +0200
+++ b/doc/interpreter/func.txi	Wed Apr 20 17:53:10 2016 +0200
@@ -108,12 +108,12 @@
 @example
 @group
 function wakeup
-  printf ("\a");
+  fprintf ("\a");
 endfunction
 @end group
 @end example
 
-The @code{printf} statement (@pxref{Input and Output}) simply tells
+The @code{fprintf} statement (@pxref{Input and Output}) simply tells
 Octave to print the string @qcode{"@xbackslashchar{}a"}.  The special character
 @samp{\a} stands for the alert character (ASCII 7).  @xref{Strings}.
 
@@ -143,7 +143,7 @@
 @example
 @group
 function wakeup (message)
-  printf ("\a%s\n", message);
+  fprintf ("\a%s\n", message);
 endfunction
 @end group
 @end example
@@ -157,7 +157,7 @@
 @noindent
 will cause Octave to ring your terminal's bell and print the message
 @samp{Rise and shine!}, followed by a newline character (the @samp{\n}
-in the first argument to the @code{printf} statement).
+in the first argument to the @code{fprintf} statement).
 
 In most cases, you will also want to get some information back from the
 functions you define.  Here is the syntax for writing a function that
@@ -488,7 +488,7 @@
 @group
 function print_arguments (varargin)
   for i = 1:length (varargin)
-    printf ("Input argument %d: ", i);
+    fprintf ("Input argument %d: ", i);
     disp (varargin@{i@});
   endfor
 endfunction
@@ -620,7 +620,7 @@
       return;
     endif
   endfor
-  printf ("no nonzero elements found\n");
+  fprintf ("no nonzero elements found\n");
 endfunction
 @end group
 @end example
@@ -664,7 +664,7 @@
 @example
 @group
 function hello (who = "World")
-  printf ("Hello, %s!\n", who);
+  fprintf ("Hello, %s!\n", who);
 endfunction
 @end group
 @end example
@@ -825,15 +825,15 @@
 @example
 @group
 function f ()
-  printf ("in f, calling g\n");
+  fprintf ("in f, calling g\n");
   g ()
 endfunction
 function g ()
-  printf ("in g, calling h\n");
+  fprintf ("in g, calling h\n");
   h ()
 endfunction
 function h ()
-  printf ("in h\n")
+  fprintf ("in h\n")
 endfunction
 @end group
 @end example
@@ -1096,8 +1096,8 @@
 function count_calls ()
   mlock ();
   persistent calls = 0;
-  printf ("'count_calls' has been called %d times\n",
-          ++calls);
+  fprintf ("'count_calls' has been called %d times\n",
+           ++calls);
 endfunction
 
 count_calls ();
--- a/doc/interpreter/io.txi	Wed Apr 20 09:19:06 2016 +0200
+++ b/doc/interpreter/io.txi	Wed Apr 20 17:53:10 2016 +0200
@@ -88,12 +88,11 @@
 
 Normally, no output is displayed by the pager until just before Octave
 is ready to print the top level prompt, or read from the standard input
-(for example, by using the @code{fscanf} or @code{scanf} functions).
-This means that there may be some delay before any output appears on
-your screen if you have asked Octave to perform a significant amount of
-work with a single command statement.  The function @code{fflush} may be
-used to force output to be sent to the pager (or any other stream)
-immediately.
+(for example, by using the @code{fscanf} function).  This means that there
+may be some delay before any output appears on your screen if you have
+asked Octave to perform a significant amount of work with a single
+command statement.  The function @code{fflush} may be used to force output
+to be sent to the pager (or any other stream) immediately.
 
 You can select the program to run as the pager using the @env{PAGER}
 function, and you can turn paging off by using the function
@@ -333,28 +332,12 @@
 @node Simple Output
 @subsection Simple Output
 
-Once a file has been opened for writing a string can be written to the
-file using the @code{fputs} function.  The following example shows
-how to write the string @samp{Free Software is needed for Free Science}
-to the file @samp{free.txt}.
-
-@example
-@group
-filename = "free.txt";
-fid = fopen (filename, "w");
-fputs (fid, "Free Software is needed for Free Science");
-fclose (fid);
-@end group
-@end example
+The function @code{fputs} is the most simple way to write an unformatted
+string to either @code{stdout} or to a file, that has been opened for
+writing.
 
 @DOCSTRING(fputs)
 
-A function much similar to @code{fputs} is available for writing data
-to the screen.  The @code{puts} function works just like @code{fputs}
-except it doesn't take a file pointer as its input.
-
-@DOCSTRING(puts)
-
 @node Line-Oriented Input
 @subsection Line-Oriented Input
 
@@ -384,25 +367,18 @@
 @node Formatted Output
 @subsection Formatted Output
 
-This section describes how to call @code{printf} and related functions.
-
-The following functions are available for formatted output.  They are
+This section describes how to call the @code{fprintf} and @code{sprintf}
+functions.  These functions are available for formatted output.  They are
 modeled after the C language functions of the same name, but they
 interpret the format template differently in order to improve the
 performance of printing vector and matrix values.
 
-Implementation Note: For compatibility with @sc{matlab}, escape sequences in
-the template string (e.g., @qcode{"@xbackslashchar{}n"} => newline) are
-expanded even when the template string is defined with single quotes.
-
-@DOCSTRING(printf)
-
 @DOCSTRING(fprintf)
 
 @DOCSTRING(sprintf)
 
-The @code{printf} function can be used to print any number of arguments.
-The template string argument you supply in a call provides
+@code{fprintf} and @code{sprintf} can be used to print any number of
+arguments.  The template string argument you supply in a call provides
 information not only about the number of additional arguments, but also
 about their types and what style should be used for printing them.
 
@@ -410,14 +386,14 @@
 output stream as-is, while @dfn{conversion specifications} introduced by
 a @samp{%} character in the template cause subsequent arguments to be
 formatted and written to the output stream.  For example,
-@cindex conversion specifications (@code{printf})
+@cindex conversion specifications (@code{fprintf})
 
 @example
 @group
 pct = 37;
 filename = "foo.txt";
-printf ("Processed %d%% of '%s'.\nPlease be patient.\n",
-        pct, filename);
+fprintf ("Processed %d%% of '%s'.\nPlease be patient.\n",
+         pct, filename);
 @end group
 @end example
 
@@ -467,7 +443,7 @@
 
 @example
 @group
-printf ("%4.2f %10.2e %8.4g\n", hilb (3));
+fprintf ("%4.2f %10.2e %8.4g\n", hilb (3));
 
      @print{} 1.00   5.00e-01   0.3333
      @print{} 0.50   3.33e-01     0.25
@@ -483,7 +459,7 @@
 
 @example
 @group
-printf ("%4.2f %10.2e %8.4g\n", [1, 2], [3, 4]);
+fprintf ("%4.2f %10.2e %8.4g\n", [1, 2], [3, 4]);
 
      @print{} 1.00   2.00e+00        3
      @print{} 4.00
@@ -496,14 +472,13 @@
 @subsection Output Conversion Syntax
 
 This section provides details about the precise syntax of conversion
-specifications that can appear in a @code{printf} template
-string.
+specifications that can appear in a @code{fprintf} or @code{sprintf}
+template string.
 
 Characters in the template string that are not part of a
 conversion specification are printed as-is to the output stream.
 
-The conversion specifications in a @code{printf} template string have
-the general form:
+The conversion specifications in a template string have the general form:
 
 @example
 % @var{flags} @var{width} @r{[} . @var{precision} @r{]} @var{type} @var{conversion}
@@ -523,7 +498,7 @@
 @item
 Zero or more @dfn{flag characters} that modify the normal behavior of
 the conversion specification.
-@cindex flag character (@code{printf})
+@cindex flag character (@code{fprintf})
 
 @item
 An optional decimal integer specifying the @dfn{minimum field width}.
@@ -532,7 +507,7 @@
 value; if the normal conversion produces more characters than this, the
 field is @emph{not} truncated.  Normally, the output is right-justified
 within the field.
-@cindex minimum field width (@code{printf})
+@cindex minimum field width (@code{fprintf})
 
 You can also specify a field width of @samp{*}.  This means that the
 next argument in the argument list (before the actual value to be
@@ -546,7 +521,7 @@
 written for the numeric conversions.  If the precision is specified, it
 consists of a period (@samp{.}) followed optionally by a decimal integer
 (which defaults to zero if omitted).
-@cindex precision (@code{printf})
+@cindex precision (@code{fprintf})
 
 You can also specify a precision of @samp{*}.  This means that the next
 argument in the argument list (before the actual value to be printed) is
@@ -555,8 +530,8 @@
 
 @item
 An optional @dfn{type modifier character}.  This character is ignored by
-Octave's @code{printf} function, but is recognized to provide
-compatibility with the C language @code{printf}.
+Octave's @code{fprintf} function, but is recognized to provide
+compatibility with the C language @code{fprintf}.
 
 @item
 A character that specifies the conversion to be applied.
@@ -569,7 +544,7 @@
 
 @node Table of Output Conversions
 @subsection Table of Output Conversions
-@cindex output conversions, for @code{printf}
+@cindex output conversions, for @code{fprintf}
 
 Here is a table summarizing what all the different conversions do:
 
@@ -577,7 +552,7 @@
 @item @samp{%d}, @samp{%i}
 Print an integer as a signed decimal number.  @xref{Integer
 Conversions}, for details.  @samp{%d} and @samp{%i} are synonymous for
-output, but are different when used with @code{scanf} for input
+output, but are different when used with @code{fscanf} for input
 (@pxref{Table of Input Conversions}).
 
 @item @samp{%o}
@@ -623,16 +598,15 @@
 a bare percentage sign @samp{%} with no subsequent conversion character.
 Octave will emit an error and stop if it sees such code.  When the string
 variable to be processed cannot be guaranteed to be free of potential format
-codes it is better to use the two argument form of any of the @code{printf}
-functions and set the format string to @code{%s}.  Alternatively, for code
-which is not required to be backwards-compatible with @sc{matlab} the
-Octave function @code{puts} or @code{disp} can be used.
+codes it is better to use the two argument form of @code{fprintf} and
+@code{sprintf} and set the format string to @code{%s}.  Alternatively,
+the function @code{disp} can be used.
 
 @example
 @group
-printf (strvar);        # Unsafe if strvar contains format codes
-printf ("%s", strvar);  # Safe
-puts (strvar);          # Safe
+fprintf (strvar);        # Unsafe if strvar contains format codes
+fprintf ("%s", strvar);  # Safe
+disp (strvar);           # Safe
 @end group
 @end example
 
@@ -763,7 +737,8 @@
 @node Other Output Conversions
 @subsection Other Output Conversions
 
-This section describes miscellaneous conversions for @code{printf}.
+This section describes miscellaneous conversions for @code{fprintf} and
+@code{sprintf}.
 
 The @samp{%c} conversion prints a single character.  The @samp{-}
 flag can be used to specify left-justification in the field, but no
@@ -771,7 +746,7 @@
 For example:
 
 @example
-printf ("%c%c%c%c%c", "h", "e", "l", "l", "o");
+fprintf ("%c%c%c%c%c", "h", "e", "l", "l", "o");
 @end example
 
 @noindent
@@ -786,7 +761,7 @@
 are defined for this conversion.  For example:
 
 @example
-printf ("%3s%-6s", "no", "where");
+fprintf ("%3s%-6s", "no", "where");
 @end example
 
 @noindent
@@ -795,36 +770,34 @@
 @node Formatted Input
 @subsection Formatted Input
 
-Octave provides the @code{scanf}, @code{fscanf}, and @code{sscanf}
-functions to read formatted input.  There are two forms of each of these
-functions.  One can be used to extract vectors of data from a file, and
-the other is more `C-like'.
+Octave provides the @code{fscanf} and @code{sscanf} functions to read
+formatted input.  There are two forms of each of these functions.  One
+can be used to extract vectors of data from a file, and the other is
+more `C-like'.
 
 @DOCSTRING(fscanf)
 
-@DOCSTRING(scanf)
-
 @DOCSTRING(sscanf)
 
-Calls to @code{scanf} are superficially similar to calls to
-@code{printf} in that arbitrary arguments are read under the control of
+Calls to @code{fscanf} are superficially similar to calls to
+@code{fprintf} in that arbitrary arguments are read under the control of
 a template string.  While the syntax of the conversion specifications in
-the template is very similar to that for @code{printf}, the
+the template is very similar to that for @code{fprintf}, the
 interpretation of the template is oriented more towards free-format
 input and simple pattern matching, rather than fixed-field formatting.
-For example, most @code{scanf} conversions skip over any amount of
+For example, most @code{fscanf} conversions skip over any amount of
 ``white space'' (including spaces, tabs, and newlines) in the input
 file, and there is no concept of precision for the numeric input
 conversions as there is for the corresponding output conversions.
 Ordinarily, non-whitespace characters in the template are expected to
 match characters in the input stream exactly.
-@cindex conversion specifications (@code{scanf})
+@cindex conversion specifications (@code{fscanf})
 
-When a @dfn{matching failure} occurs, @code{scanf} returns immediately,
+When a @dfn{matching failure} occurs, @code{fscanf} returns immediately,
 leaving the first non-matching character as the next character to be
-read from the stream, and @code{scanf} returns all the items that were
+read from the stream, and @code{fscanf} returns all the items that were
 successfully converted.
-@cindex matching failure, in @code{scanf}
+@cindex matching failure, in @code{fscanf}
 
 The formatted input functions are not used as frequently as the
 formatted output functions.  Partly, this is because it takes some care
@@ -834,7 +807,7 @@
 @node Input Conversion Syntax
 @subsection Input Conversion Syntax
 
-A @code{scanf} template string is a string that contains ordinary
+A @code{fscanf} template string is a string that contains ordinary
 multibyte characters interspersed with conversion specifications that
 start with @samp{%}.
 
@@ -849,7 +822,7 @@
 specifications must match characters in the input stream exactly; if
 this is not the case, a matching failure occurs.
 
-The conversion specifications in a @code{scanf} template string
+The conversion specifications in a @code{fscanf} template string
 have the general form:
 
 @example
@@ -862,12 +835,12 @@
 @itemize @bullet
 @item
 An optional @dfn{flag character} @samp{*}, which says to ignore the text
-read for this specification.  When @code{scanf} finds a conversion
+read for this specification.  When @code{fscanf} finds a conversion
 specification that uses this flag, it reads input as directed by the
 rest of the conversion specification, but it discards this input, does
 not return any value, and does not increment the count of
 successful assignments.
-@cindex flag character (@code{scanf})
+@cindex flag character (@code{fscanf})
 
 @item
 An optional decimal integer that specifies the @dfn{maximum field
@@ -877,12 +850,12 @@
 characters, and these discarded characters don't count towards the
 maximum field width.  Conversions that do not discard initial whitespace
 are explicitly documented.
-@cindex maximum field width (@code{scanf})
+@cindex maximum field width (@code{fscanf})
 
 @item
 An optional type modifier character.  This character is ignored by
-Octave's @code{scanf} function, but is recognized to provide
-compatibility with the C language @code{scanf}.
+Octave's @code{fscanf} function, but is recognized to provide
+compatibility with the C language @code{fscanf}.
 
 @item
 A character that specifies the conversion to be applied.
@@ -895,7 +868,7 @@
 
 @node Table of Input Conversions
 @subsection Table of Input Conversions
-@cindex input conversions, for @code{scanf}
+@cindex input conversions, for @code{fscanf}
 
 Here is a table that summarizes the various conversion specifications:
 
@@ -949,7 +922,7 @@
 @node Numeric Input Conversions
 @subsection Numeric Input Conversions
 
-This section describes the @code{scanf} conversions for reading numeric
+This section describes the @code{fscanf} conversions for reading numeric
 values.
 
 The @samp{%d} conversion matches an optionally signed integer in decimal
@@ -969,13 +942,13 @@
 The @samp{%X} conversion is identical to the @samp{%x} conversion.  They
 both permit either uppercase or lowercase letters to be used as digits.
 
-Unlike the C language @code{scanf}, Octave ignores the @samp{h},
+Unlike the C language @code{fscanf}, Octave ignores the @samp{h},
 @samp{l}, and @samp{L} modifiers.
 
 @node String Input Conversions
 @subsection String Input Conversions
 
-This section describes the @code{scanf} input conversions for reading
+This section describes the @code{fscanf} input conversions for reading
 string and character values: @samp{%s} and @samp{%c}.
 
 The @samp{%c} conversion is the simplest: it matches a fixed number of
@@ -1091,4 +1064,3 @@
 fseek (myfile, marker, SEEK_SET);
 @end group
 @end example
-
--- a/doc/interpreter/stmt.txi	Wed Apr 20 09:19:06 2016 +0200
+++ b/doc/interpreter/stmt.txi	Wed Apr 20 17:53:10 2016 +0200
@@ -115,16 +115,16 @@
 @example
 @group
 if (rem (x, 2) == 0)
-  printf ("x is even\n");
+  fprintf ("x is even\n");
 else
-  printf ("x is odd\n");
+  fprintf ("x is odd\n");
 endif
 @end group
 @end example
 
 In this example, if the expression @code{rem (x, 2) == 0} is true (that
 is, the value of @code{x} is divisible by 2), then the first
-@code{printf} statement is evaluated, otherwise the second @code{printf}
+@code{fprintf} statement is evaluated, otherwise the second @code{fprintf}
 statement is evaluated.
 
 The third and most general form of the @code{if} statement allows
@@ -152,20 +152,20 @@
 statement.
 
 In the following example, if the first condition is true (that is, the
-value of @code{x} is divisible by 2), then the first @code{printf}
+value of @code{x} is divisible by 2), then the first @code{fprintf}
 statement is executed.  If it is false, then the second condition is
 tested, and if it is true (that is, the value of @code{x} is divisible
-by 3), then the second @code{printf} statement is executed.  Otherwise,
-the third @code{printf} statement is performed.
+by 3), then the second @code{fprintf} statement is executed.  Otherwise,
+the third @code{fprintf} statement is performed.
 
 @example
 @group
 if (rem (x, 2) == 0)
-  printf ("x is even\n");
+  fprintf ("x is even\n");
 elseif (rem (x, 3) == 0)
-  printf ("x is odd and divisible by 3\n");
+  fprintf ("x is odd and divisible by 3\n");
 else
-  printf ("x is odd\n");
+  fprintf ("x is odd\n");
 endif
 @end group
 @end example
@@ -296,9 +296,9 @@
 A = 7;
 switch (A)
   case @{ 6, 7 @}
-    printf ("variable is either 6 or 7\n");
+    fprintf ("variable is either 6 or 7\n");
   otherwise
-    printf ("variable is neither 6 nor 7\n");
+    fprintf ("variable is neither 6 nor 7\n");
 endswitch
 @end group
 @end example
@@ -684,9 +684,9 @@
   div++;
 endwhile
 if (rem (num, div) == 0)
-  printf ("Smallest divisor of %d is %d\n", num, div)
+  fprintf ("Smallest divisor of %d is %d\n", num, div)
 else
-  printf ("%d is prime\n", num);
+  fprintf ("%d is prime\n", num);
 endif
 @end group
 @end example
@@ -707,12 +707,12 @@
 div = 2;
 while (1)
   if (rem (num, div) == 0)
-    printf ("Smallest divisor of %d is %d\n", num, div);
+    fprintf ("Smallest divisor of %d is %d\n", num, div);
     break;
   endif
   div++;
   if (div*div > num)
-    printf ("%d is prime\n", num);
+    fprintf ("%d is prime\n", num);
     break;
   endif
 endwhile
@@ -746,7 +746,7 @@
   if (rem (x, 2) != 0)
     continue;
   endif
-  printf ("%d\n", x);
+  fprintf ("%d\n", x);
 endfor
 @end group
 @end example
@@ -763,7 +763,7 @@
 @group
 for x = vec
   if (rem (x, 2) == 0)
-    printf ("%d\n", x);
+    fprintf ("%d\n", x);
   endif
 endfor
 @end group
--- a/doc/interpreter/var.txi	Wed Apr 20 09:19:06 2016 +0200
+++ b/doc/interpreter/var.txi	Wed Apr 20 17:53:10 2016 +0200
@@ -193,8 +193,8 @@
 @group
 function count_calls ()
   persistent calls = 0;
-  printf ("'count_calls' has been called %d times\n",
-          ++calls);
+  fprintf ("'count_calls' has been called %d times\n",
+           ++calls);
 endfunction
 
 for i = 1:3
@@ -248,8 +248,8 @@
   if (isempty (calls))
     calls = 0;
   endif
-  printf ("'count_calls' has been called %d times\n",
-          ++calls);
+  fprintf ("'count_calls' has been called %d times\n",
+           ++calls);
 endfunction
 @end group
 @end example
--- a/doc/refcard/refcard.tex	Wed Apr 20 09:19:06 2016 +0200
+++ b/doc/refcard/refcard.tex	Wed Apr 20 17:53:10 2016 +0200
@@ -877,10 +877,8 @@
 \altsec C-style Input and Output;
 fopen ({\it name}, {\it mode})&open file {\it name}\cr
 fclose ({\it file})&close {\it file}\cr
-printf ({\it fmt}, ...)&formatted output to {\tt stdout}\cr
 fprintf ({\it file}, {\it fmt}, ...)&formatted output to {\it file}\cr
 sprintf ({\it fmt}, ...)&formatted output to string\cr
-scanf ({\it fmt})&formatted input from {\tt stdin}\cr
 fscanf ({\it file}, {\it fmt})&formatted input from {\it file}\cr
 sscanf ({\it str}, {\it fmt})&formatted input from {\it string}\cr
 fgets ({\it file}, {\it len})&read {\it len\/} characters from {\it file\/}\cr
--- a/examples/code/@FIRfilter/display.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/examples/code/@FIRfilter/display.m	Wed Apr 20 17:53:10 2016 +0200
@@ -1,4 +1,4 @@
 function display (f)
-  printf ("%s.polynomial", inputname (1));
+  fprintf ("%s.polynomial", inputname (1));
   display (f.polynomial);
 endfunction
--- a/examples/code/@polynomial/display.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/examples/code/@polynomial/display.m	Wed Apr 20 17:53:10 2016 +0200
@@ -1,6 +1,6 @@
 function display (p)
 
-  printf ("%s =", inputname (1));
+  fprintf ("%s =", inputname (1));
 
   a = p.poly;
   first = true;
@@ -9,28 +9,28 @@
       if (first)
         first = false;
       elseif (a(i) > 0 || isnan (a(i)))
-        printf (" +");
+        fprintf (" +");
       endif
       if (a(i) < 0)
-        printf (" -");
+        fprintf (" -");
       endif
       if (i == 1)
-        printf (" %.5g", abs (a(i)));
+        fprintf (" %.5g", abs (a(i)));
       elseif (abs (a(i)) != 1)
-        printf (" %.5g *", abs (a(i)));
+        fprintf (" %.5g *", abs (a(i)));
       endif
       if (i > 1)
-        printf (" X");
+        fprintf (" X");
       endif
       if (i > 2)
-        printf (" ^ %d", i - 1);
+        fprintf (" ^ %d", i - 1);
       endif
     endif
   endfor
 
   if (first)
-    printf (" 0");
+    fprintf (" 0");
   endif
-  printf ("\n");
+  fprintf ("\n");
 
 endfunction
--- a/libinterp/corefcn/file-io.cc	Wed Apr 20 09:19:06 2016 +0200
+++ b/libinterp/corefcn/file-io.cc	Wed Apr 20 17:53:10 2016 +0200
@@ -780,7 +780,7 @@
 Implementation Note: For compatibility with @sc{matlab}, escape sequences in\n\
 the template string (e.g., @qcode{\"@xbackslashchar{}n\"} => newline) are\n\
 expanded even when the template string is defined with single quotes.\n\
-@seealso{fputs, fdisp, fwrite, fscanf, printf, sprintf, fopen}\n\
+@seealso{fputs, fdisp, fwrite, fscanf, sprintf, fopen}\n\
 @end deftypefn")
 {
   static std::string who = "fprintf";
@@ -824,99 +824,6 @@
     return ovl ();
 }
 
-DEFUN (printf, args, nargout,
-       "-*- texinfo -*-\n\
-@deftypefn {} {} printf (@var{template}, @dots{})\n\
-Print optional arguments under the control of the template string\n\
-@var{template} to the stream @code{stdout} and return the number of\n\
-characters printed.\n\
-@ifclear OCTAVE_MANUAL\n\
-\n\
-See the Formatted Output section of the GNU Octave manual for a\n\
-complete description of the syntax of the template string.\n\
-@end ifclear\n\
-\n\
-Implementation Note: For compatibility with @sc{matlab}, escape sequences in\n\
-the template string (e.g., @qcode{\"@xbackslashchar{}n\"} => newline) are\n\
-expanded even when the template string is defined with single quotes.\n\
-@seealso{fprintf, sprintf, scanf}\n\
-@end deftypefn")
-{
-  static std::string who = "printf";
-
-  int nargin = args.length ();
-
-  if (nargin == 0)
-    print_usage ();
-
-  int result;
-
-  if (! args(0).is_string ())
-    error ("%s: format TEMPLATE must be a string", who.c_str ());
-
-  octave_value_list tmp_args;
-
-  if (nargin > 1)
-    {
-      tmp_args.resize (nargin-1, octave_value ());
-
-      for (int i = 1; i < nargin; i++)
-        tmp_args(i-1) = args(i);
-    }
-
-  result = stdout_stream.printf (args(0), tmp_args, who);
-
-  if (nargout > 0)
-    return ovl (result);
-  else
-    return ovl ();
-}
-
-DEFUN (fputs, args, ,
-       "-*- texinfo -*-\n\
-@deftypefn  {} {} fputs (@var{fid}, @var{string})\n\
-@deftypefnx {} {@var{status} =} fputs (@var{fid}, @var{string})\n\
-Write the string @var{string} to the file with file descriptor @var{fid}.\n\
-\n\
-The string is written to the file with no additional formatting.  Use\n\
-@code{fdisp} instead to automatically append a newline character appropriate\n\
-for the local machine.\n\
-\n\
-Return a non-negative number on success or EOF on error.\n\
-@seealso{fdisp, fprintf, fwrite, fopen}\n\
-@end deftypefn")
-{
-  static std::string who = "fputs";
-
-  if (args.length () != 2)
-    print_usage ();
-
-  octave_stream os = octave_stream_list::lookup (args(0), who);
-
-  return ovl (os.puts (args(1), who));
-}
-
-DEFUN (puts, args, ,
-       "-*- texinfo -*-\n\
-@deftypefn  {} {} puts (@var{string})\n\
-@deftypefnx {} {@var{status} =} puts (@var{string})\n\
-Write a string to the standard output with no formatting.\n\
-\n\
-The string is written verbatim to the standard output.  Use @code{disp} to\n\
-automatically append a newline character appropriate for the local machine.\n\
-\n\
-Return a non-negative number on success and EOF on error.\n\
-@seealso{fputs, disp}\n\
-@end deftypefn")
-{
-  static std::string who = "puts";
-
-  if (args.length () != 1)
-    print_usage ();
-
-  return ovl (stdout_stream.puts (args(0), who));
-}
-
 DEFUN (sprintf, args, ,
        "-*- texinfo -*-\n\
 @deftypefn {} {} sprintf (@var{template}, @dots{})\n\
@@ -930,7 +837,7 @@
 Implementation Note: For compatibility with @sc{matlab}, escape sequences in\n\
 the template string (e.g., @qcode{\"@xbackslashchar{}n\"} => newline) are\n\
 expanded even when the template string is defined with single quotes.\n\
-@seealso{printf, fprintf, sscanf}\n\
+@seealso{fprintf, sscanf}\n\
 @end deftypefn")
 {
   static std::string who = "sprintf";
@@ -1027,7 +934,7 @@
 See the Formatted Input section of the GNU Octave manual for a\n\
 complete description of the syntax of the template string.\n\
 @end ifclear\n\
-@seealso{fgets, fgetl, fread, scanf, sscanf, fopen}\n\
+@seealso{fgets, fgetl, fread, sscanf, fopen}\n\
 @end deftypefn")
 {
   static std::string who = "fscanf";
@@ -1090,7 +997,7 @@
 Reaching the end of the string is treated as an end-of-file condition.  In\n\
 addition to the values returned by @code{fscanf}, the index of the next\n\
 character to be read is returned in @var{pos}.\n\
-@seealso{fscanf, scanf, sprintf}\n\
+@seealso{fscanf, sprintf}\n\
 @end deftypefn")
 {
   static std::string who = "sscanf";
@@ -1138,27 +1045,6 @@
   return retval;
 }
 
-DEFUN (scanf, args, nargout,
-       "-*- texinfo -*-\n\
-@deftypefn  {} {[@var{val}, @var{count}, @var{errmsg}] =} scanf (@var{template}, @var{size})\n\
-@deftypefnx {} {[@var{v1}, @var{v2}, @dots{}, @var{count}, @var{errmsg}]] =} scanf (@var{template}, \"C\")\n\
-This is equivalent to calling @code{fscanf} with @var{fid} = @code{stdin}.\n\
-\n\
-It is currently not useful to call @code{scanf} in interactive programs.\n\
-@seealso{fscanf, sscanf, printf}\n\
-@end deftypefn")
-{
-  int nargin = args.length ();
-
-  octave_value_list tmp_args (nargin+1, octave_value ());
-
-  tmp_args (0) = 0.0;
-  for (int i = 0; i < nargin; i++)
-    tmp_args(i+1) = args(i);
-
-  return Ffscanf (tmp_args, nargout);
-}
-
 static octave_value_list
 textscan_internal (const std::string& who, const octave_value_list& args)
 {
--- a/libinterp/dldfcn/__init_gnuplot__.cc	Wed Apr 20 09:19:06 2016 +0200
+++ b/libinterp/dldfcn/__init_gnuplot__.cc	Wed Apr 20 17:53:10 2016 +0200
@@ -151,7 +151,7 @@
         octave_value_list args;
         Matrix fids = pstream.matrix_value ();
 
-        Ffputs (ovl (fids(0), "\nquit;\n"));
+        Ffprintf (ovl (fids(0), "%s", "\nquit;\n"));
 
         Ffflush (ovl (fids(0)));
         Fpclose (ovl (fids(0)));
--- a/scripts/@ftp/display.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/@ftp/display.m	Wed Apr 20 17:53:10 2016 +0200
@@ -17,11 +17,11 @@
 ## <http://www.gnu.org/licenses/>.
 
 function display (obj)
-  printf ("FTP Object\n");
-  printf (" host: %s\n", obj.host);
-  printf (" user: %s\n", obj.username);
-  printf ("  dir: %s\n", __ftp_pwd__ (obj.curlhandle));
-  printf (" mode: %s\n", __ftp_mode__ (obj.curlhandle));
+  fprintf ("FTP Object\n");
+  fprintf (" host: %s\n", obj.host);
+  fprintf (" user: %s\n", obj.username);
+  fprintf ("  dir: %s\n", __ftp_pwd__ (obj.curlhandle));
+  fprintf (" mode: %s\n", __ftp_mode__ (obj.curlhandle));
 endfunction
 
 
--- a/scripts/deprecated/module.mk	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/deprecated/module.mk	Wed Apr 20 17:53:10 2016 +0200
@@ -20,7 +20,10 @@
   scripts/deprecated/octave_config_info.m \
   scripts/deprecated/octave_tmp_file_name.m \
   scripts/deprecated/playaudio.m \
+  scripts/deprecated/printf.m \
+  scripts/deprecated/puts.m \
   scripts/deprecated/saveaudio.m \
+  scripts/deprecated/scanf.m \
   scripts/deprecated/setaudio.m \
   scripts/deprecated/sleep.m \
   scripts/deprecated/syl.m \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/deprecated/printf.m	Wed Apr 20 17:53:10 2016 +0200
@@ -0,0 +1,58 @@
+## Copyright (C) 1993-2016 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {} {} fprintf (@var{template}, @dots{})
+##
+## @code{printf} is deprecated and will be removed in Octave version 4.6.
+## Use @code{fprintf} for the equivalent functionality.
+##
+## Print optional arguments under the control of the template string
+## @var{template} to the stream @code{stdout} and return the number of
+## characters printed.
+## @ifclear OCTAVE_MANUAL
+##
+## See the Formatted Output section of the GNU Octave manual for a
+## complete description of the syntax of the template string.
+## @end ifclear
+##
+## Implementation Note: For compatibility with @sc{matlab}, escape sequences in
+## the template string (e.g., @qcode{\"@xbackslashchar{}n\"} => newline) are
+## expanded even when the template string is defined with single quotes.
+##
+## @seealso{fprintf, sprintf, fscanf, sscanf}
+## @end deftypefn
+
+## Deprecated in version 4.2
+
+function varargout = printf (varargin)
+
+  persistent warned = false;
+  if (! warned)
+    warned = true;
+    warning ("Octave:deprecated-function",
+             "printf is obsolete and will be removed from a future version of Octave, please use fprintf instead");
+  endif
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+
+  varargout = fprintf (varargin);
+
+endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/deprecated/puts.m	Wed Apr 20 17:53:10 2016 +0200
@@ -0,0 +1,49 @@
+## Copyright (C) 1993-2016 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {} {} puts (@var{string})
+## @deftypefnx {} {@var{numbytes} =} puts (@var{string})
+##
+## @code{puts} is deprecated and will be removed in Octave version 4.6.
+## Use @code{fputs} for the equivalent functionality.
+##
+## Write a string to the standard output with no formatting.
+##
+## The string is written verbatim to the standard output.  Use @code{disp} to
+## automatically append a newline character appropriate for the local machine.
+##
+## The optional output returns the number of bytes written to stdout.
+##
+## @seealso{fputs, disp}
+## @end deftypefn
+
+## Deprecated in version 4.2
+
+function numbytes = puts (str)
+
+  persistent warned = false;
+  if (! warned)
+    warned = true;
+    warning ("Octave:deprecated-function",
+             "puts is obsolete and will be removed from a future version of Octave, please use fputs instead");
+  endif
+
+  numbytes = fputs (stdout (), str);
+
+endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/deprecated/scanf.m	Wed Apr 20 17:53:10 2016 +0200
@@ -0,0 +1,49 @@
+## Copyright (C) 1993-2016 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {} {[@var{val}, @var{count}, @var{errmsg}] =} scanf (@var{template}, @var{size})
+## @deftypefnx {} {[@var{v1}, @var{v2}, @dots{}, @var{count}, @var{errmsg}]] =} scanf (@var{template}, \"C\")
+##
+## @code{scanf} is deprecated and will be removed in Octave version 4.6.
+## Use @code{fscanf (stdin, @dots{})} for the equivalent functionality.
+##
+## This is equivalent to calling @code{fscanf} with @var{fid} = @code{stdin}.
+##
+## It is currently not useful to call @code{scanf} in interactive programs.
+## @seealso{fscanf, sscanf, fprintf, sprintf}
+## @end deftypefn
+
+## Deprecated in version 4.2
+
+function varargout = scanf (varargin)
+
+  persistent warned = false;
+  if (! warned)
+    warned = true;
+    warning ("Octave:deprecated-function",
+             "scanf is obsolete and will be removed from a future version of Octave, please use fscanf instead");
+  endif
+
+  if (nargin < 1)
+    print_usage ();
+  endif
+
+  varargout = fscanf (stdin (), varargin);
+
+endfunction
--- a/scripts/general/inputParser.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/general/inputParser.m	Wed Apr 20 17:53:10 2016 +0200
@@ -410,15 +410,15 @@
       if (nargin > 1)
         print_usage ();
       endif
-      printf ("inputParser object with properties:\n\n");
+      fprintf ("inputParser object with properties:\n\n");
       b2s = @(x) ifelse (any (x), "true", "false");
-      printf (["   CaseSensitive   : %s\n   FunctionName    : %s\n" ...
+      fprintf (["   CaseSensitive   : %s\n   FunctionName    : %s\n" ...
                "   KeepUnmatched   : %s\n   PartialMatching : %s\n" ...
                "   StructExpand    : %s\n\n"],
                b2s (this.CaseSensitive), b2s (this.FunctionName),
                b2s (this.KeepUnmatched), b2s (this.PartialMatching),
                b2s (this.StructExpand));
-      printf ("Defined parameters:\n\n   {%s}\n",
+      fprintf ("Defined parameters:\n\n   {%s}\n",
               strjoin (this.Parameters, ", "));
     endfunction
   endmethods
--- a/scripts/general/methods.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/general/methods.m	Wed Apr 20 17:53:10 2016 +0200
@@ -62,7 +62,7 @@
 
   if (nargout == 0)
     classname = ifelse (ischar (obj), obj, class (obj));
-    printf ("Methods for class %s:\n", classname);
+    fprintf ("Methods for class %s:\n", classname);
     disp (list_in_columns (mtds_list));
   else
     mtds = mtds_list;
--- a/scripts/general/profexplore.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/general/profexplore.m	Wed Apr 20 17:53:10 2016 +0200
@@ -68,16 +68,16 @@
 
   while (true)
 
-    printf ("\n%s", parents);
+    fprintf ("\n%s", parents);
     strings = cell (length (tree), 1);
     for i = 1 : length (tree)
       strings{i} = sprintf ("%s: %d calls, %.3f total, %.3f self", ...
                             fcn_table(tree(i).Index).FunctionName, ...
                             tree(i).NumCalls, ...
                             tree(i).TotalTime, tree(i).SelfTime);
-      printf ("%s%d) %s\n", prefix, i, strings{i});
+      fprintf ("%s%d) %s\n", prefix, i, strings{i});
     endfor
-    printf ("\n");
+    fprintf ("\n");
 
     cmd = input ("profexplore> ", "s");
     option = fix (str2double (cmd));
@@ -86,15 +86,15 @@
       rv = 0;
       return;
     elseif (strcmp (cmd, "help"))
-      printf ("\nCommands for profile explorer:\n\n");
-      printf ("exit   Return to Octave prompt.\n");
-      printf ("quit   Return to Octave prompt.\n");
-      printf ("help   Display this help message.\n");
-      printf ("up [N] Go up N levels, where N is an integer.  Default is 1.\n");
-      printf ("N      Go down a level into option N.\n");
+      fprintf ("\nCommands for profile explorer:\n\n");
+      fprintf ("exit   Return to Octave prompt.\n");
+      fprintf ("quit   Return to Octave prompt.\n");
+      fprintf ("help   Display this help message.\n");
+      fprintf ("up [N] Go up N levels, where N is an integer.  Default is 1.\n");
+      fprintf ("N      Go down a level into option N.\n");
     elseif (! isnan (option))
       if (option < 1 || option > length (tree))
-        printf ("The chosen option is out of range!\n");
+        fprintf ("The chosen option is out of range!\n");
       else
         newParents = sprintf ("%s%s%s\n", parents, prefix, strings{option});
         newPrefix = sprintf ("%s  ", prefix);
@@ -126,11 +126,11 @@
         endif
       endif
 
-      printf ("Invalid 'up' command.  Type 'help' for further");
-      printf (" information.\n");
+      fprintf ("Invalid 'up' command.  Type 'help' for further");
+      fprintf (" information.\n");
     else
-      printf ("Unrecognized input.  Type 'help' to get a list of possible");
-      printf (" commands.\n");
+      fprintf ("Unrecognized input.  Type 'help' to get a list of possible");
+      fprintf (" commands.\n");
     endif
 
   endwhile
--- a/scripts/general/profshow.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/general/profshow.m	Wed Apr 20 17:53:10 2016 +0200
@@ -76,9 +76,9 @@
   headerFormat = sprintf ("%%4s %%%ds %%4s %%12s %%10s %%12s\n", nameLen);
   rowFormat = sprintf ("%%4d %%%ds %%4s %%12.3f %%10.2f %%12d\n", nameLen);
 
-  printf (headerFormat, ...
+  fprintf (headerFormat, ...
           "#", "Function", "Attr", "Time (s)", "Time (%)", "Calls");
-  printf ("%s\n", repmat ("-", 1, nameLen + 2 * 5 + 11 + 2 * 13));
+  fprintf ("%s\n", repmat ("-", 1, nameLen + 2 * 5 + 11 + 2 * 13));
 
   for i = 1 : n
     row = data.FunctionTable(p(i));
@@ -87,7 +87,7 @@
     if (row.IsRecursive)
       attr = "R";
     endif
-    printf (rowFormat, p(i), row.FunctionName, attr,
+    fprintf (rowFormat, p(i), row.FunctionName, attr,
             row.TotalTime, timePercent, row.NumCalls);
   endfor
 
--- a/scripts/help/help.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/help/help.m	Wed Apr 20 17:53:10 2016 +0200
@@ -64,7 +64,7 @@
   For more information visit http://www.octave.org.\n\n";
 
     if (nargout == 0)
-      puts (text);
+      fputs (text);
     else
       retval = text;
     endif
@@ -74,7 +74,7 @@
     if (strcmp (name, "--list"))
       list = do_list_functions ();
       if (nargout == 0)
-        printf ("%s", list);
+        fprintf ("%s", list);
       else
         retval = list;
       endif
@@ -84,7 +84,7 @@
     if (strcmp (name, "."))
       list = do_list_operators ();
       if (nargout == 0)
-        printf ("%s", list);
+        fprintf ("%s", list);
       else
         retval = list;
       endif
@@ -118,7 +118,7 @@
 
     if (nargout == 0)
       which (name);
-      printf ("\n%s\n%s", text, __additional_help_message__ ());
+      fprintf ("\n%s\n%s", text, __additional_help_message__ ());
     else
       retval = text;
     endif
@@ -189,13 +189,13 @@
       if (status != 0)
         warning ("help: Texinfo formatting filter exited abnormally; raw Texinfo source of help text follows...\n");
       endif
-      printf ("%s:\n\n%s\n", fname, text);
+      fprintf ("%s:\n\n%s\n", fname, text);
     endif
 
   endfor
 
   if (found)
-    puts (__additional_help_message__ ());
+    fputs (__additional_help_message__ ());
   else
     msg = feval (missing_function_hook, name);
 
@@ -216,4 +216,3 @@
 %!error <invalid input> help (42)
 %!error <invalid input> help ("abc", "def")
 %!error <'_! UNLIKELY_FCN! _' not found> help ("_! UNLIKELY_FCN! _")
-
--- a/scripts/help/lookfor.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/help/lookfor.m	Wed Apr 20 17:53:10 2016 +0200
@@ -164,14 +164,14 @@
     for k = 1:length (fcnlist)
       f = fcnlist{k};
       f(end+1:indent-1) = " ";
-      puts ([f " "]);
+      fputs ([f " "]);
       lf = length (f);
       desc = strtrim (strrep (help_text{k}, "\n", " "));
       ldesc = length (desc);
-      printf ("%s\n", desc(1:min (ldesc, desc_width - (lf - indent))));
+      fprintf ("%s\n", desc(1:min (ldesc, desc_width - (lf - indent))));
       for start = (desc_width - (lf - indent) + 1):desc_width:ldesc
         stop = min (start + desc_width, ldesc);
-        printf ("%s%s\n", indent_space, strtrim (desc (start:stop)));
+        fprintf ("%s%s\n", indent_space, strtrim (desc (start:stop)));
       endfor
     endfor
   else
@@ -194,4 +194,3 @@
     fcns = help_texts = {};
   endif
 endfunction
-
--- a/scripts/help/which.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/help/which.m	Wed Apr 20 17:53:10 2016 +0200
@@ -46,18 +46,18 @@
   if (nargout == 0)
     for i = 1:nargin
       if (m(i).is_variable)
-        printf ("'%s' is a variable\n", m(i).name);
+        fprintf ("'%s' is a variable\n", m(i).name);
       elseif (isempty (m(i).file))
         if (! isempty (m(i).type))
-          printf ("'%s' is a %s\n",
+          fprintf ("'%s' is a %s\n",
                   m(i).name, m(i).type);
         endif
       else
         if (isempty (m(i).type))
-          printf ("'%s' is the file %s\n",
+          fprintf ("'%s' is the file %s\n",
                   m(i).name, m(i).file);
         else
-          printf ("'%s' is a %s from the file %s\n",
+          fprintf ("'%s' is a %s from the file %s\n",
                   m(i).name, m(i).type, m(i).file);
         endif
       endif
--- a/scripts/image/imformats.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/image/imformats.m	Wed Apr 20 17:53:10 2016 +0200
@@ -311,7 +311,7 @@
 
   descriptions = {formats.description};
   table = cat (2, extensions(:), yes_no_cols, descriptions(:));
-  printf ([template "\n"], table'{:});
+  fprintf ([template "\n"], table'{:});
 
 endfunction
 
--- a/scripts/io/beep.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/io/beep.m	Wed Apr 20 17:53:10 2016 +0200
@@ -23,7 +23,7 @@
 ## This function sends the alarm character @qcode{"@xbackslashchar{}a"} to
 ## the terminal.  Depending on the user's configuration this may produce an
 ## audible beep, a visual bell, or nothing at all.
-## @seealso{puts, fputs, printf, fprintf}
+## @seealso{fputs, fprintf}
 ## @end deftypefn
 
 ## Author: jwe
@@ -34,10 +34,9 @@
     print_usage ();
   endif
 
-  puts ("\a");
+  fputs ("\a");
 
 endfunction
 
 
 %!error (beep (1))
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/io/fputs.m	Wed Apr 20 17:53:10 2016 +0200
@@ -0,0 +1,76 @@
+## Copyright (C) 1993-2016 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {} {} fputs (@var{string})
+## @deftypefnx {} {} fputs (@var{fid}, @var{string})
+## @deftypefnx {} {@var{numbytes} =} fputs (@dots{})
+##
+## Write the string @var{string} to the file with file descriptor @var{fid}.
+## If the file descriptor @var{fid} is ommited, the string is written to
+## stdout.
+##
+## The string is written to the file with no additional formatting.  Use
+## @code{fprintf} for formatting the output string.
+##
+## The optional output returns the number of bytes written to @var{fid} or
+## stdout, respectively.
+##
+## Examples:
+##
+## Printing the string @samp{Some text} directly to stdout.
+## @example
+## @group
+## fputs ("Some text");
+## @end group
+## @end example
+##
+## The following example shows how to write the string
+## @samp{Free Software is needed for Free Science} to the file
+## @samp{free.txt}.
+##
+## @example
+## @group
+## filename = "free.txt";
+## fid = fopen (filename, "w");
+## fputs (fid, "Free Software is needed for Free Science");
+## fclose (fid);
+## @end group
+## @end example
+##
+## @seealso{fprintf, fwrite, fopen, stdout}
+## @end deftypefn
+
+function numbytes = fputs (varargin)
+
+  narginchk (1, 2);
+
+  fid = stdout ();
+  str = varargin{1};
+  if (nargin == 2)
+    fid = varargin{1};
+    str = varargin{2};
+  endif
+
+  numbytes = fprintf (fid, "%s", str);
+
+endfunction
+
+%!assert (fputs (1, 1), 1)
+%!error <narginchk: not enough input arguments> fputs ()
+%!error <narginchk: too many input arguments> fputs (1, "foo", 3)
--- a/scripts/io/module.mk	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/io/module.mk	Wed Apr 20 17:53:10 2016 +0200
@@ -6,6 +6,7 @@
   scripts/io/csvwrite.m \
   scripts/io/dlmwrite.m \
   scripts/io/fileread.m \
+  scripts/io/fputs.m \
   scripts/io/importdata.m \
   scripts/io/is_valid_file_id.m \
   scripts/io/strread.m \
--- a/scripts/io/textread.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/io/textread.m	Wed Apr 20 17:53:10 2016 +0200
@@ -127,7 +127,7 @@
     nlines = Inf;
   endif
   if (nlines < 1)
-    printf ("textread: N = 0, no data read\n");
+    fprintf ("textread: N = 0, no data read\n");
     varargout = cell (1, nargout);
     return;
   endif
--- a/scripts/java/javaclasspath.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/java/javaclasspath.m	Wed Apr 20 17:53:10 2016 +0200
@@ -113,11 +113,11 @@
 ## Display cell array of paths
 
 function disp_path_list (which, path_list)
-  printf ("   %s JAVA PATH\n\n", which);
+  fprintf ("   %s JAVA PATH\n\n", which);
   if (numel (path_list) > 0)
-    printf ("      %s\n", path_list{:});
+    fprintf ("      %s\n", path_list{:});
   else
-    printf ("      - empty -\n");
+    fprintf ("      - empty -\n");
   endif
 endfunction
 
--- a/scripts/java/javamem.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/java/javamem.m	Wed Apr 20 17:53:10 2016 +0200
@@ -73,16 +73,16 @@
   jvmem{3} = rt.freeMemory ();
 
   if (nargout == 0)
-    printf ("\nJava virtual machine (JVM) memory info:\n");
-    printf ("Maximum available memory:        %5d MiB;\n",
+    fprintf ("\nJava virtual machine (JVM) memory info:\n");
+    fprintf ("Maximum available memory:        %5d MiB;\n",
             jvmem{1} / 1024 / 1024);
-    printf ("   (...running garbage collector...)\n");
-    printf ("OK, current status:\n");
-    printf ("Total memory in virtual machine: %5d MiB;\n",
+    fprintf ("   (...running garbage collector...)\n");
+    fprintf ("OK, current status:\n");
+    fprintf ("Total memory in virtual machine: %5d MiB;\n",
             jvmem{2} / 1024 / 1024);
-    printf ("Free memory in virtual machine:  %5d MiB;\n",
+    fprintf ("Free memory in virtual machine:  %5d MiB;\n",
             jvmem{3} / 1024 / 1024);
-    printf ("%d CPUs available.\n", rt.availableProcessors ());
+    fprintf ("%d CPUs available.\n", rt.availableProcessors ());
   else
     jmem = jvmem;
   endif
--- a/scripts/miscellaneous/dir.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/miscellaneous/dir.m	Wed Apr 20 17:53:10 2016 +0200
@@ -148,7 +148,7 @@
     retval = info;
   elseif (numel (info) > 0)
     ## Print the structure to the screen.
-    printf ("%s", list_in_columns ({info.name}));
+    fprintf ("%s", list_in_columns ({info.name}));
   else
     warning ("dir: nonexistent directory '%s'", directory);
   endif
--- a/scripts/miscellaneous/dos.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/miscellaneous/dos.m	Wed Apr 20 17:53:10 2016 +0200
@@ -42,7 +42,7 @@
   elseif (! isunix ())
     [status, text] = system (command);
     if (nargin > 1 || nargout == 0)
-      printf ("%s\n", text);
+      fprintf ("%s\n", text);
     endif
   endif
 
--- a/scripts/miscellaneous/fact.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/miscellaneous/fact.m	Wed Apr 20 17:53:10 2016 +0200
@@ -262,7 +262,7 @@
     truth = w;
   else
     w = wordwrap (w);
-    printf ("%s", w);
+    fprintf ("%s", w);
   endif
 
 endfunction
--- a/scripts/miscellaneous/info.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/miscellaneous/info.m	Wed Apr 20 17:53:10 2016 +0200
@@ -23,7 +23,7 @@
 
 function info ()
 
-  printf ("\n\
+  fprintf ("\n\
   Additional information about GNU Octave is available at\n\
   http://www.octave.org\n\
 \n\
--- a/scripts/miscellaneous/license.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/miscellaneous/license.m	Wed Apr 20 17:53:10 2016 +0200
@@ -88,7 +88,7 @@
         features = features(strcmp (features, feature));
       endif
       if (nargout == 0)
-        printf ("%s\n", features{:});
+        fprintf ("%s\n", features{:});
       else
         retval = struct ("feature", features, "user", get_username ());
       endif
--- a/scripts/miscellaneous/ls.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/miscellaneous/ls.m	Wed Apr 20 17:53:10 2016 +0200
@@ -98,7 +98,7 @@
     if (status != 0)
       error ("ls: command exited abnormally with status %d\n", status);
     elseif (nargout == 0)
-      puts (output);
+      fputs (output);
     else
       retval = strvcat (regexp (output, "[\r\n]+", "split"){:});
     endif
@@ -131,4 +131,3 @@
 %!error <all arguments must be character strings> ls (1)
 ## Test below is valid, but produces confusing output on screen
 %!#error <command exited abnormally> ls ("-!")
-
--- a/scripts/miscellaneous/menu.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/miscellaneous/menu.m	Wed Apr 20 17:53:10 2016 +0200
@@ -70,19 +70,19 @@
     page_screen_output (0, "local");
 
     if (! isempty (title))
-      printf ("%s\n", title);
+      fprintf ("%s\n", title);
     endif
 
     nopt = numel (varargin);
     while (1)
       for i = 1:nopt
-        printf ("  [%2d] %s\n", i, varargin{i});
+        fprintf ("  [%2d] %s\n", i, varargin{i});
       endfor
-      printf ("\n");
+      fprintf ("\n");
       s = input ("Select a number: ", "s");
       choice = sscanf (s, "%d");
       if (! isscalar (choice) || choice < 1 || choice > nopt)
-        printf ("\nerror: input invalid or out of range\n\n");
+        fprintf ("\nerror: input invalid or out of range\n\n");
         choice = 0;
       else
         break;
--- a/scripts/miscellaneous/mkoctfile.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/miscellaneous/mkoctfile.m	Wed Apr 20 17:53:10 2016 +0200
@@ -164,7 +164,7 @@
   if (nargout > 0)
     [output, status] = deal (out, sys);
   else
-    printf ("%s", out);
+    fprintf ("%s", out);
   endif
 
   if (sys != 0)
--- a/scripts/miscellaneous/private/display_info_file.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/miscellaneous/private/display_info_file.m	Wed Apr 20 17:53:10 2016 +0200
@@ -48,9 +48,8 @@
 
   fid = fopen (filepath, "r");
   while (ischar (line = fgets (fid)))
-    puts (line);
+    fputs (line);
   endwhile
   fclose (fid);
 
 endfunction
-
--- a/scripts/miscellaneous/unix.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/miscellaneous/unix.m	Wed Apr 20 17:53:10 2016 +0200
@@ -42,7 +42,7 @@
   elseif (isunix ())
     [status, text] = system (command);
     if (nargin > 1 || nargout == 0)
-      printf ("%s\n", text);
+      fprintf ("%s\n", text);
     endif
   endif
 
--- a/scripts/miscellaneous/ver.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/miscellaneous/ver.m	Wed Apr 20 17:53:10 2016 +0200
@@ -75,7 +75,7 @@
             ["Operating System: " os_string]
             hbar};
 
-    printf ("%s\n", desc{:});
+    fprintf ("%s\n", desc{:});
 
     if (isempty (package))
       pkg ("list");
--- a/scripts/miscellaneous/what.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/miscellaneous/what.m	Wed Apr 20 17:53:10 2016 +0200
@@ -137,7 +137,7 @@
 function __display_filenames__ (msg, p, f)
 
   if (length (f) > 0)
-    printf ("%s %s:\n\n", msg, p);
+    fprintf ("%s %s:\n\n", msg, p);
 
     maxlen = max (cellfun ("length", f));
     ncols = max (1, floor (terminal_size ()(2) / (maxlen + 3)));
@@ -151,7 +151,7 @@
       if (length (args) < ncols)
         args(end+1 : ncols) = {""};
       endif
-      printf (fmt, args{:});
+      fprintf (fmt, args{:});
     endfor
   endif
 
--- a/scripts/ode/ode23.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/ode/ode23.m	Wed Apr 20 17:53:10 2016 +0200
@@ -361,9 +361,9 @@
     nlinsols  = 0;  # no. of solutions of linear systems
     ## Print cost statistics if no output argument is given
     if (nargout == 0)
-      printf ("Number of successful steps: %d\n", nsteps);
-      printf ("Number of failed attempts:  %d\n", nfailed);
-      printf ("Number of function calls:   %d\n", nfevals);
+      fprintf ("Number of successful steps: %d\n", nsteps);
+      fprintf ("Number of failed attempts:  %d\n", nfailed);
+      fprintf ("Number of function calls:   %d\n", nfevals);
     endif
   else
     havestats = false;
--- a/scripts/ode/ode45.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/ode/ode45.m	Wed Apr 20 17:53:10 2016 +0200
@@ -346,9 +346,9 @@
     nlinsols  = 0;  # no. of linear systems solutions
     ## Print cost statistics if no output argument is given
     if (nargout == 0)
-      printf ("Number of successful steps: %d\n", nsteps);
-      printf ("Number of failed attempts:  %d\n", nfailed);
-      printf ("Number of function calls:   %d\n", nfevals);
+      fprintf ("Number of successful steps: %d\n", nsteps);
+      fprintf ("Number of failed attempts:  %d\n", nfailed);
+      fprintf ("Number of function calls:   %d\n", nfevals);
     endif
   else
     havestats = false;
--- a/scripts/optimization/fminbnd.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/optimization/fminbnd.m	Wed Apr 20 17:53:10 2016 +0200
@@ -260,32 +260,32 @@
 
 ## A hack for printing a formatted table
 function print_formatted_table (table)
-  printf ("\n Func-count     x          f(x)         Procedure\n");
+  fprintf ("\n Func-count     x          f(x)         Procedure\n");
   for row=table
-    printf("%5.5s        %7.7s    %8.8s\t%s\n",
+    fprintf("%5.5s        %7.7s    %8.8s\t%s\n",
            int2str (row.funccount), num2str (row.x,"%.5f"),
            num2str (row.fx,"%.6f"), row.procedure);
   endfor
-  printf ("\n");
+  fprintf ("\n");
 endfunction
 
 ## Print either a success termination message or bad news
 function print_exit_msg (info, opt=struct())
-  printf ("");
+  fprintf ("");
   switch (info)
     case 1
-      printf ("Optimization terminated:\n");
-      printf (" the current x satisfies the termination criteria using OPTIONS.TolX of %e\n", opt.TolX);
+      fprintf ("Optimization terminated:\n");
+      fprintf (" the current x satisfies the termination criteria using OPTIONS.TolX of %e\n", opt.TolX);
     case 0
-      printf ("Exiting: Maximum number of iterations has been exceeded\n");
-      printf ("         - increase MaxIter option.\n");
-      printf ("         Current function value: %.6f\n", opt.fx);
+      fprintf ("Exiting: Maximum number of iterations has been exceeded\n");
+      fprintf ("         - increase MaxIter option.\n");
+      fprintf ("         Current function value: %.6f\n", opt.fx);
     case -1
       "FIXME"; # FIXME: what's the message MATLAB prints for this case?
     otherwise
       error ("fminbnd: internal error, info return code was %d", info);
   endswitch
-  printf ("\n");
+  fprintf ("\n");
 endfunction
 
 
--- a/scripts/optimization/optimset.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/optimization/optimset.m	Wed Apr 20 17:53:10 2016 +0200
@@ -122,9 +122,9 @@
   if (nargs == 0)
     if (nargout == 0)
       ## Display possibilities.
-      puts ("\nAll possible optimization options:\n\n");
-      printf ("  %s\n", opts{:});
-      puts ("\n");
+      fputs ("\nAll possible optimization options:\n\n");
+      fprintf ("  %s\n", opts{:});
+      fputs ("\n");
     else
       ## Return struct with all options initialized to []
       retval = cell2struct (repmat ({[]}, size (opts)), opts, 2);
@@ -189,4 +189,3 @@
 %!error <no defaults for function> optimset ("%NOT_A_REAL_FUNCTION_NAME%")
 %!warning <unrecognized option: foobar> optimset ("foobar", 13);
 %!warning <ambiguous option: Max> optimset ("Max", 10);
-
--- a/scripts/optimization/sqp.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/optimization/sqp.m	Wed Apr 20 17:53:10 2016 +0200
@@ -721,9 +721,9 @@
 function report (iter, qp_iter, alpha, nfun, obj)
 
   if (nargin == 0)
-    printf ("  Itn ItQP     Step  Nfun     Objective\n");
+    fprintf ("  Itn ItQP     Step  Nfun     Objective\n");
   else
-    printf ("%5d %4d %8.1g %5d %13.6e\n", iter, qp_iter, alpha, nfun, obj);
+    fprintf ("%5d %4d %8.1g %5d %13.6e\n", iter, qp_iter, alpha, nfun, obj);
   endif
 
 endfunction
--- a/scripts/pkg/pkg.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/pkg/pkg.m	Wed Apr 20 17:53:10 2016 +0200
@@ -421,8 +421,8 @@
 
     case "prefix"
       if (isempty (files) && ! nargout)
-        printf ("Installation prefix:             %s\n", prefix);
-        printf ("Architecture dependent prefix:   %s\n", archprefix);
+        fprintf ("Installation prefix:             %s\n", prefix);
+        fprintf ("Architecture dependent prefix:   %s\n", archprefix);
       elseif (isempty (files) && nargout)
         local_packages = prefix;
         global_packages = archprefix;
--- a/scripts/pkg/private/describe.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/pkg/private/describe.m	Wed Apr 20 17:53:10 2016 +0200
@@ -140,17 +140,17 @@
 
 function print_package_description (pkg_name, pkg_ver, pkg_idx_struct,
                                     pkg_desc, status, verbose)
-  printf ("---\nPackage name:\n\t%s\n", pkg_name);
-  printf ("Version:\n\t%s\n", pkg_ver);
-  printf ("Short description:\n\t%s\n", pkg_desc);
-  printf ("Status:\n\t%s\n", status);
+  fprintf ("---\nPackage name:\n\t%s\n", pkg_name);
+  fprintf ("Version:\n\t%s\n", pkg_ver);
+  fprintf ("Short description:\n\t%s\n", pkg_desc);
+  fprintf ("Status:\n\t%s\n", status);
   if (verbose)
-    printf ("---\nProvides:\n");
+    fprintf ("---\nProvides:\n");
     for i = 1:length (pkg_idx_struct)
       if (! isempty (pkg_idx_struct{i}.functions))
-        printf ("%s\n", pkg_idx_struct{i}.category);
+        fprintf ("%s\n", pkg_idx_struct{i}.category);
         for j = 1:length (pkg_idx_struct{i}.functions)
-          printf ("\t%s\n", pkg_idx_struct{i}.functions{j});
+          fprintf ("\t%s\n", pkg_idx_struct{i}.functions{j});
         endfor
       endif
     endfor
--- a/scripts/pkg/private/install.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/pkg/private/install.m	Wed Apr 20 17:53:10 2016 +0200
@@ -67,7 +67,7 @@
         tmpdir = tempname ();
         tmpdirs{end+1} = tmpdir;
         if (verbose)
-          printf ("mkdir (%s)\n", tmpdir);
+          fprintf ("mkdir (%s)\n", tmpdir);
         endif
         [status, msg] = mkdir (tmpdir);
         if (status != 1)
@@ -76,7 +76,7 @@
 
         ## Uncompress the package.
         if (verbose)
-          printf ("untar (%s, %s)\n", tgz, tmpdir);
+          fprintf ("untar (%s, %s)\n", tgz, tmpdir);
         endif
         untar (tgz, tmpdir);
 
@@ -276,9 +276,9 @@
       rmdir (descriptions{i}.dir, "s");
     endfor
     if (global_install)
-      printf ("error: couldn't append to %s\n", global_list);
+      fprintf ("error: couldn't append to %s\n", global_list);
     else
-      printf ("error: couldn't append to %s\n", local_list);
+      fprintf ("error: couldn't append to %s\n", local_list);
     endif
     rethrow (lasterror ());
   end_try_catch
@@ -296,7 +296,7 @@
   ## without creating it such as giving an invalid filename for the package
   if (exist ("desc", "var")
       && exist (fullfile (desc.dir, "packinfo", "NEWS"), "file"))
-    printf ("For information about changes from previous versions of the %s package, run 'news %s'.\n",
+    fprintf ("For information about changes from previous versions of the %s package, run 'news %s'.\n",
             desc.name, desc.name);
   endif
 endfunction
@@ -419,9 +419,9 @@
       endif
       if (! all (isspace ([archindependent{:}])))
         if (verbose)
-          printf ("copyfile");
-          printf (" %s", archindependent{:});
-          printf ("%s\n", instdir);
+          fprintf ("copyfile");
+          fprintf (" %s", archindependent{:});
+          fprintf ("%s\n", instdir);
         endif
         [status, output] = copyfile (archindependent, instdir);
         if (status != 1)
@@ -431,9 +431,9 @@
       endif
       if (! all (isspace ([archdependent{:}])))
         if (verbose)
-          printf ("copyfile");
-          printf (" %s", archdependent{:});
-          printf (" %s\n", archdir);
+          fprintf ("copyfile");
+          fprintf (" %s", archdependent{:});
+          fprintf (" %s\n", archdir);
         endif
         if (! exist (archdir, "dir"))
           mkdir (archdir);
--- a/scripts/pkg/private/installed_packages.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/pkg/private/installed_packages.m	Wed Apr 20 17:53:10 2016 +0200
@@ -93,9 +93,9 @@
     num_packages = numel (installed_pkgs_lst);
     if (num_packages == 0)
       if (isempty (pkgname))
-        printf ("no packages installed.\n");
+        fprintf ("no packages installed.\n");
       else
-        printf ("package %s is not installed.\n", pkgname{1});
+        fprintf ("package %s is not installed.\n", pkgname{1});
       endif
       return;
     endif
@@ -118,11 +118,11 @@
 
     ## Print a header.
     header = sprintf ("%s | %s | %s\n", h1, h2, h3);
-    printf (header);
+    fprintf (header);
     tmp = sprintf (repmat ("-", 1, length (header) - 1));
     tmp(length(h1)+2) = "+";
     tmp(length(h1)+length(h2)+5) = "+";
-    printf ("%s\n", tmp);
+    fprintf ("%s\n", tmp);
 
     ## Print the packages.
     format = sprintf ("%%%ds %%1s| %%%ds | %%s\n",
@@ -145,7 +145,7 @@
       else
         cur_loaded = " ";
       endif
-      printf (format, cur_name, cur_loaded, cur_version, cur_dir);
+      fprintf (format, cur_name, cur_loaded, cur_version, cur_dir);
     endfor
   endif
 endfunction
--- a/scripts/pkg/private/list_forge_packages.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/pkg/private/list_forge_packages.m	Wed Apr 20 17:53:10 2016 +0200
@@ -31,15 +31,14 @@
   endif
   if (nargout == 0)
     page_screen_output (false, "local");
-    puts ("OctaveForge provides these packages:\n");
+    fputs ("OctaveForge provides these packages:\n");
     for i = 1:length (list)
       try
         ver = get_forge_pkg (list{i});
       catch
         ver = "unknown";
       end_try_catch
-      printf ("  %s %s\n", list{i}, ver);
+      fprintf ("  %s %s\n", list{i}, ver);
     endfor
   endif
 endfunction
-
--- a/scripts/pkg/private/rebuild.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/pkg/private/rebuild.m	Wed Apr 20 17:53:10 2016 +0200
@@ -44,7 +44,7 @@
   for k = 1:length (dirlist)
     descfile = fullfile (prefix, dirlist{k}, "packinfo", "DESCRIPTION");
     if (verbose)
-      printf ("recreating package description from %s\n", dirlist{k});
+      fprintf ("recreating package description from %s\n", dirlist{k});
     endif
     if (exist (descfile, "file"))
       desc = get_description (descfile);
--- a/scripts/plot/util/__gnuplot_drawnow__.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/plot/util/__gnuplot_drawnow__.m	Wed Apr 20 17:53:10 2016 +0200
@@ -98,7 +98,7 @@
         if (a(1) == 12)
           a = a(2:end);  # avoid ^L at the beginning
         endif
-        puts (a);
+        fputs (a);
       endif
       unlink (dumb_tmp_file);
     endif
@@ -414,4 +414,3 @@
 
 ## No test needed for internal helper function.
 %!assert (1)
-
--- a/scripts/signal/stft.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/signal/stft.m	Wed Apr 20 17:53:10 2016 +0200
@@ -85,7 +85,7 @@
   ncoef = 2 * num_coef;
   if (win_size > ncoef)
     win_size = ncoef;
-    printf ("stft: window size adjusted to %f\n", win_size);
+    fprintf ("stft: window size adjusted to %f\n", win_size);
   endif
   num_win = fix ((rows (x) - win_size) / inc);
 
--- a/scripts/sparse/bicg.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/sparse/bicg.m	Wed Apr 20 17:53:10 2016 +0200
@@ -178,19 +178,19 @@
         if (res1 < tol)
           flag = 0;
           if (nargout < 2)
-            printf ("bicg converged at iteration %i ", k);
-            printf ("to a solution with relative residual %e\n", res1);
+            fprintf ("bicg converged at iteration %i ", k);
+            fprintf ("to a solution with relative residual %e\n", res1);
           endif
           break;
         endif
 
         if (res0 <= res1)
           flag = 3;
-          printf ("bicg stopped at iteration %i ", k);
-          printf ("without converging to the desired tolerance %e\n", tol);
-          printf ("because the method stagnated.\n");
-          printf ("The iterate returned (number %i) ", k-1);
-          printf ("has relative residual %e\n", res0);
+          fprintf ("bicg stopped at iteration %i ", k);
+          fprintf ("without converging to the desired tolerance %e\n", tol);
+          fprintf ("because the method stagnated.\n");
+          fprintf ("The iterate returned (number %i) ", k-1);
+          fprintf ("has relative residual %e\n", res0);
           break
         endif
         res0 = res1;
@@ -201,17 +201,17 @@
 
       if (k == maxit)
         flag = 1;
-        printf ("bicg stopped at iteration %i ", maxit);
-        printf ("without converging to the desired tolerance %e\n", tol);
-        printf ("because the maximum number of iterations was reached. ");
-        printf ("The iterate returned (number %i) has ", maxit);
-        printf ("relative residual %e\n", res1);
+        fprintf ("bicg stopped at iteration %i ", maxit);
+        fprintf ("without converging to the desired tolerance %e\n", tol);
+        fprintf ("because the maximum number of iterations was reached. ");
+        fprintf ("The iterate returned (number %i) has ", maxit);
+        fprintf ("relative residual %e\n", res1);
       endif
 
     else
       flag = 0;
       if (nargout < 2)
-        printf ("bicg converged after 0 interations\n");
+        fprintf ("bicg converged after 0 interations\n");
       endif
     endif
 
--- a/scripts/sparse/bicgstab.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/sparse/bicgstab.m	Wed Apr 20 17:53:10 2016 +0200
@@ -180,20 +180,20 @@
 
     if (nargout < 2)
       if (flag == 0)
-        printf ("bicgstab converged at iteration %i ", iter);
-        printf ("to a solution with relative residual %e\n", relres);
+        fprintf ("bicgstab converged at iteration %i ", iter);
+        fprintf ("to a solution with relative residual %e\n", relres);
       elseif (flag == 3)
-        printf ("bicgstab stopped at iteration %i ", iter);
-        printf ("without converging to the desired tolerance %e\n", tol);
-        printf ("because the method stagnated.\n");
-        printf ("The iterate returned (number %i) ", iter);
-        printf ("has relative residual %e\n", relres);
+        fprintf ("bicgstab stopped at iteration %i ", iter);
+        fprintf ("without converging to the desired tolerance %e\n", tol);
+        fprintf ("because the method stagnated.\n");
+        fprintf ("The iterate returned (number %i) ", iter);
+        fprintf ("has relative residual %e\n", relres);
       else
-        printf ("bicgstab stopped at iteration %i ", iter);
-        printf ("without converging to the desired toleranc %e\n", tol);
-        printf ("because the maximum number of iterations was reached.\n");
-        printf ("The iterate returned (number %i) ", iter);
-        printf ("has relative residual %e\n", relres);
+        fprintf ("bicgstab stopped at iteration %i ", iter);
+        fprintf ("without converging to the desired toleranc %e\n", tol);
+        fprintf ("because the maximum number of iterations was reached.\n");
+        fprintf ("The iterate returned (number %i) ", iter);
+        fprintf ("has relative residual %e\n", relres);
       endif
     endif
 
--- a/scripts/sparse/cgs.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/sparse/cgs.m	Wed Apr 20 17:53:10 2016 +0200
@@ -165,15 +165,15 @@
 
     if (nargout < 1)
       if (flag == 0)
-        printf ("cgs converged at iteration %i to a solution with relative residual %e\n",
+        fprintf ("cgs converged at iteration %i to a solution with relative residual %e\n",
                 iter, relres);
       elseif (flag == 3)
-        printf (["cgs stopped at iteration %i without converging to the desired tolerance %e\n",
+        fprintf (["cgs stopped at iteration %i without converging to the desired tolerance %e\n",
                  "because the method stagnated.\n",
                  "The iterate returned (number %i) has relative residual %e\n"],
                 iter, tol, iter, relres);
       else
-        printf (["cgs stopped at iteration %i without converging to the desired tolerance %e\n",
+        fprintf (["cgs stopped at iteration %i without converging to the desired tolerance %e\n",
                  "because the maximum number of iterations was reached.\n",
                  "The iterate returned (number %i) has relative residual %e\n"],
                 iter, tol, iter, relres);
--- a/scripts/sparse/pcg.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/sparse/pcg.m	Wed Apr 20 17:53:10 2016 +0200
@@ -395,7 +395,7 @@
 %! A = diag ([1:N]); b = rand (N, 1);
 %! y = A \ b;  # y is the true solution
 %! x = pcg (A, b);
-%! printf ("The solution relative error is %g\n", norm (x - y) / norm (y));
+%! fprintf ("The solution relative error is %g\n", norm (x - y) / norm (y));
 %!
 %! ## You shouldn't be afraid if pcg issues some warning messages in this
 %! ## example: watch out in the second example, why it takes N iterations
@@ -409,7 +409,7 @@
 %! A = diag ([1:N]); b = rand (N, 1);
 %! X = A \ b;  # X is the true solution
 %! [x, flag, relres, iter, resvec] = pcg (A, b);
-%! printf ("The solution relative error is %g\n", norm (x - X) / norm (X));
+%! fprintf ("The solution relative error is %g\n", norm (x - X) / norm (X));
 %! title ("Convergence history");
 %! semilogy ([0:iter], resvec / resvec(1), "o-g");
 %! xlabel ("Iteration"); ylabel ("log(||b-Ax||/||b||)");
@@ -423,9 +423,9 @@
 %! A = hilb (N); b = rand (N, 1);
 %! X = A \ b;  # X is the true solution
 %! [x, flag, relres, iter, resvec, eigest] = pcg (A, b, [], 200);
-%! printf ("The solution relative error is %g\n", norm (x - X) / norm (X));
-%! printf ("Condition number estimate is %g\n", eigest(2) / eigest(1));
-%! printf ("Actual condition number is   %g\n", cond (A));
+%! fprintf ("The solution relative error is %g\n", norm (x - X) / norm (X));
+%! fprintf ("Condition number estimate is %g\n", eigest(2) / eigest(1));
+%! fprintf ("Actual condition number is   %g\n", cond (A));
 %! title ("Convergence history");
 %! semilogy ([0:iter], resvec, ["o-g";"+-r"]);
 %! xlabel ("Iteration"); ylabel ("log(||b-Ax||)");
@@ -446,11 +446,11 @@
 %! b = rand (N, 1);
 %! X = A \ b;  # X is the true solution
 %! maxit = 80;
-%! printf ("System condition number is %g\n", cond (A));
+%! fprintf ("System condition number is %g\n", cond (A));
 %! ## No preconditioner: the convergence is very slow!
 %!
 %! [x, flag, relres, iter, resvec, eigest] = pcg (A, b, [], maxit);
-%! printf ("System condition number estimate is %g\n", eigest(2) / eigest(1));
+%! fprintf ("System condition number estimate is %g\n", eigest(2) / eigest(1));
 %! title ("Convergence history");
 %! semilogy ([0:iter], resvec(:,1), "o-g");
 %! xlabel ("Iteration"); ylabel ("log(||b-Ax||)");
@@ -461,7 +461,7 @@
 %!
 %! M = diag (diag (A)); # Jacobi preconditioner
 %! [x, flag, relres, iter, resvec, eigest] = pcg (A, b, [], maxit, M);
-%! printf ("JACOBI preconditioned system condition number estimate is %g\n", eigest(2) / eigest(1));
+%! fprintf ("JACOBI preconditioned system condition number estimate is %g\n", eigest(2) / eigest(1));
 %! hold on;
 %! semilogy ([0:iter], resvec(:,1), "o-r");
 %! legend ("NO preconditioning: absolute residual", ...
@@ -475,7 +475,7 @@
 %!   M(i:i+k-1, i:i+k-1) = A(i:i+k-1, i:i+k-1);
 %! endfor
 %! [x, flag, relres, iter, resvec, eigest] = pcg (A, b, [], maxit, M);
-%! printf ("BLOCK JACOBI preconditioned system condition number estimate is %g\n", eigest(2) / eigest(1));
+%! fprintf ("BLOCK JACOBI preconditioned system condition number estimate is %g\n", eigest(2) / eigest(1));
 %! semilogy ([0:iter], resvec(:,1), "o-b");
 %! legend ("NO preconditioning: absolute residual", ...
 %!         "JACOBI preconditioner: absolute residual", ...
--- a/scripts/sparse/pcr.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/sparse/pcr.m	Wed Apr 20 17:53:10 2016 +0200
@@ -312,7 +312,7 @@
 %! A = diag (linspace (-3.1,3,N)); b = rand (N,1);
 %! y = A \ b;  # y is the true solution
 %! x = pcr (A,b);
-%! printf ("The solution relative error is %g\n", norm (x-y) / norm (y));
+%! fprintf ("The solution relative error is %g\n", norm (x-y) / norm (y));
 %!
 %! ## You shouldn't be afraid if PCR issues some warning messages in this
 %! ## example: watch out in the second example, why it takes N iterations
@@ -326,7 +326,7 @@
 %! A = diag (linspace (-3.1,30,N)); b = rand (N,1);
 %! X = A \ b;  # X is the true solution
 %! [x, flag, relres, iter, resvec] = pcr (A,b);
-%! printf ("The solution relative error is %g\n", norm (x-X) / norm (X));
+%! fprintf ("The solution relative error is %g\n", norm (x-X) / norm (X));
 %! clf;
 %! title ("Convergence history");
 %! xlabel ("Iteration"); ylabel ("log(||b-Ax||/||b||)");
@@ -342,10 +342,10 @@
 %! N = 10;
 %! A = hilb (N); A(1,1) = -A(1,1); b = rand (N,1);
 %! X = A \ b;  # X is the true solution
-%! printf ("Condition number of A is   %g\n", cond (A));
+%! fprintf ("Condition number of A is   %g\n", cond (A));
 %! [x, flag, relres, iter, resvec] = pcr (A,b,[],200);
 %! if (flag == 3)
-%!   printf ("PCR breakdown.  System matrix is [close to] singular\n");
+%!   fprintf ("PCR breakdown.  System matrix is [close to] singular\n");
 %! end
 %! clf;
 %! title ("Convergence history");
@@ -371,7 +371,7 @@
 %! b = rand (2*N,1);
 %! X = A \ b;  # X is the true solution
 %! maxit = 80;
-%! printf ("System condition number is %g\n", cond (A));
+%! fprintf ("System condition number is %g\n", cond (A));
 %! ## No preconditioner: the convergence is very slow!
 %!
 %! [x, flag, relres, iter, resvec] = pcr (A,b,[],maxit);
--- a/scripts/sparse/qmr.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/sparse/qmr.m	Wed Apr 20 17:53:10 2016 +0200
@@ -242,23 +242,23 @@
     relres = res1;
     if (flag == 1)
       if (nargout < 2)
-        printf ("qmr stopped at iteration %i ", iter);
-        printf ("without converging to the desired tolerance %e\n", tol);
-        printf ("because the maximum number of iterations was reached. ");
-        printf ("The iterate returned (number %i) has ", maxit);
-        printf ("relative residual %e\n", res1);
+        fprintf ("qmr stopped at iteration %i ", iter);
+        fprintf ("without converging to the desired tolerance %e\n", tol);
+        fprintf ("because the maximum number of iterations was reached. ");
+        fprintf ("The iterate returned (number %i) has ", maxit);
+        fprintf ("relative residual %e\n", res1);
       endif
     elseif (flag == 3)
       if (nargout < 2)
-        printf ("qmr stopped at iteration %i ", iter);
-        printf (" without converging to the desired tolerance %e\n", tol);
-        printf ("because the method stagnated.\n");
-        printf ("The iterate returned (number %i) ", iter);
-        printf ("has relative residual %e\n", res1);
+        fprintf ("qmr stopped at iteration %i ", iter);
+        fprintf (" without converging to the desired tolerance %e\n", tol);
+        fprintf ("because the method stagnated.\n");
+        fprintf ("The iterate returned (number %i) ", iter);
+        fprintf ("has relative residual %e\n", res1);
       endif
     elseif (nargout < 2)
-      printf ("qmr converged at iteration %i ", iter);
-      printf ("to a solution with relative residual %e\n", res1);
+      fprintf ("qmr converged at iteration %i ", iter);
+      fprintf ("to a solution with relative residual %e\n", res1);
     endif
   else
     print usage();
--- a/scripts/statistics/models/logistic_regression.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/models/logistic_regression.m	Wed Apr 20 17:53:10 2016 +0200
@@ -161,21 +161,21 @@
   beta  = tb((nz + 1) : (nz + nx), 1);
 
   if (print >= 1)
-    printf ("\n");
-    printf ("Logistic Regression Results:\n");
-    printf ("\n");
-    printf ("Number of Iterations: %d\n", iter);
-    printf ("Deviance:             %f\n", dev);
-    printf ("Parameter Estimates:\n");
-    printf ("     Theta         S.E.\n");
+    fprintf ("\n");
+    fprintf ("Logistic Regression Results:\n");
+    fprintf ("\n");
+    fprintf ("Number of Iterations: %d\n", iter);
+    fprintf ("Deviance:             %f\n", dev);
+    fprintf ("Parameter Estimates:\n");
+    fprintf ("     Theta         S.E.\n");
     se = sqrt (diag (inv (-d2l)));
     for i = 1 : nz
-      printf ("   %8.4f     %8.4f\n", tb (i), se (i));
+      fprintf ("   %8.4f     %8.4f\n", tb (i), se (i));
     endfor
     if (nx > 0)
-      printf ("      Beta         S.E.\n");
+      fprintf ("      Beta         S.E.\n");
       for i = (nz + 1) : (nz + nx)
-        printf ("   %8.4f     %8.4f\n", tb (i), se (i));
+        fprintf ("   %8.4f     %8.4f\n", tb (i), se (i));
       endfor
     endif
   endif
--- a/scripts/statistics/tests/anova.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/anova.m	Wed Apr 20 17:53:10 2016 +0200
@@ -93,19 +93,19 @@
 
   if (nargout == 0)
     ## This eventually needs to be done more cleanly ...
-    printf ("\n");
-    printf ("One-way ANOVA Table:\n");
-    printf ("\n");
-    printf ("Source of Variation   Sum of Squares    df  Empirical Var\n");
-    printf ("*********************************************************\n");
-    printf ("Between Groups       %15.4f  %4d  %13.4f\n", SSB, df_b, v_b);
-    printf ("Within Groups        %15.4f  %4d  %13.4f\n", SSW, df_w, v_w);
-    printf ("---------------------------------------------------------\n");
-    printf ("Total                %15.4f  %4d\n", SST, n - 1);
-    printf ("\n");
-    printf ("Test Statistic f     %15.4f\n", f);
-    printf ("p-value              %15.4f\n", pval);
-    printf ("\n");
+    fprintf ("\n");
+    fprintf ("One-way ANOVA Table:\n");
+    fprintf ("\n");
+    fprintf ("Source of Variation   Sum of Squares    df  Empirical Var\n");
+    fprintf ("*********************************************************\n");
+    fprintf ("Between Groups       %15.4f  %4d  %13.4f\n", SSB, df_b, v_b);
+    fprintf ("Within Groups        %15.4f  %4d  %13.4f\n", SSW, df_w, v_w);
+    fprintf ("---------------------------------------------------------\n");
+    fprintf ("Total                %15.4f  %4d\n", SST, n - 1);
+    fprintf ("\n");
+    fprintf ("Test Statistic f     %15.4f\n", f);
+    fprintf ("p-value              %15.4f\n", pval);
+    fprintf ("\n");
   endif
 
 endfunction
--- a/scripts/statistics/tests/bartlett_test.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/bartlett_test.m	Wed Apr 20 17:53:10 2016 +0200
@@ -61,7 +61,7 @@
   pval  = 1 - chi2cdf (chisq, df);
 
   if (nargout == 0)
-    printf ("  pval: %g\n", pval);
+    fprintf ("  pval: %g\n", pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/chisquare_test_homogeneity.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/chisquare_test_homogeneity.m	Wed Apr 20 17:53:10 2016 +0200
@@ -62,7 +62,7 @@
   pval  = 1 - chi2cdf (chisq, df);
 
   if (nargout == 0)
-    printf ("  pval: %g\n", pval);
+    fprintf ("  pval: %g\n", pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/chisquare_test_independence.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/chisquare_test_independence.m	Wed Apr 20 17:53:10 2016 +0200
@@ -48,7 +48,7 @@
   pval = 1 - chi2cdf (chisq, df);
 
   if (nargout == 0)
-    printf ("  pval: %g\n", pval);
+    fprintf ("  pval: %g\n", pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/cor_test.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/cor_test.m	Wed Apr 20 17:53:10 2016 +0200
@@ -129,7 +129,7 @@
   t.alternative = alt;
 
   if (nargout == 0)
-    printf ("pval: %g\n", t.pval);
+    fprintf ("pval: %g\n", t.pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/f_test_regression.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/f_test_regression.m	Wed Apr 20 17:53:10 2016 +0200
@@ -71,7 +71,7 @@
   pval   = 1 - fcdf (f, df_num, df_den);
 
   if (nargout == 0)
-    printf ("  pval: %g\n", pval);
+    fprintf ("  pval: %g\n", pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/hotelling_test.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/hotelling_test.m	Wed Apr 20 17:53:10 2016 +0200
@@ -66,7 +66,7 @@
   pval = 1 - fcdf ((n-p) * Tsq / (p * (n-1)), p, n-p);
 
   if (nargout == 0)
-    printf ("  pval: %g\n", pval);
+    fprintf ("  pval: %g\n", pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/hotelling_test_2.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/hotelling_test_2.m	Wed Apr 20 17:53:10 2016 +0200
@@ -80,7 +80,7 @@
                     p, n_x + n_y - p - 1);
 
   if (nargout == 0)
-    printf ("  pval: %g\n", pval);
+    fprintf ("  pval: %g\n", pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/kolmogorov_smirnov_test.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/kolmogorov_smirnov_test.m	Wed Apr 20 17:53:10 2016 +0200
@@ -106,7 +106,7 @@
   endif
 
   if (nargout == 0)
-    printf ("pval: %g\n", pval);
+    fprintf ("pval: %g\n", pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/kolmogorov_smirnov_test_2.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/kolmogorov_smirnov_test_2.m	Wed Apr 20 17:53:10 2016 +0200
@@ -98,7 +98,7 @@
   endif
 
   if (nargout == 0)
-    printf ("  pval: %g\n", pval);
+    fprintf ("  pval: %g\n", pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/kruskal_wallis_test.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/kruskal_wallis_test.m	Wed Apr 20 17:53:10 2016 +0200
@@ -89,7 +89,7 @@
   pval = 1 - chi2cdf (k, df);
 
   if (nargout == 0)
-    printf ("pval: %g\n", pval);
+    fprintf ("pval: %g\n", pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/manova.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/manova.m	Wed Apr 20 17:53:10 2016 +0200
@@ -136,30 +136,30 @@
     df_den = theta * (2 * v + theta + 1);
     PB_pval = 1 - fcdf (PB * df_den / df_num, df_num, df_den);
 
-    printf ("\n");
-    printf ("One-way MANOVA Table:\n");
-    printf ("\n");
-    printf ("Test             Test Statistic      Approximate p\n");
-    printf ("**************************************************\n");
-    printf ("Wilks            %10.4f           %10.9f \n", Lambda, W_pval_1);
-    printf ("                                      %10.9f \n", W_pval_2);
-    printf ("Hotelling-Lawley %10.4f           %10.9f \n", HL, HL_pval);
-    printf ("Pillai-Bartlett  %10.4f           %10.9f \n", PB, PB_pval);
-    printf ("\n");
+    fprintf ("\n");
+    fprintf ("One-way MANOVA Table:\n");
+    fprintf ("\n");
+    fprintf ("Test             Test Statistic      Approximate p\n");
+    fprintf ("**************************************************\n");
+    fprintf ("Wilks            %10.4f           %10.9f \n", Lambda, W_pval_1);
+    fprintf ("                                      %10.9f \n", W_pval_2);
+    fprintf ("Hotelling-Lawley %10.4f           %10.9f \n", HL, HL_pval);
+    fprintf ("Pillai-Bartlett  %10.4f           %10.9f \n", PB, PB_pval);
+    fprintf ("\n");
 
   endif
 
-  printf ("\n");
-  printf ("MANOVA Results:\n");
-  printf ("\n");
-  printf ("# of groups:    %d\n", k);
-  printf ("# of samples:   %d\n", n);
-  printf ("# of variables: %d\n", p);
-  printf ("\n");
-  printf ("Wilks' Lambda:  %5.4f\n", Lambda);
-  printf ("Approximate p:  %10.9f (chisquare approximation)\n", W_pval_1);
-  printf ("                 %10.9f (F approximation)\n", W_pval_2);
-  printf ("\n");
+  fprintf ("\n");
+  fprintf ("MANOVA Results:\n");
+  fprintf ("\n");
+  fprintf ("# of groups:    %d\n", k);
+  fprintf ("# of samples:   %d\n", n);
+  fprintf ("# of variables: %d\n", p);
+  fprintf ("\n");
+  fprintf ("Wilks' Lambda:  %5.4f\n", Lambda);
+  fprintf ("Approximate p:  %10.9f (chisquare approximation)\n", W_pval_1);
+  fprintf ("                 %10.9f (F approximation)\n", W_pval_2);
+  fprintf ("\n");
 
 endfunction
 
--- a/scripts/statistics/tests/mcnemar_test.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/mcnemar_test.m	Wed Apr 20 17:53:10 2016 +0200
@@ -58,7 +58,7 @@
   pval = 1 - chi2cdf (chisq, df);
 
   if (nargout == 0)
-    printf ("  pval: %g\n", pval);
+    fprintf ("  pval: %g\n", pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/prop_test_2.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/prop_test_2.m	Wed Apr 20 17:53:10 2016 +0200
@@ -75,7 +75,7 @@
   endif
 
   if (nargout == 0)
-    printf ("  pval: %g\n", pval);
+    fprintf ("  pval: %g\n", pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/run_test.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/run_test.m	Wed Apr 20 17:53:10 2016 +0200
@@ -54,7 +54,7 @@
   pval  = chi2cdf (chisq, 6);
 
   if (nargout == 0)
-    printf ("pval: %g\n", pval);
+    fprintf ("pval: %g\n", pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/sign_test.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/sign_test.m	Wed Apr 20 17:53:10 2016 +0200
@@ -78,7 +78,7 @@
   endif
 
   if (nargout == 0)
-    printf ("  pval: %g\n", pval);
+    fprintf ("  pval: %g\n", pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/t_test.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/t_test.m	Wed Apr 20 17:53:10 2016 +0200
@@ -77,7 +77,7 @@
   endif
 
   if (nargout == 0)
-    printf ("  pval: %g\n", pval);
+    fprintf ("  pval: %g\n", pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/t_test_2.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/t_test_2.m	Wed Apr 20 17:53:10 2016 +0200
@@ -78,7 +78,7 @@
   endif
 
   if (nargout == 0)
-    printf ("  pval: %g\n", pval);
+    fprintf ("  pval: %g\n", pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/t_test_regression.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/t_test_regression.m	Wed Apr 20 17:53:10 2016 +0200
@@ -92,7 +92,7 @@
   endif
 
   if (nargout == 0)
-    printf ("pval: %g\n", pval);
+    fprintf ("pval: %g\n", pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/u_test.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/u_test.m	Wed Apr 20 17:53:10 2016 +0200
@@ -81,7 +81,7 @@
   endif
 
   if (nargout == 0)
-    printf ("  pval: %g\n", pval);
+    fprintf ("  pval: %g\n", pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/var_test.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/var_test.m	Wed Apr 20 17:53:10 2016 +0200
@@ -74,7 +74,7 @@
   endif
 
   if (nargout == 0)
-    printf ("pval: %g\n", pval);
+    fprintf ("pval: %g\n", pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/welch_test.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/welch_test.m	Wed Apr 20 17:53:10 2016 +0200
@@ -80,7 +80,7 @@
   endif
 
   if (nargout == 0)
-    printf ("  pval: %g\n", pval);
+    fprintf ("  pval: %g\n", pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/wilcoxon_test.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/wilcoxon_test.m	Wed Apr 20 17:53:10 2016 +0200
@@ -87,7 +87,7 @@
   endif
 
   if (nargout == 0)
-    printf ("  pval: %g\n", pval);
+    fprintf ("  pval: %g\n", pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/z_test.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/z_test.m	Wed Apr 20 17:53:10 2016 +0200
@@ -83,7 +83,7 @@
     s = ["Z-test of mean(x) == %g against mean(x) %s %g,\n", ...
          "with known var(x) == %g:\n",                       ...
          "  pval = %g\n"];
-    printf (s, m, alt, m, v, pval);
+    fprintf (s, m, alt, m, v, pval);
   endif
 
 endfunction
--- a/scripts/statistics/tests/z_test_2.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/statistics/tests/z_test_2.m	Wed Apr 20 17:53:10 2016 +0200
@@ -84,7 +84,7 @@
          "mean(x) %s mean(y),\n",                            ...
          "with known var(x) == %g and var(y) == %g:\n",      ...
          "  pval = %g\n"];
-    printf (s, alt, v_x, v_y, pval);
+    fprintf (s, alt, v_x, v_y, pval);
   endif
 
 endfunction
--- a/scripts/strings/strtok.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/strings/strtok.m	Wed Apr 20 17:53:10 2016 +0200
@@ -145,13 +145,13 @@
 %! s = "14*27+31"
 %! while (1)
 %!   [t, s] = strtok (s, "+-*/");
-%!   printf ("<%s>", t);
+%!   fprintf ("<%s>", t);
 %!   if (isempty (s))
 %!     break;
 %!   endif
-%!   printf ("<%s>", s(1));
+%!   fprintf ("<%s>", s(1));
 %! endwhile
-%! printf ("\n");
+%! fprintf ("\n");
 %! % ----------------------------------------------------
 %! % Demonstrates processing of an entire string split on
 %! % a variety of delimiters.  Tokens and delimiters are
--- a/scripts/testfun/__run_test_suite__.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/testfun/__run_test_suite__.m	Wed Apr 20 17:53:10 2016 +0200
@@ -54,7 +54,7 @@
       endif
       test ("", "explain", fid);
       dp = dn = dxf = dsk = 0;
-      puts ("\nIntegrated test scripts:\n\n");
+      fputs ("\nIntegrated test scripts:\n\n");
       for i = 1:length (fcndirs)
         [p, n, xf, sk] = run_test_script (fid, fcndirs{i});
         dp += p;
@@ -62,7 +62,7 @@
         dxf += xf;
         dsk += sk;
       endfor
-      puts ("\nFixed test scripts:\n\n");
+      fputs ("\nFixed test scripts:\n\n");
       for i = 1:length (fixedtestdirs)
         [p, n, xf, sk] = run_test_dir (fid, fixedtestdirs{i});
         dp += p;
@@ -70,30 +70,30 @@
         dxf += xf;
         dsk += sk;
       endfor
-      puts ("\nSummary:\n\n");
+      fputs ("\nSummary:\n\n");
       nfail = dn - dp - dxf;
-      printf ("  PASS    %6d\n", dp);
-      printf ("  FAIL    %6d\n", nfail);
+      fprintf ("  PASS    %6d\n", dp);
+      fprintf ("  FAIL    %6d\n", nfail);
       if (dxf > 0)
-        printf ("  XFAIL   %6d\n", dxf);
+        fprintf ("  XFAIL   %6d\n", dxf);
       endif
       if (dsk > 0)
-        printf ("  SKIPPED %6d\n", dsk);
+        fprintf ("  SKIPPED %6d\n", dsk);
       endif
-      puts ("\n");
-      printf ("See the file %s for additional details.\n", logfile);
+      fputs ("\n");
+      fprintf ("See the file %s for additional details.\n", logfile);
       if (dxf > 0)
-        puts ("\n");
-        puts ("Expected failures (listed as XFAIL above) are known bugs.\n");
-        puts ("Please help improve Octave by contributing fixes for them.\n");
+        fputs ("\n");
+        fputs ("Expected failures (listed as XFAIL above) are known bugs.\n");
+        fputs ("Please help improve Octave by contributing fixes for them.\n");
       endif
       if (dsk > 0)
-        puts ("\n");
-        puts ("Tests are most often skipped because the features they require\n");
-        puts ("have been disabled.  Features are most often disabled because\n");
-        puts ("they require dependencies that were not present when Octave\n");
-        puts ("was built.  The configure script should have printed a summary\n");
-        puts ("at the end of its run indicating which dependencies were not found.\n");
+        fputs ("\n");
+        fputs ("Tests are most often skipped because the features they require\n");
+        fputs ("have been disabled.  Features are most often disabled because\n");
+        fputs ("they require dependencies that were not present when Octave\n");
+        fputs ("was built.  The configure script should have printed a summary\n");
+        fputs ("at the end of its run indicating which dependencies were not found.\n");
       endif
 
       ## Weed out deprecated and private functions
@@ -104,8 +104,8 @@
 
       report_files_with_no_tests (files_with_tests, files_with_no_tests, ".m");
 
-      puts ("\nPlease help improve Octave by contributing tests for these files\n");
-      printf ("(see the list in the file %s).\n\n", logfile);
+      fputs ("\nPlease help improve Octave by contributing tests for these files\n");
+      fprintf ("(see the list in the file %s).\n\n", logfile);
 
       fprintf (fid, "\nFiles with no tests:\n\n%s",
                     list_in_columns (files_with_no_tests, 80));
@@ -130,24 +130,24 @@
 
 function print_test_file_name (nm)
   filler = repmat (".", 1, 60-length (nm));
-  printf ("  %s %s", nm, filler);
+  fprintf ("  %s %s", nm, filler);
 endfunction
 
 function print_pass_fail (p, n, xf, sk)
   if ((n + sk) > 0)
-    printf (" PASS   %4d/%-4d", p, n);
+    fprintf (" PASS   %4d/%-4d", p, n);
     nfail = n - p - xf;
     if (nfail > 0)
-      printf ("\n%71s %3d", "FAIL ", nfail);
+      fprintf ("\n%71s %3d", "FAIL ", nfail);
     endif
     if (sk > 0)
-      printf ("\n%71s %3d", "SKIP ", sk);
+      fprintf ("\n%71s %3d", "SKIP ", sk);
     endif
     if (xf > 0)
-      printf ("\n%71s %3d", "XFAIL", xf);
+      fprintf ("\n%71s %3d", "XFAIL", xf);
     endif
   endif
-  puts ("\n");
+  fputs ("\n");
 endfunction
 
 function retval = has_functions (f)
@@ -273,7 +273,7 @@
       endif
     endif
   endfor
-  ##  printf("%s%s -> passes %d of %d tests\n", ident, d, dp, dn);
+  ##  fprintf("%s%s -> passes %d of %d tests\n", ident, d, dp, dn);
 endfunction
 
 function n = num_elts_matching_pattern (lst, pat)
@@ -285,10 +285,9 @@
   n_with = num_elts_matching_pattern (with, pat);
   n_without = num_elts_matching_pattern (without, pat);
   n_tot = n_with + n_without;
-  printf ("\n%d (of %d) %s files have no tests.\n", n_without, n_tot, typ);
+  fprintf ("\n%d (of %d) %s files have no tests.\n", n_without, n_tot, typ);
 endfunction
 
 
 ## No test coverage for internal function.  It is tested through calling fcn.
 %!assert (1)
-
--- a/scripts/testfun/demo.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/testfun/demo.m	Wed Apr 20 17:53:10 2016 +0200
@@ -138,11 +138,11 @@
       ## Use an environment without variables
       eval (["function __demo__ ()\n" block "\nendfunction"]);
       ## Display the code that will be executed before executing it
-      printf ("%s example %d:%s\n\n", name, doidx(i), block);
+      fprintf ("%s example %d:%s\n\n", name, doidx(i), block);
       __demo__;
     catch
       ## Let the programmer know which demo failed.
-      printf ("%s example %d: failed\n%s\n", name, doidx(i), lasterr ());
+      fprintf ("%s example %d: failed\n%s\n", name, doidx(i), lasterr ());
     end_try_catch
     clear __demo__;
   endfor
--- a/scripts/testfun/example.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/testfun/example.m	Wed Apr 20 17:53:10 2016 +0200
@@ -86,7 +86,7 @@
 
     for i = 1:length (doidx)
       block = code(idx(doidx(i)):idx(doidx(i)+1)-1);
-      printf ("%s example %d:%s\n\n", name, doidx(i), block);
+      fprintf ("%s example %d:%s\n\n", name, doidx(i), block);
     endfor
   endif
 
--- a/scripts/testfun/private/compare_plot_demos.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/testfun/private/compare_plot_demos.m	Wed Apr 20 17:53:10 2016 +0200
@@ -98,7 +98,7 @@
         try
           eval (fcn_name);
         catch
-          printf ("Error running plot demos for ""%s"" toolkit\n",
+          fprintf ("Error running plot demos for ""%s"" toolkit\n",
                   arg.toolkits{n});
           disp (lasterror);
         end_try_catch
@@ -113,8 +113,8 @@
     html_compare_plot_demos (arg.toolkits);
   else
     ## We need to run matlab manually before the html page can be created
-    printf ('\nNow run %s in Matlab.\nAfter this run html_compare_plot_demos,\n', arg.fcn_file);
-    printf ('for example html_compare_plot_demos ({"fltk", "gnuplot", "matlab"}), to create the html page.\n');
+    fprintf ('\nNow run %s in Matlab.\nAfter this run html_compare_plot_demos,\n', arg.fcn_file);
+    fprintf ('for example html_compare_plot_demos ({"fltk", "gnuplot", "matlab"}), to create the html page.\n');
   endif
 endfunction
 
--- a/scripts/testfun/rundemos.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/testfun/rundemos.m	Wed Apr 20 17:53:10 2016 +0200
@@ -73,7 +73,7 @@
         try
           demo (f);
         catch
-          printf ("error: %s\n\n", lasterror ().message);
+          fprintf ("error: %s\n\n", lasterror ().message);
         end_try_catch
         if (i != numel (flist))
           input ("Press <enter> to continue: ", "s");
--- a/scripts/testfun/runtests.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/testfun/runtests.m	Wed Apr 20 17:53:10 2016 +0200
@@ -65,7 +65,7 @@
   flist = readdir (directory);
   dirs = {};
   no_tests = {};
-  printf ("Processing files in %s:\n\n", directory);
+  fprintf ("Processing files in %s:\n\n", directory);
   fflush (stdout);
   for i = 1:numel (flist)
     f = flist{i};
@@ -88,8 +88,8 @@
     endif
   endfor
   if (! isempty (no_tests))
-    printf ("\nThe following files in %s have no tests:\n\n", directory);
-    printf ("%s", list_in_columns (no_tests));
+    fprintf ("\nThe following files in %s have no tests:\n\n", directory);
+    fprintf ("%s", list_in_columns (no_tests));
   endif
 
   ## Recurse into class directories since they are implied in the path
@@ -134,25 +134,24 @@
 
 function print_pass_fail (n, p, xf)
   if (n > 0)
-    printf (" PASS %4d/%-4d", p, n);
+    fprintf (" PASS %4d/%-4d", p, n);
     nfail = n - p;
     if (nfail > 0)
       if (nfail != xf)
-        printf (" FAIL %d", nfail - xf);
+        fprintf (" FAIL %d", nfail - xf);
       else
-        printf (" XFAIL %d", xf);
+        fprintf (" XFAIL %d", xf);
       endif
     endif
   endif
-  puts ("\n");
+  fputs ("\n");
 endfunction
 
 function print_test_file_name (nm)
   filler = repmat (".", 1, 55-length (nm));
-  printf ("  %s %s", nm, filler);
+  fprintf ("  %s %s", nm, filler);
 endfunction
 
 
 %!error runtests ("foo", 1)
 %!error <DIRECTORY argument> runtests ("#_TOTALLY_/_INVALID_/_PATHNAME_#")
-
--- a/scripts/testfun/speed.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/testfun/speed.m	Wed Apr 20 17:53:10 2016 +0200
@@ -211,7 +211,7 @@
     eval (__init);
 
     if (do_display)
-      printf ("n%i = %i  ", k, n);
+      fprintf ("n%i = %i  ", k, n);
       fflush (stdout);
     endif
 
@@ -301,7 +301,7 @@
     ylabel ("best execution time (ms)");
 
     ratio = mean (__torig ./ __tnew);
-    printf ("\n\nMean runtime ratio = %.3g for '%s' vs '%s'\n",
+    fprintf ("\n\nMean runtime ratio = %.3g for '%s' vs '%s'\n",
             ratio, __f2, __f1);
 
   endif
@@ -337,9 +337,9 @@
     endif
 
     ## Display nicely formatted complexity.
-    printf ("\nFor %s:\n", __f1);
-    printf ("  asymptotic power: %s\n", order);
-    printf ("  approximate time per operation: %s\n", time);
+    fprintf ("\nFor %s:\n", __f1);
+    fprintf ("  asymptotic power: %s\n", order);
+    fprintf ("  approximate time per operation: %s\n", time);
 
   endif
 
--- a/scripts/testfun/test.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/testfun/test.m	Wed Apr 20 17:53:10 2016 +0200
@@ -651,19 +651,19 @@
   if (nargout == 0)
     if (__tests || __xfail || __xskip)
       if (__xfail)
-        printf ("PASSES %d out of %d test%s (%d expected failure%s)\n",
+        fprintf ("PASSES %d out of %d test%s (%d expected failure%s)\n",
                 __successes, __tests, ifelse (__tests > 1, "s", ""),
                 __xfail, ifelse (__xfail > 1, "s", ""));
       else
-        printf ("PASSES %d out of %d test%s\n", __successes, __tests,
+        fprintf ("PASSES %d out of %d test%s\n", __successes, __tests,
                ifelse (__tests > 1, "s", ""));
       endif
       if (__xskip)
-        printf ("Skipped %d test%s due to missing features\n", __xskip,
+        fprintf ("Skipped %d test%s due to missing features\n", __xskip,
                 ifelse (__xskip > 1, "s", ""));
       endif
     else
-      printf ("%s%s has no tests available\n", __signal_empty, __file);
+      fprintf ("%s%s has no tests available\n", __signal_empty, __file);
     endif
   elseif (__grabdemo)
     __n    = __demo_code;
--- a/scripts/time/calendar.m	Wed Apr 20 09:19:06 2016 +0200
+++ b/scripts/time/calendar.m	Wed Apr 20 17:53:10 2016 +0200
@@ -80,9 +80,9 @@
     ## Display the calendar.
     s.year = y - 1900;
     s.mon = m - 1;
-    puts (strftime ("                    %b %Y\n", s));
-    puts ("     S     M    Tu     W    Th     F     S\n");
-    puts (str);
+    fputs (strftime ("                    %b %Y\n", s));
+    fputs ("     S     M    Tu     W    Th     F     S\n");
+    fputs (str);
   endif
 
 endfunction
@@ -101,4 +101,3 @@
 
 ## Test input validation
 %!error calendar (1,2,3)
-
--- a/test/io.tst	Wed Apr 20 09:19:06 2016 +0200
+++ b/test/io.tst	Wed Apr 20 17:53:10 2016 +0200
@@ -262,17 +262,6 @@
 
 %!error <unable to find file> load ("")
 
-%% FIXME: This test is disabled as it writes to stdout and there is no easy
-%% way to recover output.  Need to spawn new octave process and pipe stdout
-%% somewhere to treat this case.
-%!#test
-%! puts ("foo\n");
-
-%!assert (puts (1),-1)
-
-%!error <Invalid call to puts> puts ()
-%!error <Invalid call to puts> puts (1, 2)
-
 %!assert (sscanf ('123456', '%10c'), '123456')
 %!assert (sscanf ('123456', '%10s'), '123456')
 
@@ -335,8 +324,8 @@
 %! assert (x, 8);
 %! assert (str, "test:1");
 
-%!error printf (1)
-%!error <Invalid call to printf> printf ()
+%!error fprintf (1)
+%!error <Invalid call to fprintf> fprintf ()
 
 %!test
 %! [s, msg, status] = sprintf ("%s: %d\n", "test", 1);
@@ -516,11 +505,6 @@
 %! endif
 %! unlink (nm);
 
-%!assert (fputs (1, 1),-1)
-
-%!error <Invalid call to fputs> fputs ()
-%!error <Invalid call to fputs> fputs (1, "foo", 1)
-
 %!error fgetl ("foo", 1)
 
 %!error <Invalid call to fgetl> fgetl ()