diff options
author | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-10-01 15:48:59 +0800 |
---|---|---|
committer | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-10-01 15:48:59 +0800 |
commit | 8a5a9bc8101c13545f6ffe607cf8e6201c706ffc (patch) | |
tree | 673acb50cb421b270abde1839d01ecf8f570ad82 /ticket.c | |
parent | 7dcc8142197639a0cbffd75a6ef92a1c9764f1a7 (diff) |
Handle every new line in content
Character '#' is not handled yet.
Diffstat (limited to 'ticket.c')
-rw-r--r-- | ticket.c | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -157,9 +157,24 @@ static size_t history_handler(void *contents, size_t size, size_t nmemb ticket_history->content = malloc(strlen(token)); strcpy(ticket_history->content, ++token); -#ifdef DEBUG - printf("Content: %s\n", token); -#endif + while ((line = strtok_r(NULL, "\n" + , &linesaveptr))) { + if (!strncmp(line, "Creator", 7)) + break; + char *ptr = realloc(ticket_history + ->content + , strlen + (ticket_history + ->content) + + strlen(line) + + 2); + ticket_history->content = ptr; + sprintf(ticket_history->content + , "%s\n%s" + , ticket_history + ->content + , line); + } } else if (!strcmp(token, "Creator")) { token = strtok_r(NULL, ":", &tokensaveptr); ticket_history->creator |