From 262eacedca4b163c5e095b742e12c29cd9f4ac9d Mon Sep 17 00:00:00 2001 From: broth-itk Date: Mon, 1 Jul 2019 06:22:26 +0200 Subject: [PATCH] Added freefare_version() function (#104) Added freefare_version() function --- libfreefare/Makefile.am | 1 + libfreefare/freefare.3 | 9 ++++++++- libfreefare/freefare.c | 10 ++++++++++ libfreefare/freefare.h | 2 ++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/libfreefare/Makefile.am b/libfreefare/Makefile.am index fbd6faa..e8663aa 100644 --- a/libfreefare/Makefile.am +++ b/libfreefare/Makefile.am @@ -52,6 +52,7 @@ linkedman = \ freefare.3 freefare_get_tag_type.3 \ freefare.3 freefare_get_tag_uid.3 \ freefare.3 freefare_get_tags.3 \ + freefare.3 freefare_version.3 \ freefare_error.3 freefare_perror.3 \ freefare_error.3 freefare_strerror.3 \ freefare_error.3 freefare_strerror_r.3 \ diff --git a/libfreefare/freefare.3 b/libfreefare/freefare.3 index 7cc8385..f3dc9ad 100644 --- a/libfreefare/freefare.3 +++ b/libfreefare/freefare.3 @@ -28,7 +28,8 @@ .Nm freefare_get_tag_friendly_name , .Nm freefare_get_tag_uid , .Nm freefare_free_tag , -.Nm freefare_free_tags +.Nm freefare_free_tags , +.Nm freefare_version .Nd Generic target manipulation functions .\" _ _ _ .\" | | (_) |__ _ __ __ _ _ __ _ _ @@ -69,6 +70,8 @@ enum freefare_tag_type { .Fn freefare_free_tag "FreefareTag tags" .Ft "void" .Fn freefare_free_tags "FreefareTag *tags" +.Ft "const char *" +.Fn freefare_version .\" ____ _ _ _ .\" | _ \ ___ ___ ___ _ __(_)_ __ | |_(_) ___ _ __ .\" | | | |/ _ \/ __|/ __| '__| | '_ \| __| |/ _ \| '_ \ @@ -117,6 +120,10 @@ can be gathered using the and .Fn freefare_get_tag_friendly_name functions. +.Pp +The +.Fn freefare_version +function returns the version of the library. .\" ____ _ _ .\" | _ \ ___| |_ _ _ _ __ _ __ __ ____ _| |_ _ ___ ___ .\" | |_) / _ \ __| | | | '__| '_ \ \ \ / / _` | | | | |/ _ \/ __| diff --git a/libfreefare/freefare.c b/libfreefare/freefare.c index a5ad3fa..79b98ba 100644 --- a/libfreefare/freefare.c +++ b/libfreefare/freefare.c @@ -213,6 +213,16 @@ freefare_free_tag(FreefareTag tag) } } +/* + * Return lib version + */ +const char * +freefare_version(void) +{ + return PACKAGE_VERSION; +} + + const char * freefare_strerror(FreefareTag tag) { diff --git a/libfreefare/freefare.h b/libfreefare/freefare.h index 9a4154d..14b8538 100644 --- a/libfreefare/freefare.h +++ b/libfreefare/freefare.h @@ -50,6 +50,8 @@ void freefare_free_tag(FreefareTag tag); void freefare_free_tags(FreefareTag *tags); bool freefare_selected_tag_is_present(nfc_device *device); +const char *freefare_version(void); + const char *freefare_strerror(FreefareTag tag); int freefare_strerror_r(FreefareTag tag, char *buffer, size_t len); void freefare_perror(FreefareTag tag, const char *string);