2 .TH versioncmp 3 "6 January 2007" "Straylight/Edgeware" "mLib utilities library"
4 versioncmp \- compare Debian-format version numbers
9 .B "#include <mLib/versioncmp.h>"
11 .BI "int versioncmp(const char *" va ", const char *" vb ");"
12 .BI "int VERSIONCMP(const char *" va ", " op ", const char *" vb ");"
17 function compares version strings.
19 The format of version numbers considered is
29 part may contain colons or hyphens if there is an
33 respectively. Version strings are compared componentwise: first epochs,
34 then main parts, and finally subparts.
36 The component comparison is done as follows. First, the initial
37 subsequence of nondigit characters is extracted from each string, and
38 these are compared lexicographically, using ASCII ordering, except that
39 letters precede non-letters. If both are the same, an initial sequence
40 of digits is extracted from the remaining parts of the version strings,
41 and these are compared numerically (an empty sequence being considered
42 to have the value zero). This process is repeated until we have a
43 winner or until both strings are exhausted.
45 The return value is 0 if the two strings are equal, \-1 if
56 macro provides a more convenient syntax for the
58 function, by allowing a relational operator to be written between the
63 .IR "Debian Policy Manual" .
65 Mark Wooding, <mdw@distorted.org.uk>