changeset 18673:1dcc9539234c

Fix bug with input() and nargout==0 (bug #42111). * input.cc (Finput): Call get_user_input() to produce at least 1 output.
author Rik <rik@octave.org>
date Thu, 24 Apr 2014 14:03:46 -0700
parents 78fac67300e8
children 5bd1ca29c5f0
files libinterp/corefcn/input.cc
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/input.cc	Thu Apr 24 08:41:30 2014 -0700
+++ b/libinterp/corefcn/input.cc	Thu Apr 24 14:03:46 2014 -0700
@@ -748,10 +748,10 @@
 @noindent\n\
 and waits for the user to enter a value.  The string entered by the user\n\
 is evaluated as an expression, so it may be a literal constant, a\n\
-variable name, or any other valid expression.\n\
+variable name, or any other valid Octave code.\n\
 \n\
-Currently, @code{input} only returns one value, regardless of the number\n\
-of values produced by the evaluation of the expression.\n\
+The number of return arguments, their size, and their class depend on the\n\
+expression entered.\n\
 \n\
 If you are only interested in getting a literal string value, you can\n\
 call @code{input} with the character string @qcode{\"s\"} as the second\n\
@@ -762,7 +762,7 @@
 a good idea to always call @code{fflush (stdout)} before calling\n\
 @code{input}.  This will ensure that all pending output is written to\n\
 the screen before your prompt.\n\
-@seealso{yes_or_no, kbhit}\n\
+@seealso{yes_or_no, kbhit, pause}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -770,7 +770,7 @@
   int nargin = args.length ();
 
   if (nargin == 1 || nargin == 2)
-    retval = get_user_input (args, nargout);
+    retval = get_user_input (args, std::max (nargout, 1));
   else
     print_usage ();