From: curt Date: Sat, 4 Jan 2003 19:04:07 +0000 (+0000) Subject: Expose the ability to run built in (command manager) commands via the X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5fc7c70a4a60406e195ce4117fee159133f23c15;p=flightgear.git Expose the ability to run built in (command manager) commands via the "telnet" interface. --- diff --git a/src/Network/props.cxx b/src/Network/props.cxx index de1c870e0..253aac701 100644 --- a/src/Network/props.cxx +++ b/src/Network/props.cxx @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -42,8 +43,10 @@ #include "props.hxx" +#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) SG_USING_STD(strstream); SG_USING_STD(ends); +#endif /** * Props connection class. @@ -325,6 +328,31 @@ PropsChannel::foundTerminator() } } } + else if ( command == "run" ) + { + if ( tokens.size() == 2 ) + { + string tmp; + SGPropertyNode args; + if ( !globals->get_commands() + ->execute(tokens[1].c_str(), &args) ) + { + SG_LOG( SG_GENERAL, SG_ALERT, + "Command " << tokens[1] << " failed."); + if ( mode == PROMPT ) { + tmp += "*failed*"; + push( tmp.c_str() ); + push( getTerminator() ); + } + } else { + if ( mode == PROMPT ) { + tmp += ""; + push( tmp.c_str() ); + push( getTerminator() ); + } + } + } + } else if (command == "quit") { close(); @@ -353,6 +381,7 @@ ls [] list directory\r\n\ prompt switch to interactive mode (default)\r\n\ pwd display your current path\r\n\ quit terminate connection\r\n\ +run run built in command\r\n\ set set to a new \r\n\ show synonym for get\r\n"; push( msg );