The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
version.c File Reference

librat: the order of versions, with the rules of Debian. More...

#include "rat.h"
#include <stdbool.h>

Functions

int rat_version_compare (const char *version_a, long release_a, const char *version_b, long release_b)
 compare two versions of a package: first the versions, with the rules of Debian (digit runs as numbers, '~' before everything), then the releases.

Detailed Description

librat: the order of versions, with the rules of Debian.

a version is a series of parts: a run of characters that are not digits, then a run of digits. rat compares the parts from the left. digit runs compare as numbers ("10" is after "9"). in the other runs, '~' is before everything (also the end), the end is before letters, and letters are before the other characters. so 1.0~rc1 < 1.0 < 1.0a < 1.0.1.

Function Documentation

◆ rat_version_compare()

int rat_version_compare ( const char * version_a,
long release_a,
const char * version_b,
long release_b )

compare two versions of a package: first the versions, with the rules of Debian (digit runs as numbers, '~' before everything), then the releases.

Returns
-1 when a is older than b, 0 when they are the same, 1 when a is newer.