]>
git.zerfleddert.de Git - micropolis/blob - src/tcl/compat/strstr.c
11084d70e72d09d2e0e3b85b0a3f5a3525845ebd
4 * Source code for the "strstr" library routine.
6 * Copyright 1988-1991 Regents of the University of California
7 * Permission to use, copy, modify, and distribute this
8 * software and its documentation for any purpose and without
9 * fee is hereby granted, provided that the above copyright
10 * notice appears in all copies. The University of California
11 * makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without
13 * express or implied warranty.
17 static char rcsid
[] = "$Header: /sprite/src/lib/tcl/compat/RCS/strstr.c,v 1.1 91/09/19 16:22:12 ouster Exp $ SPRITE (Berkeley)";
21 *----------------------------------------------------------------------
25 * Locate the first instance of a substring in a string.
28 * If string contains substring, the return value is the
29 * location of the first matching instance of substring
30 * in string. If string doesn't contain substring, the
31 * return value is 0. Matching is done on an exact
32 * character-for-character basis with no wildcards or special
38 *----------------------------------------------------------------------
42 strstr(string
, substring
)
43 register char *string
; /* String to search. */
44 char *substring
; /* Substring to try to find in string. */
48 /* First scan quickly through the two strings looking for a
49 * single-character match. When it's found, then compare the
50 * rest of the substring.
57 for ( ; *string
!= 0; string
+= 1) {