Add xbps_get_pkg_revision() to get the revision string.

--HG--
extra : convert_revision : 5c58a44db6b3f1ff2c7f75173aff7d6509dfd4c9
This commit is contained in:
Juan RP 2009-04-18 15:49:08 +02:00
parent 783dc64e4b
commit 046dbee415
2 changed files with 16 additions and 0 deletions

View file

@ -150,6 +150,7 @@ bool xbps_check_is_installed_pkgname(const char *);
char * xbps_get_pkg_index_plist(const char *);
char * xbps_get_pkg_name(const char *);
const char * xbps_get_pkg_version(const char *);
const char * xbps_get_pkg_revision(const char *);
bool xbps_pkg_has_rundeps(prop_dictionary_t);
void xbps_set_rootdir(const char *);
const char * xbps_get_rootdir(void);

View file

@ -171,6 +171,21 @@ xbps_get_pkg_version(const char *pkg)
return tmp + 1; /* skip first '-' */
}
const char *
xbps_get_pkg_revision(const char *pkg)
{
const char *tmp;
assert(pkg != NULL);
/* Get the required revision */
tmp = strrchr(pkg, '_');
if (tmp == NULL)
return NULL;
return tmp + 1; /* skip first '_' */
}
char *
xbps_get_pkg_name(const char *pkg)
{