1 #define _POSIX_C_SOURCE 200809L
12 #define DMARK fprintf(stderr, "mark %s %s:%d\n", __FILE__, __func__, __LINE__)
14 int zpm_parse_package(char *pstr, char *name, char *ver, int *rel) {
22 /* string - ver - rel */
23 /* rel is all digits */
25 * ^(.+)-([0-9][^-]*)-([\d+])$
28 * The main problem in parsing is that the package name itself
29 * can contain a '-', so you can't just split on '-'
30 * Also, the version can be just digits.
33 /* everything up to the first '-' is in the name */
35 if (*pstr == '\'' || !isgraph(*pstr)) {
38 if (*pstr == '-' && isdigit(*(pstr+1))) {
51 while (*pstr && *pstr != '-') {
52 if (*pstr == '\'' || !isgraph(*pstr)) {
71 return havename + havever + haverel;