summaryrefslogtreecommitdiff
path: root/src/bin/eina
diff options
context:
space:
mode:
authorAmitesh Singh <amitesh.sh@samsung.com>2016-08-31 16:17:52 +0530
committerAmitesh Singh <amitesh.sh@samsung.com>2016-08-31 16:17:53 +0530
commitd88f08f7e92a06ce114466da41886463be58c8d8 (patch)
treedb1e25816e0eab568561aa0cf78e981560729c52 /src/bin/eina
parentf88a4b8308a45889960eb842ff0300ce9079d755 (diff)
eina: module - Add macros for adding module informations
Summary: These macros allow you to define module informations like author/description/version/license e.g. // Use "Name <email id>" or just "Name" EINA_MODULE_AUTHOR("Enlightenment Community"); // Mention license EINA_MODULE_LICENSE("GPL v2"); // What your module does EINA_MODULE_DESCRIPTION("This is what this module does"); // Module version EINA_MODULE_VERSION("0.1"); Now eina_modinfo can show these informations to users $ eina_modinfo module.so version: 0.1 description: Entry test license: GPLv2 author: Enlightenment Community @feature Reviewers: cedric, tasn, raster, jpeg Subscribers: seoz Differential Revision: https://phab.enlightenment.org/D4257
Diffstat (limited to 'src/bin/eina')
-rw-r--r--src/bin/eina/.gitignore1
-rw-r--r--src/bin/eina/eina_modinfo.c57
2 files changed, 58 insertions, 0 deletions
diff --git a/src/bin/eina/.gitignore b/src/bin/eina/.gitignore
index ec4ebaa080..a35f69e48e 100644
--- a/src/bin/eina/.gitignore
+++ b/src/bin/eina/.gitignore
@@ -1 +1,2 @@
1eina_btlog 1eina_btlog
2eina_modinfo
diff --git a/src/bin/eina/eina_modinfo.c b/src/bin/eina/eina_modinfo.c
new file mode 100644
index 0000000000..943c92b3b7
--- /dev/null
+++ b/src/bin/eina/eina_modinfo.c
@@ -0,0 +1,57 @@
1/* EINA - EFL data type library
2 * Copyright (C) 2016 Amitesh Singh
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library;
16 * if not, see <http://www.gnu.org/licenses/>.
17 *
18 * --------------- usage ---------------------
19 * $ eina_modinfo <module.so>
20 */
21
22#include <Eina.h>
23
24int main(int argc, char **argv)
25{
26 Eina_Module *em;
27
28 eina_init();
29 if (argc != 2)
30 {
31 fprintf(stderr, "Error: Missing module or filename\n");
32 return 1;
33 }
34
35 em = eina_module_new(argv[1]);
36 if (!em)
37 {
38 fprintf(stderr, "Error: Failed to open: %s\n", argv[1]);
39 return 2;
40 }
41 if (!eina_module_load(em))
42 {
43 fprintf(stderr, "Error: Failed to load module\n");
44 eina_module_free(em);
45 return 3;
46 }
47
48 printf("version: %s\n", (char *)eina_module_symbol_get(em, "__EINA_MODULE_UNIQUE_ID_ver"));
49 printf("description: %s\n", (char *)eina_module_symbol_get(em, "__EINA_MODULE_UNIQUE_ID_desc"));
50 printf("license: %s\n", (char *)eina_module_symbol_get(em, "__EINA_MODULE_UNIQUE_ID_license"));
51 printf("author: %s\n", (char *)eina_module_symbol_get(em, "__EINA_MODULE_UNIQUE_ID_author"));
52
53 eina_module_free(em);
54 eina_shutdown();
55
56 return 0;
57}