strverscmp
—version string compareSynopsis
#define _GNU_SOURCE #include <string.h> int strverscmp(const char *a, const char *b);
Description
strverscmp
compares the string at a to
the string at b in a version-logical order.
Returns
If *a
version-sorts after *b
, strverscmp
returns
a number greater than zero. If the two strings match, strverscmp
returns zero. If *a
version-sorts before *b
,
strverscmp
returns a number less than zero.
Portability
strverscmp
is a GNU extension.
strverscmp
requires no supporting OS subroutines. It uses
isdigit() from elsewhere in this library.