Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/alpm.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-09-21 10:31:30 -0500
committerDan McGee <dan@archlinux.org>2011-09-22 10:32:35 -0500
commitd36d70d2947b1c6a161f6bf55ddd19445f2c81cb (patch)
tree1f441576947995ed213141f5e62f8eae57c28108 /lib/libalpm/alpm.c
parent33f251853155fd1e04d03fbaffb3849ab8e953dc (diff)
Add alpm_capabilities() method and enumeration
This allows a frontend program to query, at runtime, what the library supports. This can be useful for sanity checking during config- requiring a downloader or disallowing signature settings, for example. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/alpm.c')
-rw-r--r--lib/libalpm/alpm.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index 585c6a82..f9dd8d38 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -133,9 +133,30 @@ int SYMEXPORT alpm_release(alpm_handle_t *myhandle)
* @brief Various libalpm functions
*/
-/* Get the version of library */
-const char SYMEXPORT *alpm_version(void) {
+/** Get the version of library.
+ * @return the library version, e.g. "6.0.4"
+ * */
+const char SYMEXPORT *alpm_version(void)
+{
return LIB_VERSION;
}
+/** Get the capabilities of the library.
+ * @return a bitmask of the capabilities
+ * */
+enum alpm_caps SYMEXPORT alpm_capabilities(void)
+{
+ return 0
+#ifdef ENABLE_NLS
+ | ALPM_CAPABILITY_NLS
+#endif
+#ifdef HAVE_LIBCURL
+ | ALPM_CAPABILITY_DOWNLOADER
+#endif
+#ifdef HAVE_LIBGPGME
+ | ALPM_CAPABILITY_SIGNATURES
+#endif
+ | 0;
+}
+
/* vim: set ts=2 sw=2 noet: */