From 35916ebddc6b6621893ce171fa1282e66a2aeda6 Mon Sep 17 00:00:00 2001 From: "nion@h4447.serverkompetenz.net" Date: Wed, 8 Mar 2006 15:10:46 +0100 Subject: [PATCH] added lower function to work only with lowercase channel-names --- ii.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ii.c b/ii.c index 5732681..88651bc 100644 --- a/ii.c +++ b/ii.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -52,6 +53,11 @@ static void usage() " [-n ] [-k ] [-f ]\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); }