summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/cvs/lib/strstr.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-19 09:21:45 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-19 09:21:45 +0000
commitd2986da510e6c7e4505c75a4b3fbb1940b2ad08d (patch)
treeebc252891ef89551a9d2cde9e164ba9d3c3e64ef /gnu/usr.bin/cvs/lib/strstr.c
parent2b1f6f285527e332944cd8a2802f26984978c7a9 (diff)
raw import of cvs-1.6
Diffstat (limited to 'gnu/usr.bin/cvs/lib/strstr.c')
-rw-r--r--gnu/usr.bin/cvs/lib/strstr.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/gnu/usr.bin/cvs/lib/strstr.c b/gnu/usr.bin/cvs/lib/strstr.c
new file mode 100644
index 00000000000..e43bca0b4e8
--- /dev/null
+++ b/gnu/usr.bin/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*/