Fixes for cmpver..use strrchr and control last char

- should make util-linux work now

--HG--
extra : convert_revision : 3a02003c06ba3b84d2b8df6acef790765a7750f3
This commit is contained in:
pancake 2008-10-29 17:51:29 +01:00
parent 2680b4827d
commit 7d8701190d
2 changed files with 9 additions and 3 deletions

2
TODO
View File

@ -6,3 +6,5 @@ Some stuff that should be done:
* More robust and fast dependency checking.
* wget now is required inside the chroot
- etc/resolv.conf is copied before entering the chroot
* ln -s /bin/bash /bin/sh
* make xbps.sh do not depend on bash

View File

@ -10,6 +10,11 @@ static int chkchr(const char *ch)
{
if (*ch>='0' && *ch<='9')
return *ch-'0';
if (ch[1]=='\0') {
if (*ch>='a'&&*ch<='z'){
return *ch-'a';
}
}
switch(*ch) {
case 'a': if (ch[1]=='l')
return 0xa;
@ -18,7 +23,6 @@ static int chkchr(const char *ch)
case 'r': return 0xc;
}
return -1;
}
static int ver2int(const char *a0, int *pow, int mpow)
@ -50,8 +54,8 @@ int chkver(const char *a0, const char *a1)
int chkpkg(const char *a0, const char *b0)
{
char *a = strchr(a0, '-');
char *b = strchr(b0, '-');
char *a = strrchr(a0, '-');
char *b = strrchr(b0, '-');
if (a == NULL || b== NULL) {
fprintf(stderr, "Invalid package names\n");