# HG changeset patch # User Rik # Date 1362887038 28800 # Node ID 2a81ce01c383f6098a227c5b9a0ef01d61bfab37 # Parent 4ef7bd2d7e8d88401c2b6cbc7092940397478a93 Fix history() so that it shows all commands when called with no arguments. * libinterp/interpfcn/oct-hist.cc(do_history): Correctly change input number of history lines to display from negative value to positive value. A negative value is reserved for "display all". diff -r 4ef7bd2d7e8d -r 2a81ce01c383 libinterp/interpfcn/oct-hist.cc --- a/libinterp/interpfcn/oct-hist.cc Sun Mar 10 02:39:06 2013 +0000 +++ b/libinterp/interpfcn/oct-hist.cc Sat Mar 09 19:43:58 2013 -0800 @@ -141,7 +141,7 @@ int nargin = args.length (); - // Number of history lines to show + // Number of history lines to show (-1 = all) int limit = -1; for (octave_idx_type i = 0; i < nargin; i++) @@ -155,6 +155,8 @@ else if (arg.is_numeric_type ()) { limit = arg.int_value (); + if (limit < 0) + limit = -limit; continue; } else @@ -210,7 +212,13 @@ int tmp; if (sscanf (option.c_str (), "%d", &tmp) == 1) - limit = tmp; + { + if (tmp > 0) + limit = tmp; + else + limit = -tmp; + } + else { if (option.length () > 0 && option[0] == '-') @@ -223,8 +231,8 @@ } } - if (limit < 0) - limit = -limit; +// if (limit < 0) +// limit = -limit; hlist = command_history::list (limit, numbered_output);