Mercurial > jwe > octave
changeset 21214:7be1f58f9dd7
don't strip pipe character from command in drawnow function
* graphics.cc (Fdrawnow): Don't strip pipe character in command before
passing to toolkit print function. Only check first character in
command string for pipe character.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 07 Feb 2016 02:03:58 -0500 |
parents | f7d1050b9b53 |
children | 04866fac690a |
files | libinterp/corefcn/graphics.cc |
diffstat | 1 files changed, 4 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc Sat Feb 06 18:22:32 2016 -0800 +++ b/libinterp/corefcn/graphics.cc Sun Feb 07 02:03:58 2016 -0500 @@ -10763,26 +10763,17 @@ file = args(1).xstring_value ("drawnow: FILE must be a string"); - size_t pos_p = file.find_first_of ("|"); - size_t pos_c = file.find_first_not_of ("| "); - - if (pos_p == std::string::npos && - pos_c == std::string::npos) + if (file.empty ()) error ("drawnow: empty output ''"); - else if (pos_c == std::string::npos) + else if (file.length () == 1 && file[0] == '|') error ("drawnow: empty pipe '|'"); - else if (pos_p != std::string::npos && pos_p < pos_c) - { - // Strip leading pipe character - file = file.substr (pos_c); - } - else + else if (file[0] != '|') { size_t pos = file.find_last_of (file_ops::dir_sep_chars ()); if (pos != std::string::npos) { - std::string dirname = file.substr (pos_c, pos+1); + std::string dirname = file.substr (0, pos+1); file_stat fs (dirname);