diff options
author | Justin Clark-Casey (justincc) | 2012-02-13 20:48:50 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-02-13 20:48:50 +0000 |
commit | 21393af631c743f0ee0094a20a9fa9f2aeb2e500 (patch) | |
tree | dd74990b038ca912b6a0fe42a8a3305f9e51c7f2 /OpenSim/Framework/Console/CommandConsole.cs | |
parent | On object deserialization, go back to logging errors at DEBUG level rather th... (diff) | |
parent | correct the default avatar_terminal_velocity value that I accidentally left i... (diff) | |
download | opensim-SC_OLD-21393af631c743f0ee0094a20a9fa9f2aeb2e500.zip opensim-SC_OLD-21393af631c743f0ee0094a20a9fa9f2aeb2e500.tar.gz opensim-SC_OLD-21393af631c743f0ee0094a20a9fa9f2aeb2e500.tar.bz2 opensim-SC_OLD-21393af631c743f0ee0094a20a9fa9f2aeb2e500.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Framework/Console/CommandConsole.cs')
-rw-r--r-- | OpenSim/Framework/Console/CommandConsole.cs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index a0d3541..0d6288b 100644 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs | |||
@@ -31,6 +31,7 @@ using System.Collections.Generic; | |||
31 | using System.Diagnostics; | 31 | using System.Diagnostics; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Text; | 33 | using System.Text; |
34 | using System.Text.RegularExpressions; | ||
34 | using System.Threading; | 35 | using System.Threading; |
35 | using log4net; | 36 | using log4net; |
36 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
@@ -531,6 +532,11 @@ namespace OpenSim.Framework.Console | |||
531 | 532 | ||
532 | public class Parser | 533 | public class Parser |
533 | { | 534 | { |
535 | // If an unquoted portion ends with an element matching this regex | ||
536 | // and the next element contains a space, then we have stripped | ||
537 | // embedded quotes that should not have been stripped | ||
538 | private static Regex optionRegex = new Regex("^--[a-zA-Z0-9-]+=$"); | ||
539 | |||
534 | public static string[] Parse(string text) | 540 | public static string[] Parse(string text) |
535 | { | 541 | { |
536 | List<string> result = new List<string>(); | 542 | List<string> result = new List<string>(); |
@@ -544,10 +550,38 @@ namespace OpenSim.Framework.Console | |||
544 | if (index % 2 == 0) | 550 | if (index % 2 == 0) |
545 | { | 551 | { |
546 | string[] words = unquoted[index].Split(new char[] {' '}); | 552 | string[] words = unquoted[index].Split(new char[] {' '}); |
553 | |||
554 | bool option = false; | ||
547 | foreach (string w in words) | 555 | foreach (string w in words) |
548 | { | 556 | { |
549 | if (w != String.Empty) | 557 | if (w != String.Empty) |
558 | { | ||
559 | if (optionRegex.Match(w) == Match.Empty) | ||
560 | option = false; | ||
561 | else | ||
562 | option = true; | ||
550 | result.Add(w); | 563 | result.Add(w); |
564 | } | ||
565 | } | ||
566 | // The last item matched the regex, put the quotes back | ||
567 | if (option) | ||
568 | { | ||
569 | // If the line ended with it, don't do anything | ||
570 | if (index < (unquoted.Length - 1)) | ||
571 | { | ||
572 | // Get and remove the option name | ||
573 | string optionText = result[result.Count - 1]; | ||
574 | result.RemoveAt(result.Count - 1); | ||
575 | |||
576 | // Add the quoted value back | ||
577 | optionText += "\"" + unquoted[index + 1] + "\""; | ||
578 | |||
579 | // Push the result into our return array | ||
580 | result.Add(optionText); | ||
581 | |||
582 | // Skip the already used value | ||
583 | index++; | ||
584 | } | ||
551 | } | 585 | } |
552 | } | 586 | } |
553 | else | 587 | else |