summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2011-08-01 20:05:42 -0500
committerJohn Southworth <john.southworth@vyatta.com>2011-08-01 20:05:42 -0500
commit61bcb4f4c515de0f51f603da2815f14bd06848e1 (patch)
treef6fabba05d450cfb1e4ff276bb03483003cf5868
parent329d0ae4113606dfbe23fd9f3e3595258dbe90b5 (diff)
downloadvyatta-bash-61bcb4f4c515de0f51f603da2815f14bd06848e1.tar.gz
vyatta-bash-61bcb4f4c515de0f51f603da2815f14bd06848e1.zip
Make restricted mode 'Invalid command' message match non restricted mode
-rw-r--r--eval.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index b6986f7..7b818b0 100644
--- a/eval.c
+++ b/eval.c
@@ -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';