core: add a function for accessing the library version string
authorBartosz Golaszewski <bartekgola@gmail.com>
Fri, 13 Jan 2017 14:25:23 +0000 (15:25 +0100)
committerBartosz Golaszewski <bartekgola@gmail.com>
Fri, 13 Jan 2017 14:25:23 +0000 (15:25 +0100)
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
core.c
gpiod.h

diff --git a/core.c b/core.c
index abfa8b1a7b26db530f269ce55f367a87c462f39f..ddd19ae04d5bd26007caf3eab99c99cc1b113052 100644 (file)
--- a/core.c
+++ b/core.c
@@ -1077,3 +1077,8 @@ struct gpiod_line * gpiod_line_iter_next(struct gpiod_line_iter *iter)
 
        return line;
 }
+
+const char * gpiod_version_string(void)
+{
+       return PACKAGE_VERSION;
+}
diff --git a/gpiod.h b/gpiod.h
index b5b4e2e769be34c3ea24cd922c176c51a1ca4962..f6cfefdd22350648257777a00ad994e12a53c1bc 100644 (file)
--- a/gpiod.h
+++ b/gpiod.h
@@ -1003,6 +1003,21 @@ gpiod_line_iter_last_offset(const struct gpiod_line_iter *iter)
             !gpiod_line_iter_done(iter);                               \
             (line) = gpiod_line_iter_next(iter))
 
+/**
+ * @}
+ *
+ * @defgroup __misc__ Stuff that didn't fit anywhere else
+ * @{
+ *
+ * Various libgpiod-related functions.
+ */
+
+/**
+ * @brief Get the version of the library as a human-readable string.
+ * @return Human-readable string containing the library version.
+ */
+const char * gpiod_version_string(void) GPIOD_API;
+
 /**
  * @}
  */