diff options
Diffstat (limited to 'tbl_qcmd.c')
-rw-r--r-- | tbl_qcmd.c | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -70,6 +70,42 @@ int tbl_exec_in_s(tbl_exec *tbl, char *cmd) return -1; } +int tbl_exec_run(tbl_exec *tbl, char *cmd, void **resp) +{ + int ret=-1; + + int i; + tble_exec *el=NULL; + + if ((tbl == NULL) || (cmd == NULL) || (resp==NULL) || (*resp != NULL)) + { + PERM(); + return -1; + } + + for (i=0;i<tbl->size;i++) + { + el = tbl->cmd[i]; + if (strncmp(el->cmd, cmd, strlen(el->cmd))==0) + { + void *ret_resp=NULL; + + //execute callback + PRINT("EXEC CLB ID %d\n",i); + ret_resp = el->callback(NULL); //no params for now + + //return + if (ret_resp != NULL) + { + *resp = ret_resp; + ret = i; + } + } + } + + return ret; +} + tble_exec *tbl_exec_search_cmd(tbl_exec *tbl, tble_qcmd *cmd) { tble_exec *ret = NULL; |