summaryrefslogtreecommitdiff
path: root/contrib/cvs/lib/strstr.c
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>1996-08-20 23:46:10 +0000
committerPeter Wemm <peter@FreeBSD.org>1996-08-20 23:46:10 +0000
commit18576028af9c8455e19c9f51d94b87e08d1e6bd7 (patch)
tree70187fdf5be4cbefd0baf46bddac7e5e32c13c24 /contrib/cvs/lib/strstr.c
parentbd3a9cd23c621022280b2b8d4e66a5141b4e88e0 (diff)
Notes
Diffstat (limited to 'contrib/cvs/lib/strstr.c')
-rw-r--r--contrib/cvs/lib/strstr.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/contrib/cvs/lib/strstr.c b/contrib/cvs/lib/strstr.c
new file mode 100644
index 0000000000000..e43bca0b4e884
--- /dev/null
+++ b/contrib/cvs/lib/strstr.c
@@ -0,0 +1,40 @@
+/******************************************************************************
+* *
+* s t r s t r *
+* *
+* Find the first occurrence of a string in another string. *
+* *
+* Format: *
+* return = strstr(Source,What); *
+* *
+* Parameters: *
+* *
+* Returns: *
+* *
+* Scope: PUBLIC *
+* *
+******************************************************************************/
+
+char *strstr(Source, What)
+register const char *Source;
+register const char *What;
+{
+register char WhatChar;
+register char SourceChar;
+register long Length;
+
+
+ if ((WhatChar = *What++) != 0) {
+ Length = strlen(What);
+ do {
+ do {
+ if ((SourceChar = *Source++) == 0) {
+ return (0);
+ }
+ } while (SourceChar != WhatChar);
+ } while (strncmp(Source, What, Length) != 0);
+ Source--;
+ }
+ return ((char *)Source);
+
+}/*strstr*/