--- Daodan/src/inifile_reader.c 2009/06/09 12:00:41 346 +++ Daodan/src/inifile_reader.c 2009/06/13 01:44:53 352 @@ -5,8 +5,22 @@ #include #include "inifile.h" - -bool inifile_read(char* filename, inifile_callback callback) +/* +char* inifile_cleanstr(char* str) +{ + while (isspace(*str)) + str++; + + int i; + for (i = 0; str[i]; i ++) + { + if + } + + return str; +} +*/ +bool inifile_read(const char* filename, inifile_callback callback) { FILE* fp = fopen(filename, "r"); char* inisection = ""; @@ -42,7 +56,7 @@ bool inifile_read(char* filename, inifil if (inisection[0]) free(inisection); - inisection = strdup(readptr + 1); + inisection = strdup(readptr + 1); // Skip the first [ newsection = true; } else // It's a value. @@ -56,14 +70,14 @@ bool inifile_read(char* filename, inifil if (readptr[i - 1] == '\n') readptr[i - 1] = '\0'; // Remove the trailing newline. - if (equals) // If there's no equals, crash with error. + if (equals) { readptr[equals] = '\0'; if (!callback(inisection, newsection, readptr, readptr + equals + 1)) // If the callback is false, exit. break; newsection = false; } - else + else // If there's no equals, crash with error. { success = false; break;