From c1c6a00856fb6db58711ccb1ebda09861ea6ea17 Mon Sep 17 00:00:00 2001
From: david <david>
Date: Wed, 6 Feb 2002 14:22:04 +0000
Subject: [PATCH] Patches from Melchior Franz:

  - 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 | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/Network/props.cxx b/src/Network/props.cxx
index f9c3b8b37..5cdd5c0a4 100644
--- a/src/Network/props.cxx
+++ b/src/Network/props.cxx
@@ -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;