Ignore:
Timestamp:
Aug 6, 2017, 8:33:00 AM (7 years ago)
Author:
max@…
Message:

Clean up, and define strstr() in libk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/libk/string.c

    r288 r323  
    125125}
    126126
     127////////////////////////////////
     128char * strstr( char       * s,
     129               const char * find)
     130{
     131    char c, sc;
     132    size_t len;
     133
     134    if ((c = *find++) != 0) {
     135        len = strlen(find);
     136        do {
     137            do {
     138                if ((sc = *s++) == 0)
     139                    return NULL;
     140            } while (sc != c);
     141        } while (strncmp(s, find, len) != 0);
     142        s--;
     143    }
     144    return s;
     145}
     146
    127147//////////////////////////////
    128148char * strchr( const char * s,
Note: See TracChangeset for help on using the changeset viewer.