OpenCores
URL https://opencores.org/ocsvn/hf-risc/hf-risc/trunk

Subversion Repositories hf-risc

[/] [hf-risc/] [trunk/] [software/] [lib/] [libc.c] - Diff between revs 13 and 16

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 13 Rev 16
Line 191... Line 191...
        return(n<0 ? 0 : *s1 - *--s2);
        return(n<0 ? 0 : *s1 - *--s2);
}
}
 
 
int8_t *strstr(const int8_t *string, const int8_t *find){
int8_t *strstr(const int8_t *string, const int8_t *find){
        int32_t i;
        int32_t i;
 
 
        for(;;){
        for(;;){
                for(i = 0; string[i] == find[i] && find[i]; ++i);
                for(i = 0; string[i] == find[i] && find[i]; ++i);
                if(find[i] == 0)
                if(find[i] == 0)
                        return (char*)string;
                        return (char*)string;
                if(*string++ == 0)
                if(*string++ == 0)
Line 219... Line 220...
 
 
        return (int8_t *)s;
        return (int8_t *)s;
}
}
 
 
int8_t *strpbrk(int8_t *str, int8_t *set){
int8_t *strpbrk(int8_t *str, int8_t *set){
        while (*str != '\0'){
        int8_t c, *p;
                if (strchr(set, *str) == 0)
 
                        ++str;
        for (c = *str; c != 0; str++, c = *str) {
                else
                for (p = set; *p != 0; p++) {
                        return (int8_t *) str;
                        if (c == *p) {
                return 0;
                                return str;
 
                        }
        }
        }
}
}
 
        return 0;
 
 
 
}
 
 
int8_t *strsep(int8_t **pp, int8_t *delim){
int8_t *strsep(int8_t **pp, int8_t *delim){
        int8_t *p, *q;
        int8_t *p, *q;
 
 
        if (!(p = *pp))
        if (!(p = *pp))
                return 0;
                return 0;
        if (q = strpbrk (p, delim)){
        if ((q = strpbrk (p, delim))){
                *pp = q + 1;
                *pp = q + 1;
                *q = '\0';
                *q = '\0';
        }else   *pp = 0;
        }else   *pp = 0;
 
 
        return p;
        return p;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.