[syslinux:master] rosh: add echo

syslinux-bot for Gene Cumm gene.cumm at gmail.com
Sun Nov 14 12:54:27 PST 2010


Commit-ID:  46aa048f6706147d52e471e4cd1a28b8b6d9fbd8
Gitweb:     http://syslinux.zytor.com/commit/46aa048f6706147d52e471e4cd1a28b8b6d9fbd8
Author:     Gene Cumm <gene.cumm at gmail.com>
AuthorDate: Thu, 8 Jul 2010 20:05:39 -0400
Committer:  Gene Cumm <gene.cumm at gmail.com>
CommitDate: Sat, 9 Oct 2010 07:33:06 -0400

rosh: add echo



---
 com32/rosh/rosh.c |   43 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/com32/rosh/rosh.c b/com32/rosh/rosh.c
index 9efa35e..75d7785 100644
--- a/com32/rosh/rosh.c
+++ b/com32/rosh/rosh.c
@@ -38,7 +38,7 @@
 #define APP_NAME	"rosh"
 #define APP_AUTHOR	"Gene Cumm"
 #define APP_YEAR	"2010"
-#define APP_VER		"beta-b068"
+#define APP_VER		"beta-b069"
 
 void rosh_version(int vtype)
 {
@@ -359,6 +359,22 @@ void rosh_cfg(void)
     printf("CFG:     '%s'\n", syslinux_config_file());
 }				/* rosh_cfg */
 
+/* Echo a string back to the screen
+ *	cmdstr	command string to process
+ */
+void rosh_echo(const char *cmdstr)
+{
+    int bpos = 0;
+    ROSH_DEBUG("CMD: '%s'\n", cmdstr);
+    bpos = rosh_search_nonsp(cmdstr, rosh_search_sp(cmdstr, 0));
+    if (bpos > 1) {
+	ROSH_DEBUG("  bpos=%d\n", bpos);
+	printf("'%s'\n", cmdstr + bpos);
+    } else {
+	puts("");
+    }
+}				/* rosh_echo */
+
 /* Process optstr to optarr
  *	optstr	option string to process
  *	optarr	option array to populate
@@ -1008,11 +1024,28 @@ char rosh_command(const char *cmdstr, const char *ipwdstr)
     case 'E':
     case 'q':
     case 'Q':
-	if ((strncasecmp("exit", tstr, tlen) == 0) ||
-	    (strncasecmp("quit", tstr, tlen) == 0))
-	    do_exit = true;
-	else
+	switch (cmdstr[1]) {
+	case 0:
+	case 'x':
+	case 'X':
+	case 'u':
+	case 'U':
+	    if ((strncasecmp("exit", tstr, tlen) == 0) ||
+		(strncasecmp("quit", tstr, tlen) == 0))
+		do_exit = true;
+	    else
+		rosh_help(1, NULL);
+	    break;
+	case 'c':
+	case 'C':
+	    if (strncasecmp("echo", tstr, tlen) == 0)
+		rosh_echo(cmdstr);
+	    else
+		rosh_help(1, NULL);
+	    break;
+	default:
 	    rosh_help(1, NULL);
+	}
 	break;
     case 'c':
     case 'C':			/* run 'cd' 'cat' 'cfg' */



More information about the Syslinux-commits mailing list