changeset 24449:9a9b2e0596f5

Don't error with "%c" arg to whos_line_format (bug #52714). * variables.cc (parse_whos_line_format): Detect special exception case where modifier is 'c' and command is unrecognized. Revert modifier to default of 'r' and change command to 'c'.
author Rik <rik@octave.org>
date Thu, 21 Dec 2017 16:10:22 -0800
parents 138c2380521c
children 49a3d6c864f9
files libinterp/corefcn/variables.cc
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/variables.cc	Thu Dec 21 14:30:38 2017 -0800
+++ b/libinterp/corefcn/variables.cc	Thu Dec 21 16:10:22 2017 -0800
@@ -1516,6 +1516,14 @@
             if (items < 2)
               error ("whos_line_format: parameter structure without command in whos_line_format");
 
+            // Exception case of bare class command 'c' without modifier 'l/r'
+            if (param.modifier == 'c'
+                && param_string.find (param.command) == std::string::npos)
+              {
+                param.modifier = 'r';
+                param.command = 'c';
+              }
+
             // Insert data into parameter
             param.first_parameter_length = 0;
             pos = param_string.find (param.command);