RE: [ndctl PATCH v2 1/2] ndctl: add the ciniparser tool from ccan

2019-01-09 Thread qi.f...@fujitsu.com
> > > > >
> > > > > Hi Qi,
> > > > >
> > > > > Thanks for these patches, and also for rebasing to the latest!
> > > > >
> > > > > ciniparser.c adds a new warning (see below). Could you fix that
> > > > > up in a new patch on top of the initial import (i.e. we retain
> > > > > the as-is import, and make a record of what we changed).
> > > > >
> > > > > Looks like the -Wformat-truncation= warnings were first
> > > > > introduced in gcc-7.1, but only became really zealous after
> > > > > gcc-8.1. The right solution here might just be to suppress it by
> > > > > adding a -Wno-format- truncation to CFLAGS, but I'm open to
> > > > > considering other alternatives.
> > > >
> > > > That warning looks pretty handy.
> > > >
> > > > >
> > > > >$ gcc --version
> > > > >gcc (GCC) 8.2.1 20181105 (Red Hat 8.2.1-5)
> > > > >
> > > > >ccan/ciniparser/ciniparser.c: In function ‘ciniparser_load’:
> > > > >ccan/ciniparser/ciniparser.c:442:39: warning: ‘%s’ directive
> > > > > output may be truncated writing up to 1024 bytes into a region
> > > > > of size between 0 and 1024 [-Wformat-truncation=]
> > > > >snprintf(tmp, ASCIILINESZ + 1, "%s:%s", section, key);
> > > > >   ^~~~~
> > > > >In file included from /usr/include/stdio.h:873,
> > > > > from ./ccan/ciniparser/ciniparser.h:39,
> > > > > from ccan/ciniparser/ciniparser.c:36:
> > > > >/usr/include/bits/stdio2.h:67:10: note:
> > > > > ‘__builtin___snprintf_chk’ output between 2 and 2050 bytes into
> > > > > a destination of size 1025
> > > > >   return __builtin___snprintf_chk (__s, __n,
> > > > > __USE_FORTIFY_LEVEL - 1,
> > > > >
> > > > > ^~
> > > > > ~~
> > > > >__bos (__s), __fmt, __va_arg_pack ());
> > > > >~
> > > >
> > > > Since it's an snprintf without the error return being checked,
> > > > perhaps it would be happier as an sprintf with a precision
> > > > specified to limit the output?
> > >
> > > That would work, but 'section' and 'key' are both ASCIILINESZ+1, so
> > > how would we specify precision for both the %s specifiers? i.e.
> > > would we have to make up an artificial split?
> >
> > Good point. No way to do it without variable precision. However,
> > looking closer I think the warning only triggers when the return value
> > is not checked, so perhaps better to just add error handling to that
> > case.
> 
> Yep that seems reasonable to me.

Hi,

Thank you for your comments.
I updated the gcc version in my local environment and got the warning messages.
I will make a new version to fix them.

Thank you.
Qi
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [ndctl PATCH v2 1/2] ndctl: add the ciniparser tool from ccan

2019-01-07 Thread Verma, Vishal L

On Mon, 2019-01-07 at 12:41 -0800, Dan Williams wrote:
> On Mon, Jan 7, 2019 at 11:03 AM Verma, Vishal L
>  wrote:
> > 
> > 
> > On Mon, 2019-01-07 at 10:56 -0800, Dan Williams wrote:
> > > On Mon, Jan 7, 2019 at 10:49 AM Verma, Vishal L
> > >  wrote:
> > > > 
> > > > 
> > > > On Mon, 2019-01-07 at 17:38 +0900, QI Fuli wrote:
> > > > > Import ciniparser tool from ccan [1], therefore, the ndctl
> > > > > monitor can
> > > > > read the configuration file by using this library.
> > > > > 
> > > > > [1]: https://ccodearchive.net/info/ciniparser.html
> > > > > 
> > > > > Signed-off-by: QI Fuli 
> > > > > ---
> > > > >  Makefile.am  |   6 +-
> > > > >  ccan/ciniparser/LICENSE  |   1 +
> > > > >  ccan/ciniparser/ciniparser.c | 480
> > > > > +++
> > > > >  ccan/ciniparser/ciniparser.h | 262 +++
> > > > >  ccan/ciniparser/dictionary.c | 266 +++
> > > > >  ccan/ciniparser/dictionary.h | 166 
> > > > >  6 files changed, 1180 insertions(+), 1 deletion(-)
> > > > >  create mode 12 ccan/ciniparser/LICENSE
> > > > >  create mode 100644 ccan/ciniparser/ciniparser.c
> > > > >  create mode 100644 ccan/ciniparser/ciniparser.h
> > > > >  create mode 100644 ccan/ciniparser/dictionary.c
> > > > >  create mode 100644 ccan/ciniparser/dictionary.h
> > > > 
> > > > Hi Qi,
> > > > 
> > > > Thanks for these patches, and also for rebasing to the latest!
> > > > 
> > > > ciniparser.c adds a new warning (see below). Could you fix that up
> > > > in a
> > > > new patch on top of the initial import (i.e. we retain the as-is
> > > > import, and make a record of what we changed).
> > > > 
> > > > Looks like the -Wformat-truncation= warnings were first introduced
> > > > in
> > > > gcc-7.1, but only became really zealous after gcc-8.1. The right
> > > > solution here might just be to suppress it by adding a -Wno-format-
> > > > truncation to CFLAGS, but I'm open to considering other
> > > > alternatives.
> > > 
> > > That warning looks pretty handy.
> > > 
> > > > 
> > > >$ gcc --version
> > > >gcc (GCC) 8.2.1 20181105 (Red Hat 8.2.1-5)
> > > > 
> > > >ccan/ciniparser/ciniparser.c: In function ‘ciniparser_load’:
> > > >ccan/ciniparser/ciniparser.c:442:39: warning: ‘%s’ directive
> > > > output may be truncated writing up to 1024 bytes into a region of
> > > > size between 0 and 1024 [-Wformat-truncation=]
> > > >snprintf(tmp, ASCIILINESZ + 1, "%s:%s", section, key);
> > > >   ^~~~~
> > > >In file included from /usr/include/stdio.h:873,
> > > > from ./ccan/ciniparser/ciniparser.h:39,
> > > > from ccan/ciniparser/ciniparser.c:36:
> > > >/usr/include/bits/stdio2.h:67:10: note:
> > > > ‘__builtin___snprintf_chk’ output between 2 and 2050 bytes into a
> > > > destination of size 1025
> > > >   return __builtin___snprintf_chk (__s, __n,
> > > > __USE_FORTIFY_LEVEL - 1,
> > > >  ^~
> > > > ~~
> > > >__bos (__s), __fmt, __va_arg_pack ());
> > > >~
> > > 
> > > Since it's an snprintf without the error return being checked,
> > > perhaps
> > > it would be happier as an sprintf with a precision specified to limit
> > > the output?
> > 
> > That would work, but 'section' and 'key' are both ASCIILINESZ+1, so how
> > would we specify precision for both the %s specifiers? i.e. would we
> > have to make up an artificial split?
> 
> Good point. No way to do it without variable precision. However,
> looking closer I think the warning only triggers when the return value
> is not checked, so perhaps better to just add error handling to that
> case.

Yep that seems reasonable to me.

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [ndctl PATCH v2 1/2] ndctl: add the ciniparser tool from ccan

2019-01-07 Thread Dan Williams
On Mon, Jan 7, 2019 at 11:03 AM Verma, Vishal L
 wrote:
>
>
> On Mon, 2019-01-07 at 10:56 -0800, Dan Williams wrote:
> > On Mon, Jan 7, 2019 at 10:49 AM Verma, Vishal L
> >  wrote:
> > >
> > >
> > > On Mon, 2019-01-07 at 17:38 +0900, QI Fuli wrote:
> > > > Import ciniparser tool from ccan [1], therefore, the ndctl
> > > > monitor can
> > > > read the configuration file by using this library.
> > > >
> > > > [1]: https://ccodearchive.net/info/ciniparser.html
> > > >
> > > > Signed-off-by: QI Fuli 
> > > > ---
> > > >  Makefile.am  |   6 +-
> > > >  ccan/ciniparser/LICENSE  |   1 +
> > > >  ccan/ciniparser/ciniparser.c | 480
> > > > +++
> > > >  ccan/ciniparser/ciniparser.h | 262 +++
> > > >  ccan/ciniparser/dictionary.c | 266 +++
> > > >  ccan/ciniparser/dictionary.h | 166 
> > > >  6 files changed, 1180 insertions(+), 1 deletion(-)
> > > >  create mode 12 ccan/ciniparser/LICENSE
> > > >  create mode 100644 ccan/ciniparser/ciniparser.c
> > > >  create mode 100644 ccan/ciniparser/ciniparser.h
> > > >  create mode 100644 ccan/ciniparser/dictionary.c
> > > >  create mode 100644 ccan/ciniparser/dictionary.h
> > >
> > > Hi Qi,
> > >
> > > Thanks for these patches, and also for rebasing to the latest!
> > >
> > > ciniparser.c adds a new warning (see below). Could you fix that up
> > > in a
> > > new patch on top of the initial import (i.e. we retain the as-is
> > > import, and make a record of what we changed).
> > >
> > > Looks like the -Wformat-truncation= warnings were first introduced
> > > in
> > > gcc-7.1, but only became really zealous after gcc-8.1. The right
> > > solution here might just be to suppress it by adding a -Wno-format-
> > > truncation to CFLAGS, but I'm open to considering other
> > > alternatives.
> >
> > That warning looks pretty handy.
> >
> > >
> > >$ gcc --version
> > >gcc (GCC) 8.2.1 20181105 (Red Hat 8.2.1-5)
> > >
> > >ccan/ciniparser/ciniparser.c: In function ‘ciniparser_load’:
> > >ccan/ciniparser/ciniparser.c:442:39: warning: ‘%s’ directive
> > > output may be truncated writing up to 1024 bytes into a region of
> > > size between 0 and 1024 [-Wformat-truncation=]
> > >snprintf(tmp, ASCIILINESZ + 1, "%s:%s", section, key);
> > >   ^~~~~
> > >In file included from /usr/include/stdio.h:873,
> > > from ./ccan/ciniparser/ciniparser.h:39,
> > > from ccan/ciniparser/ciniparser.c:36:
> > >/usr/include/bits/stdio2.h:67:10: note:
> > > ‘__builtin___snprintf_chk’ output between 2 and 2050 bytes into a
> > > destination of size 1025
> > >   return __builtin___snprintf_chk (__s, __n,
> > > __USE_FORTIFY_LEVEL - 1,
> > >  ^~
> > > ~~
> > >__bos (__s), __fmt, __va_arg_pack ());
> > >~
> >
> > Since it's an snprintf without the error return being checked,
> > perhaps
> > it would be happier as an sprintf with a precision specified to limit
> > the output?
>
> That would work, but 'section' and 'key' are both ASCIILINESZ+1, so how
> would we specify precision for both the %s specifiers? i.e. would we
> have to make up an artificial split?

Good point. No way to do it without variable precision. However,
looking closer I think the warning only triggers when the return value
is not checked, so perhaps better to just add error handling to that
case.
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [ndctl PATCH v2 1/2] ndctl: add the ciniparser tool from ccan

2019-01-07 Thread Verma, Vishal L

On Mon, 2019-01-07 at 10:56 -0800, Dan Williams wrote:
> On Mon, Jan 7, 2019 at 10:49 AM Verma, Vishal L
>  wrote:
> > 
> > 
> > On Mon, 2019-01-07 at 17:38 +0900, QI Fuli wrote:
> > > Import ciniparser tool from ccan [1], therefore, the ndctl
> > > monitor can
> > > read the configuration file by using this library.
> > > 
> > > [1]: https://ccodearchive.net/info/ciniparser.html
> > > 
> > > Signed-off-by: QI Fuli 
> > > ---
> > >  Makefile.am  |   6 +-
> > >  ccan/ciniparser/LICENSE  |   1 +
> > >  ccan/ciniparser/ciniparser.c | 480
> > > +++
> > >  ccan/ciniparser/ciniparser.h | 262 +++
> > >  ccan/ciniparser/dictionary.c | 266 +++
> > >  ccan/ciniparser/dictionary.h | 166 
> > >  6 files changed, 1180 insertions(+), 1 deletion(-)
> > >  create mode 12 ccan/ciniparser/LICENSE
> > >  create mode 100644 ccan/ciniparser/ciniparser.c
> > >  create mode 100644 ccan/ciniparser/ciniparser.h
> > >  create mode 100644 ccan/ciniparser/dictionary.c
> > >  create mode 100644 ccan/ciniparser/dictionary.h
> > 
> > Hi Qi,
> > 
> > Thanks for these patches, and also for rebasing to the latest!
> > 
> > ciniparser.c adds a new warning (see below). Could you fix that up
> > in a
> > new patch on top of the initial import (i.e. we retain the as-is
> > import, and make a record of what we changed).
> > 
> > Looks like the -Wformat-truncation= warnings were first introduced
> > in
> > gcc-7.1, but only became really zealous after gcc-8.1. The right
> > solution here might just be to suppress it by adding a -Wno-format-
> > truncation to CFLAGS, but I'm open to considering other
> > alternatives.
> 
> That warning looks pretty handy.
> 
> > 
> >$ gcc --version
> >gcc (GCC) 8.2.1 20181105 (Red Hat 8.2.1-5)
> > 
> >ccan/ciniparser/ciniparser.c: In function ‘ciniparser_load’:
> >ccan/ciniparser/ciniparser.c:442:39: warning: ‘%s’ directive
> > output may be truncated writing up to 1024 bytes into a region of
> > size between 0 and 1024 [-Wformat-truncation=]
> >snprintf(tmp, ASCIILINESZ + 1, "%s:%s", section, key);
> >   ^~~~~
> >In file included from /usr/include/stdio.h:873,
> > from ./ccan/ciniparser/ciniparser.h:39,
> > from ccan/ciniparser/ciniparser.c:36:
> >/usr/include/bits/stdio2.h:67:10: note:
> > ‘__builtin___snprintf_chk’ output between 2 and 2050 bytes into a
> > destination of size 1025
> >   return __builtin___snprintf_chk (__s, __n,
> > __USE_FORTIFY_LEVEL - 1,
> >  ^~
> > ~~
> >__bos (__s), __fmt, __va_arg_pack ());
> >~
> 
> Since it's an snprintf without the error return being checked,
> perhaps
> it would be happier as an sprintf with a precision specified to limit
> the output?

That would work, but 'section' and 'key' are both ASCIILINESZ+1, so how
would we specify precision for both the %s specifiers? i.e. would we
have to make up an artificial split?

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [ndctl PATCH v2 1/2] ndctl: add the ciniparser tool from ccan

2019-01-07 Thread Dan Williams
On Mon, Jan 7, 2019 at 10:49 AM Verma, Vishal L
 wrote:
>
>
> On Mon, 2019-01-07 at 17:38 +0900, QI Fuli wrote:
> > Import ciniparser tool from ccan [1], therefore, the ndctl monitor can
> > read the configuration file by using this library.
> >
> > [1]: https://ccodearchive.net/info/ciniparser.html
> >
> > Signed-off-by: QI Fuli 
> > ---
> >  Makefile.am  |   6 +-
> >  ccan/ciniparser/LICENSE  |   1 +
> >  ccan/ciniparser/ciniparser.c | 480 +++
> >  ccan/ciniparser/ciniparser.h | 262 +++
> >  ccan/ciniparser/dictionary.c | 266 +++
> >  ccan/ciniparser/dictionary.h | 166 
> >  6 files changed, 1180 insertions(+), 1 deletion(-)
> >  create mode 12 ccan/ciniparser/LICENSE
> >  create mode 100644 ccan/ciniparser/ciniparser.c
> >  create mode 100644 ccan/ciniparser/ciniparser.h
> >  create mode 100644 ccan/ciniparser/dictionary.c
> >  create mode 100644 ccan/ciniparser/dictionary.h
>
> Hi Qi,
>
> Thanks for these patches, and also for rebasing to the latest!
>
> ciniparser.c adds a new warning (see below). Could you fix that up in a
> new patch on top of the initial import (i.e. we retain the as-is
> import, and make a record of what we changed).
>
> Looks like the -Wformat-truncation= warnings were first introduced in
> gcc-7.1, but only became really zealous after gcc-8.1. The right
> solution here might just be to suppress it by adding a -Wno-format-
> truncation to CFLAGS, but I'm open to considering other alternatives.

That warning looks pretty handy.

>
>$ gcc --version
>gcc (GCC) 8.2.1 20181105 (Red Hat 8.2.1-5)
>
>ccan/ciniparser/ciniparser.c: In function ‘ciniparser_load’:
>ccan/ciniparser/ciniparser.c:442:39: warning: ‘%s’ directive output may be 
> truncated writing up to 1024 bytes into a region of size between 0 and 1024 
> [-Wformat-truncation=]
>snprintf(tmp, ASCIILINESZ + 1, "%s:%s", section, key);
>   ^~~~~
>In file included from /usr/include/stdio.h:873,
> from ./ccan/ciniparser/ciniparser.h:39,
> from ccan/ciniparser/ciniparser.c:36:
>/usr/include/bits/stdio2.h:67:10: note: ‘__builtin___snprintf_chk’ output 
> between 2 and 2050 bytes into a destination of size 1025
>   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
>  ^~~~
>__bos (__s), __fmt, __va_arg_pack ());
>~

Since it's an snprintf without the error return being checked, perhaps
it would be happier as an sprintf with a precision specified to limit
the output?
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [ndctl PATCH v2 1/2] ndctl: add the ciniparser tool from ccan

2019-01-07 Thread Verma, Vishal L

On Mon, 2019-01-07 at 17:38 +0900, QI Fuli wrote:
> Import ciniparser tool from ccan [1], therefore, the ndctl monitor can
> read the configuration file by using this library.
> 
> [1]: https://ccodearchive.net/info/ciniparser.html
> 
> Signed-off-by: QI Fuli 
> ---
>  Makefile.am  |   6 +-
>  ccan/ciniparser/LICENSE  |   1 +
>  ccan/ciniparser/ciniparser.c | 480 +++
>  ccan/ciniparser/ciniparser.h | 262 +++
>  ccan/ciniparser/dictionary.c | 266 +++
>  ccan/ciniparser/dictionary.h | 166 
>  6 files changed, 1180 insertions(+), 1 deletion(-)
>  create mode 12 ccan/ciniparser/LICENSE
>  create mode 100644 ccan/ciniparser/ciniparser.c
>  create mode 100644 ccan/ciniparser/ciniparser.h
>  create mode 100644 ccan/ciniparser/dictionary.c
>  create mode 100644 ccan/ciniparser/dictionary.h

Hi Qi,

Thanks for these patches, and also for rebasing to the latest!

ciniparser.c adds a new warning (see below). Could you fix that up in a
new patch on top of the initial import (i.e. we retain the as-is
import, and make a record of what we changed).

Looks like the -Wformat-truncation= warnings were first introduced in
gcc-7.1, but only became really zealous after gcc-8.1. The right
solution here might just be to suppress it by adding a -Wno-format-
truncation to CFLAGS, but I'm open to considering other alternatives.

   $ gcc --version
   gcc (GCC) 8.2.1 20181105 (Red Hat 8.2.1-5)

   ccan/ciniparser/ciniparser.c: In function ‘ciniparser_load’:
   ccan/ciniparser/ciniparser.c:442:39: warning: ‘%s’ directive output may be 
truncated writing up to 1024 bytes into a region of size between 0 and 1024 
[-Wformat-truncation=]
   snprintf(tmp, ASCIILINESZ + 1, "%s:%s", section, key);
  ^~~~~
   In file included from /usr/include/stdio.h:873,
from ./ccan/ciniparser/ciniparser.h:39,
from ccan/ciniparser/ciniparser.c:36:
   /usr/include/bits/stdio2.h:67:10: note: ‘__builtin___snprintf_chk’ output 
between 2 and 2050 bytes into a destination of size 1025
  return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
 ^~~~
   __bos (__s), __fmt, __va_arg_pack ());
   ~

> 
> diff --git a/Makefile.am b/Makefile.am
> index e0c463a..2e4b033 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -56,7 +56,11 @@ libccan_a_SOURCES = \
>   ccan/array_size/array_size.h \
>   ccan/minmax/minmax.h \
>   ccan/short_types/short_types.h \
> - ccan/endian/endian.h
> + ccan/endian/endian.h \
> + ccan/ciniparser/ciniparser.h \
> + ccan/ciniparser/ciniparser.c \
> + ccan/ciniparser/dictionary.h \
> + ccan/ciniparser/dictionary.c
>  
>  noinst_LIBRARIES += libutil.a
>  libutil_a_SOURCES = \
> diff --git a/ccan/ciniparser/LICENSE b/ccan/ciniparser/LICENSE
> new file mode 12
> index 000..2354d12
> --- /dev/null
> +++ b/ccan/ciniparser/LICENSE
> @@ -0,0 +1 @@
> +../../licenses/BSD-MIT
> \ No newline at end of file
> diff --git a/ccan/ciniparser/ciniparser.c b/ccan/ciniparser/ciniparser.c
> new file mode 100644
> index 000..527f837
> --- /dev/null
> +++ b/ccan/ciniparser/ciniparser.c
> @@ -0,0 +1,480 @@
> +/* Copyright (c) 2000-2007 by Nicolas Devillard.
> + * Copyright (x) 2009 by Tim Post 
> + * MIT License
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included in
> + * all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
> THE
> + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS IN THE SOFTWARE.
> + */
> +
> +/** @addtogroup ciniparser
> + * @{
> + */
> +/**
> + *  @file ciniparser.c
> + *  @author N. Devillard
> + *  @date Sep 2007
> + *  @version 3.0
> + *  @brief Parser for ini files.
> + */
> +
> +#include 
> +#include 
> +
> +#define ASCIILINESZ  (1024)
> +#define INI_INVALID_KEY  ((char*) NULL)
> +
> +/**
> + * This enum stores the status for each 

[ndctl PATCH v2 1/2] ndctl: add the ciniparser tool from ccan

2019-01-07 Thread QI Fuli
Import ciniparser tool from ccan [1], therefore, the ndctl monitor can
read the configuration file by using this library.

[1]: https://ccodearchive.net/info/ciniparser.html

Signed-off-by: QI Fuli 
---
 Makefile.am  |   6 +-
 ccan/ciniparser/LICENSE  |   1 +
 ccan/ciniparser/ciniparser.c | 480 +++
 ccan/ciniparser/ciniparser.h | 262 +++
 ccan/ciniparser/dictionary.c | 266 +++
 ccan/ciniparser/dictionary.h | 166 
 6 files changed, 1180 insertions(+), 1 deletion(-)
 create mode 12 ccan/ciniparser/LICENSE
 create mode 100644 ccan/ciniparser/ciniparser.c
 create mode 100644 ccan/ciniparser/ciniparser.h
 create mode 100644 ccan/ciniparser/dictionary.c
 create mode 100644 ccan/ciniparser/dictionary.h

diff --git a/Makefile.am b/Makefile.am
index e0c463a..2e4b033 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -56,7 +56,11 @@ libccan_a_SOURCES = \
ccan/array_size/array_size.h \
ccan/minmax/minmax.h \
ccan/short_types/short_types.h \
-   ccan/endian/endian.h
+   ccan/endian/endian.h \
+   ccan/ciniparser/ciniparser.h \
+   ccan/ciniparser/ciniparser.c \
+   ccan/ciniparser/dictionary.h \
+   ccan/ciniparser/dictionary.c
 
 noinst_LIBRARIES += libutil.a
 libutil_a_SOURCES = \
diff --git a/ccan/ciniparser/LICENSE b/ccan/ciniparser/LICENSE
new file mode 12
index 000..2354d12
--- /dev/null
+++ b/ccan/ciniparser/LICENSE
@@ -0,0 +1 @@
+../../licenses/BSD-MIT
\ No newline at end of file
diff --git a/ccan/ciniparser/ciniparser.c b/ccan/ciniparser/ciniparser.c
new file mode 100644
index 000..527f837
--- /dev/null
+++ b/ccan/ciniparser/ciniparser.c
@@ -0,0 +1,480 @@
+/* Copyright (c) 2000-2007 by Nicolas Devillard.
+ * Copyright (x) 2009 by Tim Post 
+ * MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/** @addtogroup ciniparser
+ * @{
+ */
+/**
+ *  @file ciniparser.c
+ *  @author N. Devillard
+ *  @date Sep 2007
+ *  @version 3.0
+ *  @brief Parser for ini files.
+ */
+
+#include 
+#include 
+
+#define ASCIILINESZ  (1024)
+#define INI_INVALID_KEY  ((char*) NULL)
+
+/**
+ * This enum stores the status for each parsed line (internal use only).
+ */
+typedef enum _line_status_ {
+   LINE_UNPROCESSED,
+   LINE_ERROR,
+   LINE_EMPTY,
+   LINE_COMMENT,
+   LINE_SECTION,
+   LINE_VALUE
+} line_status;
+
+
+/**
+ * @brief Convert a string to lowercase.
+ * @param s String to convert.
+ * @return ptr to statically allocated string.
+ *
+ * This function returns a pointer to a statically allocated string
+ * containing a lowercased version of the input string. Do not free
+ * or modify the returned string! Since the returned string is statically
+ * allocated, it will be modified at each function call (not re-entrant).
+ */
+static char *strlwc(const char *s)
+{
+   static char l[ASCIILINESZ+1];
+   int i;
+
+   if (s == NULL)
+   return NULL;
+
+   for (i = 0; s[i] && i < ASCIILINESZ; i++)
+   l[i] = tolower(s[i]);
+   l[i] = '\0';
+   return l;
+}
+
+/**
+ * @brief Remove blanks at the beginning and the end of a string.
+ * @param s String to parse.
+ * @return ptr to statically allocated string.
+ *
+ * This function returns a pointer to a statically allocated string,
+ * which is identical to the input string, except that all blank
+ * characters at the end and the beg. of the string have been removed.
+ * Do not free or modify the returned string! Since the returned string
+ * is statically allocated, it will be modified at each function call
+ * (not re-entrant).
+ */
+static char *strstrip(const char *s)
+{
+   static char l[ASCIILINESZ+1];
+   unsigned int i, numspc;
+
+   if (s == NULL)
+   return NULL;
+
+   while (isspace(*s))
+   s++;
+
+   for (i = numspc = 0; s[i] && i < ASCIILINESZ; i++) {
+