3.3. strstr

char *strstr( const char *s1, const char *s2);
strstr returns a pointer to first occurrence of string s2 in s1, or NULL if not present.

strstr searches a string for a sub-string.

For example, to search stdin for lines containing the phrase "beef stew":

        #include <stdio.h>
        #include <string.h>
        char line[BUFSIZ];
        ...
        while( fgets( line, BUFSIZ, stdin) != NULL)     /* read one line */
            if( strstr( line, "beef stew") != NULL)     /* check for match */
                fputs( line, stdout);
strstr can be written using strlen and strncmp.