Subversion Repositories freemyipod

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
71 theseven 1
/***************************************************************************
2
 *             __________               __   ___.
3
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
4
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
5
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
6
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
7
 *                     \/            \/     \/    \/            \/
8
 * $Id: $
9
 *
10
 * Copyright (C) 1991, 1992  Linus Torvalds
11
 * (from linux/lib/string.c)
12
 *
13
 ****************************************************************************/
14
 
15
#include "global.h"
16
#include <string.h>
17
 
18
/**
19
 * strstr - Find the first substring in a %NUL terminated string
20
 * @s1: The string to be searched
21
 * @s2: The string to search for
22
 */
23
char *strstr(const char *s1, const char *s2)
24
{
25
    int l1, l2;
26
 
27
    l2 = strlen(s2);
28
    if (!l2)
29
        return (char *)s1;
30
    l1 = strlen(s1);
31
    while (l1 >= l2) {
32
        l1--;
33
        if (!memcmp(s1, s2, l2))
34
            return (char *)s1;
35
        s1++;
36
    }
37
    return NULL;
38
}
39