summaryrefslogtreecommitdiffstats
path: root/cmd.h
diff options
context:
space:
mode:
Diffstat (limited to 'cmd.h')
-rw-r--r--cmd.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/cmd.h b/cmd.h
index a5e349a..b2decab 100644
--- a/cmd.h
+++ b/cmd.h
@@ -74,6 +74,7 @@ typedef struct cmd_table_t
int (*clb)(cmd_arg_t*); //callback to command
int (*hlp)(cmd_arg_t*); //help command
int (*pre)(cmd_arg_t*); //preconditions for execution
+ int (*autocpl)(cmd_arg_t*); //autocomplete according to context
} cmd_table_t;
/*
@@ -101,6 +102,9 @@ typedef struct cmd_mng_t
//not yet ready
//int flag_logging;
+
+ // flag turn on/off autocomplete
+ int flag_autocomplete;
cmd_table_t *table;
} cmd_mng_t;
@@ -128,7 +132,7 @@ PARAM:
cmng - cli manager
index - index value in history
RETURN:
- [FREE] return value if there is under index
+ return non-NULL value if there something
*/
char* cmd_mng_history( cmd_mng_t *cmng, int index );
@@ -139,7 +143,7 @@ PARAM:
RETURN:
[FREE] return string list of autocomplete commands
*/
-char* cmd_mng_autocomplete( cmd_mng_t *cmng, char *cmd );
+char* cmd_mng_autocomplete( cmd_mng_t *cmng, char *cmd, size_t cmd_sz );
/*
PARAM:
cmng
@@ -148,6 +152,11 @@ RETURN:
return result of execution
*/
int cmd_mng_exec( cmd_mng_t *cmng, const char *cmd, size_t sz_cmd );
+/*
+Free resources that where givent to cmd manager, like history
+*/
+int cmd_mng_free( cmd_mng_t *cmng);
+
#define STR_AC_EQ(A,B) (strncmp_ac((A),(B),strlen(A))==(strlen(A)+1))
#define STR_AC_PEQ(A,B) (strncmp_ac((A),(B),strlen(A))<(strlen(A)))