In sim_cmd_file and sim_run_console, fixed bug regarding a new line being kept at the end of the input when an unknown command is processed from console or from file.
Signed-off-by: Perry Huang <[email protected]> --- ibsim/ibsim.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/ibsim/ibsim.c b/ibsim/ibsim.c index e720f0d..d894913 100644 --- a/ibsim/ibsim.c +++ b/ibsim/ibsim.c @@ -546,6 +546,8 @@ int sim_cmd_file(FILE * f, char *s) } while (fgets(line, sizeof(line) - 1, cmd_file) != NULL) { + if((p = strchr(line, '\n')) != NULL) + *p = '\0'; do_cmd(line, f); } @@ -588,11 +590,14 @@ static int sim_run_console(int fd) { char line[128]; int ret = 0; + char *p = NULL; ret = readline(fd, line, sizeof(line) - 1); if (ret <= 0) return ret; + if((p = strchr(line, '\n')) != NULL) + *p = '\0'; do_cmd(line, simout); fprintf(simout, "sim%s> ", netstarted ? "" : " (inactive)"); fflush(simout); -- 1.7.1-- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
