diff options
author | 2023-02-03 22:41:09 +0100 | |
---|---|---|
committer | 2023-02-03 22:41:09 +0100 | |
commit | ee986164d354f4d7094f7e0fb4fcea31170f5661 (patch) | |
tree | 49d2521a53f91378786cf98107a20234077b27ca | |
parent | c0683663affb71091d7952575f3ee06e30bf9259 (diff) | |
download | string2-ee986164d354f4d7094f7e0fb4fcea31170f5661.tar.gz string2-ee986164d354f4d7094f7e0fb4fcea31170f5661.zip |
Add function to get libraryversion
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | src/string2.c | 6 | ||||
-rw-r--r-- | src/string2.h | 5 | ||||
-rw-r--r-- | test/main.c | 1 | ||||
-rw-r--r-- | test/test1.c | 7 | ||||
-rw-r--r-- | test/test1.h | 1 |
6 files changed, 20 insertions, 3 deletions
@@ -5,8 +5,9 @@ SRC != find src -name '*.c' OBJ = ${SRC:.c=.o} LIBNAME = libstr +LIBVER = 0.0.0a1 -CFLAGS = -Wall -ansi --std=c89 -pedantic ${OPT} +CFLAGS = -Wall -ansi --std=c89 -pedantic ${OPT} -DLIBVER=\"${LIBVER}\" LDFLAGS = dist: diff --git a/src/string2.c b/src/string2.c index 332dbf7..6050ea2 100644 --- a/src/string2.c +++ b/src/string2.c @@ -44,3 +44,9 @@ strstarts(const char *str, const char *end) return 0; } + +char * +strlibver(void) +{ + return LIBVER; +} diff --git a/src/string2.h b/src/string2.h index 4d79dfd..e927470 100644 --- a/src/string2.h +++ b/src/string2.h @@ -5,7 +5,8 @@ #include <string.h> -int strends(const char *, const char *); -int strstarts(const char *, const char *); +int strends(const char *, const char *); +int strstarts(const char *, const char *); +char *strlibver(void); #endif /* __STRING2_H__ */ diff --git a/test/main.c b/test/main.c index f6be903..25e1993 100644 --- a/test/main.c +++ b/test/main.c @@ -7,6 +7,7 @@ main(int argc, char **argv) { test1(); test2(); + test3(); return 0; } diff --git a/test/test1.c b/test/test1.c index 777aa5f..3f52c93 100644 --- a/test/test1.c +++ b/test/test1.c @@ -30,3 +30,10 @@ test2(void) printf("OK\n"); } + +void +test3() +{ + printf("executing %s... OK\n", __func__); + printf("%s\n", strlibver()); +} diff --git a/test/test1.h b/test/test1.h index 1b88561..79bab4c 100644 --- a/test/test1.h +++ b/test/test1.h @@ -5,5 +5,6 @@ void test1(void); void test2(void); +void test3(void); #endif /* __TEST1_H__ */ |