diff options
-rw-r--r-- | export_xml.c | 2 | ||||
-rw-r--r-- | main.c | 1 | ||||
-rw-r--r-- | user.c | 2 | ||||
-rw-r--r-- | user.h | 2 |
4 files changed, 5 insertions, 2 deletions
diff --git a/export_xml.c b/export_xml.c index f38a803..db1d592 100644 --- a/export_xml.c +++ b/export_xml.c @@ -47,6 +47,8 @@ int export_xml(struct channel_t *channel, struct user_t *users) { xmlNewChild(user_node, NULL, "nick", user->nick); snprintf(s, 0xf, "%d", user->words); xmlNewChild(user_node, NULL, "words", s); + snprintf(s, 0xf, "%d", user->characters); + xmlNewChild(user_node, NULL, "characters", s); /* Add lines for this user. */ xmlNodePtr lines_node = xmlNewChild(user_node, NULL, "lines", NULL); @@ -77,6 +77,7 @@ int main(int argc, char **argv) { /* Count words. */ wchar_t wtext[TEXT_BUFFER_SIZE]; mbstowcs(wtext, text, TEXT_BUFFER_SIZE); + user->characters += wcslen(wtext); wchar_t word[TEXT_BUFFER_SIZE]; wchar_t *end = wcschr(wtext, '\0'); *word = '\0'; @@ -33,7 +33,7 @@ struct user_t *user_get(char *_nick) { user->hash = hash; user->nick = strdup(nick); memset(user->lines, 0, 24*4 * sizeof(unsigned long)); - user->words = 0; + user->words = user->characters = 0; user->next = NULL; } @@ -7,7 +7,7 @@ struct user_t { unsigned long hash; char *nick; unsigned long lines[24*4]; - unsigned long long words; + unsigned long long words, characters; struct user_t *next; }; |