From a791689ceb2b502929fa526d595465d36a22ac07 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 8 Jun 2010 22:03:08 +0200 Subject: Make the text mode remote console really work. It can now be used to send multi-word commands with proper quoting, handles arguments with spaces and allows interactive use, e.g. user creation. --- OpenSim/Framework/Console/RemoteConsole.cs | 36 ++++++++++++++++++------------ 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'OpenSim/Framework/Console') diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs index 6f8348d..a46a6cb 100644 --- a/OpenSim/Framework/Console/RemoteConsole.cs +++ b/OpenSim/Framework/Console/RemoteConsole.cs @@ -106,8 +106,15 @@ namespace OpenSim.Framework.Console public override string ReadLine(string p, bool isCommand, bool e) { + if (isCommand) + Output("+++"+p); + else + Output("-++"+p); + m_DataEvent.WaitOne(); + string cmdinput; + lock (m_InputData) { if (m_InputData.Count == 0) @@ -116,29 +123,30 @@ namespace OpenSim.Framework.Console return ""; } - string cmdinput = m_InputData[0]; + cmdinput = m_InputData[0]; m_InputData.RemoveAt(0); if (m_InputData.Count == 0) m_DataEvent.Reset(); - if (isCommand) + } + + if (isCommand) + { + string[] cmd = Commands.Resolve(Parser.Parse(cmdinput)); + + if (cmd.Length != 0) { - string[] cmd = Commands.Resolve(Parser.Parse(cmdinput)); + int i; - if (cmd.Length != 0) + for (i=0 ; i < cmd.Length ; i++) { - int i; - - for (i=0 ; i < cmd.Length ; i++) - { - if (cmd[i].Contains(" ")) - cmd[i] = "\"" + cmd[i] + "\""; - } - return String.Empty; + if (cmd[i].Contains(" ")) + cmd[i] = "\"" + cmd[i] + "\""; } + return String.Empty; } - return cmdinput; } + return cmdinput; } private void DoExpire() @@ -308,7 +316,7 @@ namespace OpenSim.Framework.Console return reply; } - if (post["COMMAND"] == null || post["COMMAND"].ToString() == String.Empty) + if (post["COMMAND"] == null) return reply; lock (m_InputData) -- cgit v1.1