core: New API gpgrt_cmp_version
* src/gpg-error.h.in: New API gpgrt_cmp_version. * src/visibility.c (gpgrt_cmp_version): New wrapper. * src/version.c (parse_version_string): Revamped. (do_cmp_version): New. (_gpgrt_cmp_version): New. (_gpg_error_check_version): Re-implemented using the new func. * tests/t-version.c: Include t-common.h. (t_gpgrt_cmp_version): New test. (main): Run new test. Change test for new version number to require a 2 level number.
We have implementations of very similar functions in all out libs.
Thus it makes sense to provide a generic version. This version is
actually derived from the ftp-indexer.c we use for the gnupg
website (see the gnupg-doc repo).
- Signed-off-by: Werner Koch <wk@gnupg.org>