]> git.mxchange.org Git - flightgear.git/commitdiff
Patches from Melchior Franz:
authordavid <david>
Wed, 6 Feb 2002 14:22:04 +0000 (14:22 +0000)
committerdavid <david>
Wed, 6 Feb 2002 14:22:04 +0000 (14:22 +0000)
  - define buffers where they are needed (two places)
  - comment out stale debug message (it doesn't buy anything, because the
    contents are output two lines below, anyway)
  - let every error message begin with "ERR ". This makes error messages
    less beautiful, but easier to recognize for scripts. Every internet
    protocol that outputs text, has such a tag for distinguishing regular
    output from error messages. (pop3 uses "-ERR ", smtp uses error codes,
    etc.)

src/Network/props.cxx

index f9c3b8b37c0dc7461bc98169cc87b2c89a606fbb..5cdd5c0a44ed8e3728bec44096a940cedc1192e4 100644 (file)
@@ -138,7 +138,7 @@ bool FGProps::process_command( const char *cmd ) {
                dir = globals->get_props()->getNode(path + "/" + tokens[1]);
            }
            if ( dir == 0 ) {
-               tokens[1] += " Not Found\n";
+               tokens[1] = "ERR Node \"" + tokens[1] + "\" not found.\n";
                io->writestring( tokens[1].c_str() );
                return true;
            }
@@ -149,13 +149,14 @@ bool FGProps::process_command( const char *cmd ) {
            string name = child->getName();
            string line = name;
            if ( dir->getChild(name, 1) ) {
+               char buf[16];
                sprintf(buf, "[%d]", child->getIndex());
                line += buf;
            }
            if ( child->nChildren() > 0 ) {
                line += "/";
            } else {
-               if (mode == PROMPT) {
+               if ( mode == PROMPT ) {
                    string value = dir->getStringValue ( name, "" );
                    line += " =\t'" + value + "'\t(";
                    line += getValueTypeString( dir->getNode( name ) );
@@ -177,7 +178,7 @@ bool FGProps::process_command( const char *cmd ) {
                writeProperties ( buf, child );
                io->writestring( buf.str() );
            } else {
-               tokens[1] += " Not Found\n";
+               tokens[1] = "ERR Node \"" + tokens[1] + "\" not found.\n";
                io->writestring( tokens[1].c_str() );
            }
        }
@@ -193,7 +194,7 @@ bool FGProps::process_command( const char *cmd ) {
                node = child;
                path = node->getPath();
            } else {
-               tokens[1] += " Not Found\n";
+               tokens[1] = "ERR Node \"" + tokens[1] + "\" not found.\n";
                io->writestring( tokens[1].c_str() );
            }
        }
@@ -211,8 +212,8 @@ bool FGProps::process_command( const char *cmd ) {
            string tmp; 
            string value = node->getStringValue ( tokens[1], "" );
            if ( mode == PROMPT ) {
-               string ttt = "debug = '" + tokens[1] + "'\n";
-               io->writestring( ttt.c_str() );
+               //string ttt = "debug = '" + tokens[1] + "'\n";
+               //io->writestring( ttt.c_str() );
 
                tmp = tokens[1] + " = '" + value + "' (";
                tmp += getValueTypeString( node->getNode( tokens[1] ) );
@@ -278,6 +279,7 @@ bool FGProps::process_command( const char *cmd ) {
 // process work for this port
 bool FGProps::process() {
     SGIOChannel *io = get_io_channel();
+    char buf[max_cmd_len];
 
     // cout << "processing incoming props command" << endl;