octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fix for match_sans_spaces in Octave 2.1.36


From: Joseph P. Skudlarek
Subject: fix for match_sans_spaces in Octave 2.1.36
Date: Wed, 19 Jun 2002 23:41:13 -0700

Problem Description:

        configure Octave 2.1.36 with --disable-readline, compile, and
        install.

        invoke octave

        type "keyboard" at the command prompt

        type "exit"

        rather than exiting from the keyboard subsession, one exits out
        of the entire octave program 

Analysis

        [with --disable-readline], the newline is left in the input
        buffer which is passed to match_sans_spaces; the newline is not
        skipped, so "quit" does not match "quit\n", and quit passed
        along, which causes a full program exit.

Fix src/ChangeLog

2002-06-19  Joseph P. Skudlarek  <address@hidden>

        * input.cc (match_sans_spaces): ignore newline (and semicolon);
        receive argument "keyword" as const char*, to avoid constructing
        temporary const std::string& on the fly.

Fix context diff

*** input.cc-ORIG       Tue Apr  9 17:39:52 2002
--- input.cc    Wed Jun 19 23:07:12 2002
***************
*** 482,496 ****
  }
  
  static bool
! match_sans_spaces (const std::string& standard, const std::string& test)
  {
!   size_t beg = test.find_first_not_of (" \t");
  
    if (beg != NPOS)
      {
!       size_t end = test.find_last_not_of (" \t");
  
!       size_t len = end == NPOS ? NPOS : end - beg + 1;
  
        return (test.substr (beg, len) == standard);
      }
--- 482,498 ----
  }
  
  static bool
! match_sans_spaces (const char *standard, const std::string& test)
  {
!   const char* delim = " \t\n;" ;
! 
!   size_t beg = test.find_first_not_of (delim);
  
    if (beg != NPOS)
      {
!       size_t end = test.find_last_not_of (delim);
  
!       size_t len = (end == NPOS) ? NPOS : (end - beg + 1);
  
        return (test.substr (beg, len) == standard);
      }

/Jskud



reply via email to

[Prev in Thread] Current Thread [Next in Thread]