ii

git clone https://orangeshoelaces.net/git/ii.git

35916ebddc6b6621893ce171fa1282e66a2aeda6

Author: nion@h4447.serverkompetenz.net on 03/08/2006

Committer: nion@h4447.serverkompetenz.net on 03/08/2006

added lower function to work only with lowercase channel-names

Stats

ii.c | 10 ++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

Patch

diff --git a/ii.c b/ii.c
index 5732681..88651bc 100644
--- a/ii.c
+++ b/ii.c
@@ -17,6 +17,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <ctype.h>
 #include <time.h>
 #include <unistd.h>
 
@@ -52,6 +53,11 @@ static void usage()
 			"          [-n <nick>] [-k <password>] [-f <fullname>]\n");
 	exit(EXIT_SUCCESS);
 }
+static char *lower(char *s)
+{
+	char *p; for(p = s; p && *p; p++) *p = tolower(*p);
+	return s;
+}
 
 /* creates directories top-down, if necessary */
 static void create_dirtree(const char *dir)
@@ -76,10 +82,10 @@ static void create_dirtree(const char *dir)
 static int get_filepath(char *filepath, size_t len, char *channel, char *file)
 {
 	if(channel) {
-		if(!snprintf(filepath, len, "%s/%s", path, channel))
+		if(!snprintf(filepath, len, "%s/%s", path, lower(channel)))
 			return 0;
 		create_dirtree(filepath);
-		return snprintf(filepath, len, "%s/%s/%s", path, channel, file);
+		return snprintf(filepath, len, "%s/%s/%s", path,lower(channel), file);
 	}
 	return snprintf(filepath, len, "%s/%s", path, file);
 }