From: curt Date: Wed, 28 Feb 2001 19:48:18 +0000 (+0000) Subject: Some error checking and an xml dump routine contributed by Norman Vine. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d7ca2c7e7dfba2950f4bd7292a0e7cf15651c290;p=flightgear.git Some error checking and an xml dump routine contributed by Norman Vine. --- diff --git a/src/Network/props.cxx b/src/Network/props.cxx index 77fac588b..f249f23b8 100644 --- a/src/Network/props.cxx +++ b/src/Network/props.cxx @@ -63,6 +63,7 @@ bool FGProps::open() { } set_enabled( true ); + FG_LOG( FG_IO, FG_INFO, "Opening properties channel communication layer." ); return true; } @@ -129,6 +130,22 @@ bool FGProps::process_command( const char *cmd ) { } io->writestring( line.c_str() ); } + } else if ( command == "dump" ) { + strstream buf; + if ( tokens.size() <= 1 ) { + writeProperties ( buf, node); + io->writestring( buf.str() ); + } + else { + SGPropertyNode *child = node->getNode(tokens[1]); + if ( child ) { + writeProperties ( buf, child ); + io->writestring( buf.str() ); + } else { + tokens[1] += " Not Found\n"; + io->writestring( tokens[1].c_str() ); + } + } } else if ( command == "cd" ) { // string tmp = "current path = " + node.getPath() + "\n"; // io->writestring( tmp.c_str() ); @@ -136,8 +153,13 @@ bool FGProps::process_command( const char *cmd ) { if ( tokens.size() <= 1 ) { // do nothing } else { - node = node->getNode(tokens[1]); - path = node->getPath(); + SGPropertyNode *child = node->getNode(tokens[1]); + if ( child ) { + path = child->getPath(); + } else { + tokens[1] += " Not Found\n"; + io->writestring( tokens[1].c_str() ); + } } } else if ( command == "pwd" ) { string ttt = node->getPath(); @@ -146,7 +168,7 @@ bool FGProps::process_command( const char *cmd ) { } ttt += "\n"; io->writestring( ttt.c_str() ); - } else if ( command == "show" ) { + } else if ( command == "get" || command == "show" ) { if ( tokens.size() <= 1 ) { // do nothing } else { @@ -183,9 +205,11 @@ bool FGProps::process_command( const char *cmd ) { io->writestring( "\n" ); io->writestring( "help show help message\n" ); io->writestring( "ls list current directory\n" ); + io->writestring( "dump dump current state (in xml)\n" ); io->writestring( "cd cd to a directory, '..' to move back\n" ); io->writestring( "pwd display your current path\n" ); - io->writestring( "show show the value of a parameter\n" ); + io->writestring( "get show the value of a parameter\n" ); + io->writestring( "show synonym for get\n" ); io->writestring( "set set to a new \n" ); io->writestring( "quit terminate connection\n" ); io->writestring( "\n" );