aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-08-18 05:44:58 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-08-18 05:44:58 +0300
commit5ed7b33fa8ce0c91af1a58bc17636d6bf0406d24 (patch)
treed8e91ccd422c0fcf9f48c10430ff4a7962ac04bf
parent544100da719843438372c6e30739bf9b5d3ebb9c (diff)
downloadparcini-5ed7b33fa8ce0c91af1a58bc17636d6bf0406d24.tar.gz
parcini-5ed7b33fa8ce0c91af1a58bc17636d6bf0406d24.zip
README
TODO: example C program.
-rw-r--r--README.md71
1 files changed, 70 insertions, 1 deletions
diff --git a/README.md b/README.md
index 51a7edd..44986f5 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,70 @@
-# parsini
+# parcini: a PARser in C for INI files
+
+parcini is a simple parser for INI files somewhat inspired by inih. I made it
+because I wanted a somewhat different API from that of inih, and because I was
+half-way done when I found about inih.
+
+It was mainly made to serve my needs, so I intend on keeping it super minimal.
+Most probably inih or a different library might of more interest/use to you, but
+feel free to use my implementation if it fits your use-case as it fits mine.
+
+# License
+
+parcini is released under the terms of the GNU Lesser General Public License,
+version 2.1 only. For more information check the LICENSE file.
+
+# Compiling
+
+Just copy the header `include/parcini.h` and source `src/parcini.c` files to
+your project. My main goal is to statically link it, so there's no "support" to
+use it as a dynamically linked, but feel free to add it yourself.
+
+A compiler with C99 support and a libc with POSIX.1-2008 are required.
+
+The Makefile provided is just for testing purposes. The test(s) can be run
+simply by executing `make` from the command-line.
+
+## Compile-time options
+
+Currently only the following compile-time option is available:
+
+* `PARCINI_COMMENT_CHAR`: should be set to the desired character for start of
+ comment. Default is `'#'`.
+
+# INI file format
+
+There is no one standard INI file spec, but this implementation does differ some
+from most other implementations out there.
+
+* It expects only three possible value types: integer, boolean and string.
+ - Integers can be signed and should be withing the range of a long int. They
+ are parsed with `strtol()` so more information can be gathered from the
+ respective manual page.
+ - Booleans can be represented as `yes`/`no` or `true`/`false`.
+ - Strings should be surrounded by `"` quote characters, and can contain
+ quote characters without escaping, since the last quote character is
+ considered the closing one.
+* `=` is the delimiter sign for keys and values, e.g. `key = value`
+* Any white space (except newline) surrounding the `=` delimiter is ignored.
+* Any white space after the end of a value, or the ] of a section is ignored.
+Other characters are not ignored and invalidate the line, unless they are
+preceded by the comment character.
+* A new line means a new key-value, section, or comment/empty line.
+* In the default compilation comments start with `#` and can be on their own
+line or at the end of key-value and section lines.
+
+## Example INI file
+
+```ini
+int=1995
+string = "hello world"
+bool = yes
+
+# a comment
+[section]
+key="value" # another comment
+```
+
+# Example program
+
+*TODO*