summaryrefslogtreecommitdiff
path: root/irc_parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'irc_parse.c')
-rw-r--r--irc_parse.c34
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");
};