diff options
author | John Southworth <john.southworth@vyatta.com> | 2011-08-01 20:05:42 -0500 |
---|---|---|
committer | John Southworth <john.southworth@vyatta.com> | 2011-08-01 20:05:42 -0500 |
commit | 61bcb4f4c515de0f51f603da2815f14bd06848e1 (patch) | |
tree | f6fabba05d450cfb1e4ff276bb03483003cf5868 | |
parent | 329d0ae4113606dfbe23fd9f3e3595258dbe90b5 (diff) | |
download | vyatta-bash-61bcb4f4c515de0f51f603da2815f14bd06848e1.tar.gz vyatta-bash-61bcb4f4c515de0f51f603da2815f14bd06848e1.zip |
Make restricted mode 'Invalid command' message match non restricted mode
-rw-r--r-- | eval.c | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -239,7 +239,23 @@ parse_command () if (interactive && in_vyatta_restricted_mode(FULL) && current_readline_line) { if (!is_vyatta_command(current_readline_line, global_command)) { - printf("Invalid command\n"); + char *start = current_readline_line; + char *end = NULL; + char *cmd = NULL; + int cmdlen = 0; + while (*start && (whitespace(*start) || *start == '\n')) { + start++; + } + end = start; + while (*end && (!whitespace(*end) && *end != '\n')) { + end++; + } + cmdlen = end-start; + cmd = malloc(cmdlen+1); + bzero(cmd,cmdlen+1); + strncpy(cmd, start, cmdlen); + + printf("\n Invalid command: [%s]\n\n", cmd); current_readline_line_index = 0; current_readline_line[0] = '\n'; current_readline_line[1] = '\0'; |