.gear/rules | 4 +++ .gear/tags/list | 1 + AUTHORS | 3 +- Makefile | 2 +- iniparser.pc | 12 ++++++++ iniparser.spec | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/dictionary.c | 2 +- src/dictionary.h | 2 +- src/iniparser.c | 2 +- test/make-tests.sh | 8 +++-- test/test_iniparser.c | 4 +-- 11 files changed, 112 insertions(+), 10 deletions(-) diff --git a/.gear/rules b/.gear/rules new file mode 100644 index 0000000..2b462dd --- /dev/null +++ b/.gear/rules @@ -0,0 +1,4 @@ +tar: v@version@:. +diff: v@version@:. . +copy?: *.patch + diff --git a/.gear/tags/list b/.gear/tags/list new file mode 100644 index 0000000..c88035e --- /dev/null +++ b/.gear/tags/list @@ -0,0 +1 @@ +0a38e85c9cde1e099ca3bf70083bd00f89c3e5b6 v4.1 diff --git a/AUTHORS b/AUTHORS index d5a3f6b..bf12942 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,4 +1,5 @@ -Author: Nicolas Devillard +Authors: +Nicolas Devillard @ndevilla, Emmanuel Leblond @TouilleMan This tiny library has received countless contributions and I have not kept track of all the people who contributed. Let them be thanked diff --git a/Makefile b/Makefile index a5a4ab2..4876c19 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ ARFLAGS = rcv SHLD = ${CC} ${CFLAGS} LDSHFLAGS = -shared -Wl,-Bsymbolic -LDFLAGS += -Wl,-rpath -Wl,/usr/lib -Wl,-rpath,/usr/lib +#LDFLAGS += -Wl,-rpath -Wl,/usr/lib -Wl,-rpath,/usr/lib # .so.0 is for version 3.x, .so.1 is 4.x SO_TARGET ?= libiniparser.so.1 diff --git a/iniparser.pc b/iniparser.pc new file mode 100644 index 0000000..1a0cd0d --- /dev/null +++ b/iniparser.pc @@ -0,0 +1,12 @@ +prefix=/usr +exec_prefix=/usr +libdir=${exec_prefix}/lib +includedir=${prefix}/include +datarootdir=${prefix}/share +datadir=${datarootdir} + +Name: libiniparser +Description: Iniparser library +Version: 4.1 +Libs: -L${libdir} -liniparser +Cflags: -I${includedir} diff --git a/iniparser.spec b/iniparser.spec new file mode 100644 index 0000000..ce01ca1 --- /dev/null +++ b/iniparser.spec @@ -0,0 +1,82 @@ +%define _name iniparser +# .so.0 is for version 3.x, .so.1 is 4.x +%define sover 1 + +Name: lib%_name +Version: 4.1 +Release: alt1 + +Group: Development/C +Summary: Simple C library for parsing "INI-style" files +License: MIT +Url: http://ndevilla.free.fr/iniparser/ + +Vcs: https://github.com/ndevilla/iniparser.git +Source: %name-%version.tar +Patch: %name-%version-%release.patch + +%description +iniParser is an ANSI C library to parse "INI-style" files, +often used to hold application configuration information. + +%package -n %name%sover +Summary: Simple C library for parsing "INI-style" files +Group: System/Libraries +Provides: %name = %EVR + +%description -n %name%sover +iniParser is an ANSI C library to parse "INI-style" files, +often used to hold application configuration information. + +%package devel +Summary: Development files for %_name +Group: Development/C +Requires: %name%sover = %EVR + +%description devel +This package contains the header files, development files and +documentation for %_name library. + +%prep +%setup +%patch -p1 +# fix pc-file +sed -i 's|\/lib|/%_lib| + s|\(-I${includedir}\)|\1/%_name|' %_name.pc + +%build +%make_build CFLAGS='%optflags %optflags_shared %(getconf LFS_CFLAGS)' libiniparser.so.%sover + +%install +%define docdir %_docdir/%name-%version +mkdir -p %buildroot{%_libdir,%_includedir/%_name,%_pkgconfigdir,%docdir} +install -pm644 %name.so.%sover %buildroot%_libdir/ +ln -s %name.so.%sover %buildroot%_libdir/%name.so +install -pm644 src/*.h %buildroot%_includedir/%_name/ +install -pm644 %_name.pc %buildroot%_pkgconfigdir/ +install -pm644 LICENSE html/* %buildroot%docdir/ + +%files -n %name%sover +%_libdir/%name.so.%sover +%dir %docdir +%docdir/LICENSE + +%files devel +%_libdir/%name.so +%_includedir/%_name/ +%_pkgconfigdir/%_name.pc +%dir %docdir +%docdir/*.* + +%changelog +* Tue Dec 21 2021 Yuri N. Sedunov 4.1-alt1 +- updated to v4.1-11-gdeb85ad (bumped soname) +- moved headers to %%_includedir/iniparser +- added .pc file + +* Thu Apr 26 2012 Anton V. Boyarshinov 3.1-alt2 +- great spec cleanup thanks to ldv@ + +* Wed Apr 25 2012 Anton V. Boyarshinov 3.1-alt1 +- initial build + diff --git a/src/dictionary.c b/src/dictionary.c index cb7ccd4..aa3d232 100644 --- a/src/dictionary.c +++ b/src/dictionary.c @@ -140,7 +140,7 @@ unsigned dictionary_hash(const char * key) /** @brief Create a new dictionary object. @param size Optional initial size of the dictionary. - @return 1 newly allocated dictionary objet. + @return 1 newly allocated dictionary object. This function allocates a new dictionary object of given size and returns it. If you do not know in advance (roughly) the number of entries in the diff --git a/src/dictionary.h b/src/dictionary.h index d04b6ce..f0fd540 100644 --- a/src/dictionary.h +++ b/src/dictionary.h @@ -73,7 +73,7 @@ unsigned dictionary_hash(const char * key); /** @brief Create a new dictionary object. @param size Optional initial size of the dictionary. - @return 1 newly allocated dictionary objet. + @return 1 newly allocated dictionary object. This function allocates a new dictionary object of given size and returns it. If you do not know in advance (roughly) the number of entries in the diff --git a/src/iniparser.c b/src/iniparser.c index fffdf9f..f1d1658 100644 --- a/src/iniparser.c +++ b/src/iniparser.c @@ -718,7 +718,7 @@ dictionary * iniparser_load(const char * ininame) char line [ASCIILINESZ+1] ; char section [ASCIILINESZ+1] ; char key [ASCIILINESZ+1] ; - char tmp [(ASCIILINESZ * 2) + 1] ; + char tmp [(ASCIILINESZ * 2) + 2] ; char val [ASCIILINESZ+1] ; int last=0 ; diff --git a/test/make-tests.sh b/test/make-tests.sh index f2a3f2a..78e6901 100755 --- a/test/make-tests.sh +++ b/test/make-tests.sh @@ -26,10 +26,11 @@ cat $FILES | grep '^void Test' | echo \ ' -void RunAllTests(void) +int RunAllTests(void) { CuString *output = CuStringNew(); CuSuite* suite = CuSuiteNew(); + int ret = 0; ' cat $FILES | grep '^void Test' | @@ -42,15 +43,16 @@ echo \ ' CuSuiteRun(suite); CuSuiteSummary(suite, output); + if (suite->failCount > 0) ret = 1; CuSuiteDetails(suite, output); printf("%s\n", output->buffer); CuStringDelete(output); CuSuiteDelete(suite); + return ret; } int main(void) { - RunAllTests(); - return 0; + return RunAllTests(); } ' diff --git a/test/test_iniparser.c b/test/test_iniparser.c index c76529c..b7cd5fc 100644 --- a/test/test_iniparser.c +++ b/test/test_iniparser.c @@ -96,7 +96,7 @@ void Test_iniparser_strstrip(CuTest *tc) }; const char *test_with_spaces = "I am a test with\tspaces."; char stripped[ASCIILINESZ+1]; - char error_msg[128]; + char error_msg[1060]; unsigned i; /* NULL ptr as input */ @@ -595,7 +595,7 @@ void Test_iniparser_load(CuTest *tc) struct dirent *curr; struct stat curr_stat; dictionary *dic; - char ini_path[256]; + char ini_path[276]; /* Dummy tests */ dic = iniparser_load("/you/shall/not/path");