summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--export_xml.c2
-rw-r--r--main.c1
-rw-r--r--user.c2
-rw-r--r--user.h2
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);
diff --git a/main.c b/main.c
index 8aab7b5..ee00240 100644
--- a/main.c
+++ b/main.c
@@ -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';
diff --git a/user.c b/user.c
index edb8fb3..ce6f6fc 100644
--- a/user.c
+++ b/user.c
@@ -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;
}
diff --git a/user.h b/user.h
index 7c69584..a524504 100644
--- a/user.h
+++ b/user.h
@@ -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;
};