aboutsummaryrefslogtreecommitdiffstats
path: root/com32/rosh
diff options
context:
space:
mode:
authorGene Cumm <gene.cumm@gmail.com>2010-07-08 20:05:39 -0400
committerGene Cumm <gene.cumm@gmail.com>2010-10-09 07:33:06 -0400
commit46aa048f6706147d52e471e4cd1a28b8b6d9fbd8 (patch)
treedf018741a5a07a0be1986874cfe1ced2c0ad4ae3 /com32/rosh
parentf9900a7bd9320b0a844a573be2ab22d3b6d9ae7e (diff)
downloadsyslinux-46aa048f6706147d52e471e4cd1a28b8b6d9fbd8.tar.gz
syslinux-46aa048f6706147d52e471e4cd1a28b8b6d9fbd8.tar.xz
syslinux-46aa048f6706147d52e471e4cd1a28b8b6d9fbd8.zip
rosh: add echo
Diffstat (limited to 'com32/rosh')
-rw-r--r--com32/rosh/rosh.c43
1 files changed, 38 insertions, 5 deletions
diff --git a/com32/rosh/rosh.c b/com32/rosh/rosh.c
index 9efa35ef..75d77852 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' */