From 4d7ac43ff71fdadfd2e04621f74840a82fbe788a Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 8 Jan 2016 08:58:21 +0100 Subject: common: New function compare_version_strings. * common/stringhelp.c (parse_version_number): New. (parse_version_string): New. (compare_version_strings): New. * common/t-stringhelp.c (test_compare_version_strings): New. (main): Call test. Return ERRCOUNT instead of 0. -- The code for that function is based on code from libgcrypt. Similar code is in all GnuPG related libraries this function is a candidates for inclusion in libgpg-error. Signed-off-by: Werner Koch --- common/stringhelp.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'common/stringhelp.h') diff --git a/common/stringhelp.h b/common/stringhelp.h index c813662c7..d9225a3bb 100644 --- a/common/stringhelp.h +++ b/common/stringhelp.h @@ -148,6 +148,9 @@ char **strsplit (char *string, char delim, char replacement, int *count); /* Tokenize STRING using the set of delimiters in DELIM. */ char **strtokenize (const char *string, const char *delim); +/* Return True if MYVERSION is greater or equal than REQ_VERSION. */ +int compare_version_strings (const char *my_version, const char *req_version); + /* Format a string so that it fits within about TARGET_COLS columns. */ char *format_text (char *text, int in_place, int target_cols, int max_cols); -- cgit v1.2.3