mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-07 02:10:27 +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);
|
||||
}
|
||||
|
||||
static const char *BaseName(const char *s) {
|
||||
int c;
|
||||
const char *b = "";
|
||||
static const char *StrRChr(const char *s, int c) {
|
||||
const char *b = 0;
|
||||
if (s) {
|
||||
while ((c = *s++)) {
|
||||
if (c == '/') {
|
||||
for (; *s; ++s) {
|
||||
if (*s == c) {
|
||||
b = s;
|
||||
}
|
||||
}
|
||||
|
@ -252,6 +251,11 @@ static const char *BaseName(const char *s) {
|
|||
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) {
|
||||
long z;
|
||||
char *p, *e;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue