[ofa-general] [PATCH] opensm/console: skip empty cmd lines

Sasha Khapyorsky sashak at voltaire.com
Thu Apr 5 16:12:27 PDT 2007


Skip empty or space filled command line without parse error message.
Quote original line in case of the parse error.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 osm/opensm/osm_console.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/osm/opensm/osm_console.c b/osm/opensm/osm_console.c
index 9952bdd..224564d 100644
--- a/osm/opensm/osm_console.c
+++ b/osm/opensm/osm_console.c
@@ -525,6 +525,10 @@ static void parse_cmd_line(char *line, osm_opensm_t *p_osm)
 	int i, found = 0;
 	FILE *out = p_osm->console.out;
 
+	while (isspace(*line))
+		line++;
+	if (!*line)
+		return;
 
 	/* find first token which is the command */
 	p_cmd = strtok_r(line, " \t\n\r", &p_last);
@@ -548,7 +552,7 @@ static void parse_cmd_line(char *line, osm_opensm_t *p_osm)
 			help_command(out, 0);
 		}
 	} else {
-		fprintf(out, "Error parsing command line: %s\n", line);
+		fprintf(out, "Error parsing command line: `%s'\n", line);
 	}
 	if (loop_command.on) {
 		fprintf(out, "use \"q<ret>\" to quit loop\n");
-- 
1.5.1.rc1.18.ga41b4




More information about the general mailing list