diff options
author | FreeArtMan <dos21h@gmail.com> | 2017-03-16 23:12:46 +0000 |
---|---|---|
committer | FreeArtMan <dos21h@gmail.com> | 2017-03-16 23:12:46 +0000 |
commit | b04419c4c7e485f164d6481470b2e6b0087dcac1 (patch) | |
tree | 94e07b978e28c46d4df0bb791ba9c24f5f09d5ca /irc_parse.c | |
parent | fbba9957124bde600e89e3720377f9c3ab78e3a0 (diff) | |
download | agni-b04419c4c7e485f164d6481470b2e6b0087dcac1.tar.gz agni-b04419c4c7e485f164d6481470b2e6b0087dcac1.zip |
Add token to qcmd. Added needed functions to manage that
Diffstat (limited to 'irc_parse.c')
-rw-r--r-- | irc_parse.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/irc_parse.c b/irc_parse.c index 29a98dc..d7ccd03 100644 --- a/irc_parse.c +++ b/irc_parse.c @@ -126,6 +126,38 @@ int token_len(irc_token *tk) return ret; } +irc_token* token_cpy_new(irc_token *tk) +{ + int i = 0; + irc_token *ret=NULL; + + if (tk == NULL) + { + return NULL; + } + + ret = token_create(); + if (ret == NULL) + { + return NULL; + } + + ret->size = tk->size; + ret->max_size = tk->max_size; + for (i=0;i<tk->size;i++) + { + irc_token_el *te = NULL; + te = malloc(sizeof(irc_token_el)); + te->type = tk->tk_list[i]->type; + te->size = tk->tk_list[i]->size; + te->token = alloc_new_str_s(tk->tk_list[i]->token, tk->tk_list[i]->size); + ret->tk_list[i] = te; + te = NULL; + } + + return ret; +} + void token_destroy(irc_token *tk) { @@ -284,7 +316,7 @@ irc_token* irc_parse(char *str, int sz) //*(tok[j].e+1)=0x0; //write(0,"]\n",2); } - if (tok_cnt < 2 ) + if (tok_cnt < 2 ) { printf("Not enought tokens\n"); }; |