mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-07 10:20:29 +00:00
add StrRChr, fix BaseName
This commit is contained in:
parent
91a70f6749
commit
316b72e331
1 changed files with 9 additions and 5 deletions
14
ape/loader.c
14
ape/loader.c
|
@ -239,12 +239,11 @@ static int StrCmp(const char *l, const char *r) {
|
||||||
return (l[i] & 255) - (r[i] & 255);
|
return (l[i] & 255) - (r[i] & 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *BaseName(const char *s) {
|
static const char *StrRChr(const char *s, int c) {
|
||||||
int c;
|
const char *b = 0;
|
||||||
const char *b = "";
|
|
||||||
if (s) {
|
if (s) {
|
||||||
while ((c = *s++)) {
|
for (; *s; ++s) {
|
||||||
if (c == '/') {
|
if (*s == c) {
|
||||||
b = s;
|
b = s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -252,6 +251,11 @@ static const char *BaseName(const char *s) {
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *BaseName(const char *s) {
|
||||||
|
const char *b = StrRChr(s, '/');
|
||||||
|
return b ? b + 1 : s;
|
||||||
|
}
|
||||||
|
|
||||||
static void Bzero(void *a, unsigned long n) {
|
static void Bzero(void *a, unsigned long n) {
|
||||||
long z;
|
long z;
|
||||||
char *p, *e;
|
char *p, *e;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue