From: Gene Cumm Date: Fri, 9 Jul 2010 00:05:39 +0000 (-0400) Subject: rosh: add echo X-Git-Tag: syslinux-4.04-pre1~41 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=46aa048f6706147d52e471e4cd1a28b8b6d9fbd8;p=platform%2Fupstream%2Fsyslinux.git rosh: add echo --- 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' */