Browse Source

Add clish_shell_set_hook() function

Serj Kalichev 11 years ago
parent
commit
4f790a94cc
2 changed files with 15 additions and 0 deletions
  1. 2 0
      clish/shell.h
  2. 13 0
      clish/shell/shell_plugin.c

+ 2 - 0
clish/shell.h

@@ -180,6 +180,8 @@ clish_sym_t *clish_shell_add_sym(clish_shell_t *instance,
 	void *func, const char *name, int type);
 clish_sym_t *clish_shell_add_unresolved_sym(clish_shell_t *instance,
 	const char *name, int type);
+int clish_shell_set_hook(clish_shell_t *instance,
+	void *func, const char *name, int type);
 
 _END_C_DECL
 

+ 13 - 0
clish/shell/shell_plugin.c

@@ -170,3 +170,16 @@ int clish_shell_link_plugins(clish_shell_t *this)
 
 	return 0;
 }
+
+/*----------------------------------------------------------------------- */
+/* Set params of hooks */
+int clish_shell_set_hook(clish_shell_t *this,
+	void *func, const char *name, int type)
+{
+	if (!name)
+		return -1;
+	clish_sym__set_name(this->hooks[type], name);
+	clish_sym__set_func(this->hooks[type], func);
+
+	return 0;
+}