Bug Fix - #322 rc: override for shell command does not propagate

- Fixed bug #322 which failed to propagate rc overrides to shell commands.
- Context now properly records overrides to file and variables.
- The text.cpp:split (...) functions can now skip trivial split results.
This commit is contained in:
Paul Beckingham 2009-11-29 14:23:22 -05:00
parent 8d784da0ae
commit b94706c56e
6 changed files with 37 additions and 22 deletions

View file

@ -57,14 +57,16 @@ void wrapText (
void split (
std::vector<std::string>& results,
const std::string& input,
const char delimiter)
const char delimiter,
bool nontrivial /* = true */)
{
results.clear ();
std::string::size_type start = 0;
std::string::size_type i;
while ((i = input.find (delimiter, start)) != std::string::npos)
{
results.push_back (input.substr (start, i - start));
if (!nontrivial || i != start)
results.push_back (input.substr (start, i - start));
start = i + 1;
}
@ -76,7 +78,8 @@ void split (
void split (
std::vector<std::string>& results,
const std::string& input,
const std::string& delimiter)
const std::string& delimiter,
bool nontrivial /* = true */)
{
results.clear ();
std::string::size_type length = delimiter.length ();
@ -85,7 +88,8 @@ void split (
std::string::size_type i;
while ((i = input.find (delimiter, start)) != std::string::npos)
{
results.push_back (input.substr (start, i - start));
if (!nontrivial || i != start)
results.push_back (input.substr (start, i - start));
start = i + length;
}