dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / lib / libast / common / comp / strstr.c
blob03b6b64894ede676cdc28151b0e87b1732b28cc4
1 /***********************************************************************
2 * *
3 * This software is part of the ast package *
4 * Copyright (c) 1985-2010 AT&T Intellectual Property *
5 * and is licensed under the *
6 * Common Public License, Version 1.0 *
7 * by AT&T Intellectual Property *
8 * *
9 * A copy of the License is available at *
10 * http://www.opensource.org/licenses/cpl1.0.txt *
11 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
12 * *
13 * Information and Software Systems Research *
14 * AT&T Research *
15 * Florham Park NJ *
16 * *
17 * Glenn Fowler <gsf@research.att.com> *
18 * David Korn <dgk@research.att.com> *
19 * Phong Vo <kpv@research.att.com> *
20 * *
21 ***********************************************************************/
22 #pragma prototyped
24 #if defined(__STDPP__directive) && defined(__STDPP__hide)
25 __STDPP__directive pragma pp:hide strstr
26 #else
27 #define strstr ______strstr
28 #endif
30 #include <ast.h>
32 #if defined(__STDPP__directive) && defined(__STDPP__hide)
33 __STDPP__directive pragma pp:nohide strstr
34 #else
35 #undef strstr
36 #endif
38 #if _lib_strstr
40 NoN(strstr)
42 #else
44 #if defined(__EXPORT__)
45 #define extern __EXPORT__
46 #endif
48 extern char*
49 strstr(register const char* s1, register const char* s2)
51 register int c1;
52 register int c2;
53 register const char* t1;
54 register const char* t2;
56 if (s2)
58 if (!*s2)
59 return (char*)s1;
60 c2 = *s2++;
61 while (c1 = *s1++)
62 if (c1 == c2)
64 t1 = s1;
65 t2 = s2;
68 if (!*t2)
69 return (char*)s1 - 1;
70 } while (*t1++ == *t2++);
73 return 0;
76 #endif