X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=UDI%2FTools%2Fudibuild_src%2Finifile.c;h=50b0684c0296724452aa16073a41456b4e1047c6;hb=07e446727e54a17327b53928ce8582ba10eec619;hp=d52a845d9f9eebe0c78fcb24b086dcdadc240020;hpb=8fe56f1234442dfa971e069bb8c139918430d511;p=tpg%2Facess2.git diff --git a/UDI/Tools/udibuild_src/inifile.c b/UDI/Tools/udibuild_src/inifile.c index d52a845d..50b0684c 100644 --- a/UDI/Tools/udibuild_src/inifile.c +++ b/UDI/Tools/udibuild_src/inifile.c @@ -1,6 +1,7 @@ /* * udibuild - UDI Compilation Utility * - By John Hodge (thePowersGang) + * Part of the Acess2 OS Project * * inifile.c * - .ini file parsing @@ -77,6 +78,8 @@ tIniFile *IniFile_Load(const char *Path) curSect = new_sect; } else if( sscanf(buf, "%[^=]=%n", name, &ofs) >= 1 ) { + rtrim(name); + while( isspace(buf[ofs]) ) ofs ++; //printf("key %s equals %s\n", name, value); const char *value = buf + ofs; tIniFile_Value *val = malloc(sizeof(tIniFile_Value)+strlen(name)+1+strlen(value)+1); @@ -101,6 +104,9 @@ tIniFile *IniFile_Load(const char *Path) const char *IniFile_Get(tIniFile *File, const char *Sect, const char *Key, const char *Default) { + if( !File ) + return Default; + tIniFile_Section *sect; for( sect = &File->RootSection; sect; sect = sect->Next ) {