Change in osmo-ccid-firmware[master]: command.c: don't print "unknown command" for empty commands

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Apr 17 10:06:20 UTC 2019


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/13692


Change subject: command.c: don't print "unknown command" for empty commands
......................................................................

command.c: don't print "unknown command" for empty commands

Change-Id: If8512a705e464a9cae949e6278a8d69eb7833737
---
M sysmoOCTSIM/command.c
1 file changed, 7 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/92/13692/1

diff --git a/sysmoOCTSIM/command.c b/sysmoOCTSIM/command.c
index 3210b27..b0949f3 100644
--- a/sysmoOCTSIM/command.c
+++ b/sysmoOCTSIM/command.c
@@ -85,15 +85,19 @@
 		int c = getchar();
 		if (c < 0)
 			return;
-		putchar(c);
 		if (c == '\r' || c == '\n' || g_cmds.buf_idx >= sizeof(g_cmds.buf)-1) {
+			/* skip empty commands */
+			if (g_cmds.buf_idx == 0)
+				return;
 			cmd_execute();
 			cmd_buf_reset();
 			printf(g_cmds.prompt);
 			return;
+		} else {
+			/* print + append character */
+			putchar(c);
+			cmd_buf_append(c);
 		}
-		/* append character */
-		cmd_buf_append(c);
 
 		i++;
 	}

-- 
To view, visit https://gerrit.osmocom.org/13692
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: If8512a705e464a9cae949e6278a8d69eb7833737
Gerrit-Change-Number: 13692
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190417/4cde6098/attachment.html>


More information about the gerrit-log mailing list