summaryrefslogtreecommitdiffstats
path: root/contrib/cvs/lib/strstr.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-08-20 23:46:10 +0000
committerpeter <peter@FreeBSD.org>1996-08-20 23:46:10 +0000
commit8982e501c77217c860f79bba431f46a62b607a21 (patch)
tree70187fdf5be4cbefd0baf46bddac7e5e32c13c24 /contrib/cvs/lib/strstr.c
parent01ee40fd6a76f6ff7ef247fc1b2cf6e337f216c5 (diff)
downloadFreeBSD-src-8982e501c77217c860f79bba431f46a62b607a21.zip
FreeBSD-src-8982e501c77217c860f79bba431f46a62b607a21.tar.gz
Import of slightly trimmed cvs-1.8 distribution. Generated files
and non-unix code has been left out.
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 0000000..e43bca0
--- /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*/
OpenPOWER on IntegriCloud