From f95ba68da990aef8cd66ef934c7daf3d372c52de Mon Sep 17 00:00:00 2001 From: M.Gergő Date: Wed, 27 May 2020 02:56:06 +0200 Subject: New function: lciniGetVersionStr() --- src/ini_read.c | 10 ++++++++++ src/lightconfini.h | 1 + src/main.c | 9 ++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ini_read.c b/src/ini_read.c index e58bc80..b712163 100644 --- a/src/ini_read.c +++ b/src/ini_read.c @@ -994,3 +994,13 @@ int lciniGetFromFileStr(const char *filename, const char *section, const char *p } return r; } + + +char *lciniGetVersionStr(void){ +#ifdef GIT_LAST + char *ret = GIT_LAST; +# else + char *ret = ""; +#endif + return ret; +} \ No newline at end of file diff --git a/src/lightconfini.h b/src/lightconfini.h index 748e1cd..44929db 100644 --- a/src/lightconfini.h +++ b/src/lightconfini.h @@ -59,6 +59,7 @@ size_t lciniFileMaxLineLen(FILE *tfd); lcini_shortret *lciniMKShortRet(int bufflen); void lciniDestroyShortRet(lcini_shortret *dt); +char *lciniGetVersionStr(void); #endif /* LIGHTCONFINI_H_INCLUDED */ diff --git a/src/main.c b/src/main.c index ff84fd4..c5d9690 100644 --- a/src/main.c +++ b/src/main.c @@ -60,6 +60,7 @@ int main(int argc, char* argv[]){ /*lcini_data *(*lciniCreateNode)( lcini_data *head, int lineLen ); */ /*lcini_shortret *(*lciniMKShortRet)(int bufflen); */ void (*lciniDestroyShortRet)(lcini_shortret *dt); + char *(*lciniGetVersionStr)(void); #endif if(argc > 1){ memset(filename, 0, 4096); @@ -78,6 +79,8 @@ int main(int argc, char* argv[]){ if(!hl){ printf("\nDynamic Library load error - %s \nexit\n",dlerror()); exit(1); + } else { + printf("\nDynamic Library loaded: %s", linkpath); } lciniFileMaxLineLen = dlsym(hl, "lciniFileMaxLineLen"); if((buff1 = dlerror()) != NULL){ @@ -127,8 +130,11 @@ int main(int argc, char* argv[]){ if((buff1 = dlerror()) != NULL){ printf("\nsym err - %s\n", buff1); } + lciniGetVersionStr = dlsym(hl, "lciniGetVersionStr"); + if((buff1 = dlerror()) != NULL){ + printf("\nsym err - %s\n", buff1); + } - #endif @@ -233,6 +239,7 @@ int main(int argc, char* argv[]){ free(buff4); free(buff5); free(buff6); + printf("\n\nLightConfINI Version: %s \n", lciniGetVersionStr()); printf("\n -- end --\n"); #ifdef TESTLIBD dlclose(hl); -- cgit v1.2.3