Index: .bzrignore
===================================================================
--- .bzrignore	(revision bf25fa3627c00f80bad624bb4549c46e4b084279)
+++ .bzrignore	(revision 66b9e86eafc3709c491f96c917069db8b6a0c895)
@@ -13,2 +13,5 @@
 .gdb_history
 tests/check
+*.gcda
+*.gcov
+*.gcno
Index: Makefile
===================================================================
--- Makefile	(revision bf25fa3627c00f80bad624bb4549c46e4b084279)
+++ Makefile	(revision 66b9e86eafc3709c491f96c917069db8b6a0c895)
@@ -12,5 +12,5 @@
 objects = account.o bitlbee.o conf.o crypting.o help.o ini.o ipc.o irc.o irc_commands.o log.o nick.o query.o root_commands.o set.o storage.o storage_text.o unix.o url.o user.o util.o
 headers = account.h bitlbee.h commands.h conf.h config.h crypting.h help.h ini.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h url.h user.h protocols/http_client.h protocols/md5.h protocols/nogaim.h protocols/proxy.h protocols/sha.h protocols/ssl_client.h
-subdirs = protocols
+subdirs = protocols 
 
 # Expansion of variables
@@ -40,11 +40,16 @@
 clean: $(subdirs)
 	rm -f *.o $(OUTFILE) core utils/bitlbeed encode decode
+	$(MAKE) -C tests clean
 
 distclean: clean $(subdirs)
 	rm -f Makefile.settings config.h
 	find . -name 'DEADJOE' -o -name '*.orig' -o -name '*.rej' -o -name '*~' -exec rm -f {} \;
+	$(MAKE) -C test distclean
 
-check:
+check: all
 	$(MAKE) -C tests
+
+gcov: check
+	gcov *.c
 
 install-doc:
Index: configure
===================================================================
--- configure	(revision bf25fa3627c00f80bad624bb4549c46e4b084279)
+++ configure	(revision 66b9e86eafc3709c491f96c917069db8b6a0c895)
@@ -28,4 +28,5 @@
 debug=0
 strip=1
+gcov=0
 ipv6=1
 
@@ -64,4 +65,5 @@
 --debug=0/1	Disable/enable debugging		$debug
 --strip=0/1	Disable/enable binary stripping		$strip
+--gcov=0/1	Disable/enable test coverage reporting	$gcov
 
 --ipv6=0/1	IPv6 socket support			$ipv6
@@ -314,4 +316,9 @@
 fi
 
+if [ "$gcov" = "1" ]; then
+	echo "CFLAGS+=-ftest-coverage -fprofile-arcs" >> Makefile.settings
+	echo "EFLAGS+=-lgcov" >> Makefile.settings
+fi
+
 echo
 if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then
Index: protocols/Makefile
===================================================================
--- protocols/Makefile	(revision bf25fa3627c00f80bad624bb4549c46e4b084279)
+++ protocols/Makefile	(revision 66b9e86eafc3709c491f96c917069db8b6a0c895)
@@ -26,4 +26,7 @@
 # [SH] Phony targets
 all: protocols.o
+check: all
+gcov:
+	gcov *.c
 
 .PHONY: all clean distclean $(subdirs)
Index: protocols/jabber/Makefile
===================================================================
--- protocols/jabber/Makefile	(revision bf25fa3627c00f80bad624bb4549c46e4b084279)
+++ protocols/jabber/Makefile	(revision 66b9e86eafc3709c491f96c917069db8b6a0c895)
@@ -17,4 +17,5 @@
 # [SH] Phony targets
 all: jabber_mod.o
+check: all
 
 .PHONY: all clean distclean
Index: protocols/msn/Makefile
===================================================================
--- protocols/msn/Makefile	(revision bf25fa3627c00f80bad624bb4549c46e4b084279)
+++ protocols/msn/Makefile	(revision 66b9e86eafc3709c491f96c917069db8b6a0c895)
@@ -17,4 +17,7 @@
 # [SH] Phony targets
 all: msn_mod.o
+check: all
+gcov: 
+	gcov *.c
 	
 .PHONY: all clean distclean
Index: protocols/oscar/Makefile
===================================================================
--- protocols/oscar/Makefile	(revision bf25fa3627c00f80bad624bb4549c46e4b084279)
+++ protocols/oscar/Makefile	(revision 66b9e86eafc3709c491f96c917069db8b6a0c895)
@@ -17,4 +17,7 @@
 # [SH] Phony targets
 all: oscar_mod.o
+check: all
+gcov:
+	gcov *.c
 
 .PHONY: all clean distclean
Index: protocols/yahoo/Makefile
===================================================================
--- protocols/yahoo/Makefile	(revision bf25fa3627c00f80bad624bb4549c46e4b084279)
+++ protocols/yahoo/Makefile	(revision 66b9e86eafc3709c491f96c917069db8b6a0c895)
@@ -17,4 +17,7 @@
 # [SH] Phony targets
 all: yahoo_mod.o
+check: all
+gcov: 
+	gcov *.c
 
 .PHONY: all clean distclean
Index: tests/Makefile
===================================================================
--- tests/Makefile	(revision bf25fa3627c00f80bad624bb4549c46e4b084279)
+++ tests/Makefile	(revision 66b9e86eafc3709c491f96c917069db8b6a0c895)
@@ -3,10 +3,15 @@
 LFLAGS +=-lcheck
 
-all: check
+all: check 
 	./check
+
+clean:
+	rm -f check *.o
 
 main_objs = account.o bitlbee.o conf.o crypting.o help.o ini.o ipc.o irc.o irc_commands.o log.o nick.o query.o root_commands.o set.o storage.o storage_text.o url.o user.o util.o 
 
-check: check.o check_util.o check_nick.o $(addprefix ../, $(main_objs)) ../protocols/protocols.o
+test_objs = check.o check_util.o check_nick.o
+
+check: $(test_objs) $(addprefix ../, $(main_objs)) ../protocols/protocols.o
 	@echo '*' Linking $@
 	@$(CC) $(CFLAGS) -o $@ $^ $(LFLAGS) $(EFLAGS)
Index: tests/check_nick.c
===================================================================
--- tests/check_nick.c	(revision bf25fa3627c00f80bad624bb4549c46e4b084279)
+++ tests/check_nick.c	(revision 66b9e86eafc3709c491f96c917069db8b6a0c895)
@@ -23,5 +23,5 @@
 
 	for (i = 0; get[i]; i++) {
-		char copy[30];
+		char copy[60];
 		strcpy(copy, get[i]);
 		nick_strip(copy);
