# HG changeset patch # User Rik # Date 1398373426 25200 # Node ID 1dcc9539234cff9fb9b683135565bb4c0e2fbcf3 # Parent 78fac67300e86817e46e296a23739313dce28072 Fix bug with input() and nargout==0 (bug #42111). * input.cc (Finput): Call get_user_input() to produce at least 1 output. diff -r 78fac67300e8 -r 1dcc9539234c libinterp/corefcn/input.cc --- 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 ();