1/****************************************************************************** 2* * 3* s t r s t r * 4* * 5* Find the first occurrence of a string in another string. * 6* * 7* Format: * 8* return = strstr(Source,What); * 9* * 10* Parameters: * 11* * 12* Returns: * 13* * 14* Scope: PUBLIC * 15* * 16******************************************************************************/ 17 18char *strstr(Source, What) 19register const char *Source; 20register const char *What; 21{ 22register char WhatChar; 23register char SourceChar; 24register long Length; 25 26 27 if ((WhatChar = *What++) != 0) { 28 Length = strlen(What); 29 do { 30 do { 31 if ((SourceChar = *Source++) == 0) { 32 return (0); 33 } 34 } while (SourceChar != WhatChar); 35 } while (strncmp(Source, What, Length) != 0); 36 Source--; 37 } 38 return ((char *)Source); 39 40}/*strstr*/ 41