Browse Source

clish_shell_readline() and clish_shell_forceline() API functions

git-svn-id: https://klish.googlecode.com/svn/trunk@191 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 13 years ago
parent
commit
1addd687ea
3 changed files with 22 additions and 12 deletions
  1. 4 5
      clish/shell.h
  2. 2 2
      clish/shell/shell_spawn.c
  3. 16 5
      clish/shell/shell_tinyrl.c

+ 4 - 5
clish/shell.h

@@ -300,11 +300,10 @@ void clish_shell_help(clish_shell_t * instance, const char *line);
 bool_t
 clish_shell_execute(clish_shell_t * instance,
 		    const clish_command_t * cmd, clish_pargv_t ** pargv);
-bool_t
-clish_shell_readline(clish_shell_t * shell,
-	const char *prompt,
-	const clish_command_t ** cmd, clish_pargv_t ** pargv,
-	const char * str);
+bool_t clish_shell_readline(clish_shell_t * instance, const char *prompt,
+	const clish_command_t ** cmd, clish_pargv_t ** pargv);
+bool_t clish_shell_forceline(clish_shell_t * instance, const char *prompt,
+	const clish_command_t ** cmd, clish_pargv_t ** pargv, const char * str);
 void clish_shell_set_context(clish_shell_t * instance, const char *viewname);
 void clish_shell_dump(clish_shell_t * instance);
 void clish_shell_close(clish_shell_t * instance);

+ 2 - 2
clish/shell/shell_spawn.c

@@ -212,7 +212,7 @@ static void *clish_shell_thread(void *arg)
 				/* get input from the user */
 				running =
 					clish_shell_readline(this, context->prompt,
-						&cmd, &context->pargv, NULL);
+						&cmd, &context->pargv);
 				lub_string_free(context->prompt);
 
 				context->prompt = NULL;
@@ -450,7 +450,7 @@ bool_t clish_context_exec(clish_context_t *context, const char *line)
 	assert(context->prompt);
 
 	/* get input from the user */
-	running = clish_shell_readline(this, context->prompt,
+	running = clish_shell_forceline(this, context->prompt,
 		&cmd, &context->pargv, line);
 	lub_string_free(context->prompt);
 	context->prompt = NULL;

+ 16 - 5
clish/shell/shell_tinyrl.c

@@ -357,11 +357,8 @@ void clish_shell_tinyrl_delete(tinyrl_t * this)
 }
 
 /*-------------------------------------------------------- */
-bool_t
-clish_shell_readline(clish_shell_t * this,
-	const char *prompt,
-	const clish_command_t ** cmd, clish_pargv_t ** pargv,
-	const char *str)
+static bool_t shell_readline(clish_shell_t * this, const char *prompt,
+	const clish_command_t ** cmd, clish_pargv_t ** pargv, const char *str)
 {
 	char *line = NULL;
 	bool_t result = BOOL_FALSE;
@@ -400,6 +397,20 @@ clish_shell_readline(clish_shell_t * this,
 	return result;
 }
 
+/*-------------------------------------------------------- */
+bool_t clish_shell_readline(clish_shell_t * this, const char *prompt,
+	const clish_command_t ** cmd, clish_pargv_t ** pargv)
+{
+	return shell_readline(this, prompt, cmd, pargv, NULL);
+}
+
+/*-------------------------------------------------------- */
+bool_t clish_shell_forceline(clish_shell_t * this, const char *prompt,
+	const clish_command_t ** cmd, clish_pargv_t ** pargv, const char *str)
+{
+	return shell_readline(this, prompt, cmd, pargv, str);
+}
+
 /*-------------------------------------------------------- */
 
 FILE * clish_shell__get_istream(const clish_shell_t * this)