[BACK]Return to str.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / make

Diff for /src/usr.bin/make/str.c between version 1.7 and 1.8

version 1.7, 1998/12/05 00:06:29 version 1.8, 1999/11/11 11:35:17
Line 226 
Line 226 
 }  }
   
 /*  /*
  * Str_FindSubstring -- See if a string contains a particular substring.  
  *  
  * Results: If string contains substring, the return value is the location of  
  * the first matching instance of substring in string.  If string doesn't  
  * contain substring, the return value is NULL.  Matching is done on an exact  
  * character-for-character basis with no wildcards or special characters.  
  *  
  * Side effects: None.  
  */  
 char *  
 Str_FindSubstring(string, substring)  
         register char *string;          /* String to search. */  
         char *substring;                /* Substring to find in string */  
 {  
         register char *a, *b;  
   
         /*  
          * First scan quickly through the two strings looking for a single-  
          * character match.  When it's found, then compare the rest of the  
          * substring.  
          */  
   
         for (b = substring; *string != 0; string += 1) {  
                 if (*string != *b)  
                         continue;  
                 a = string;  
                 for (;;) {  
                         if (*b == 0)  
                                 return(string);  
                         if (*a++ != *b++)  
                                 break;  
                 }  
                 b = substring;  
         }  
         return((char *) NULL);  
 }  
   
 /*  
  * Str_Match --   * Str_Match --
  *   *
  * See if a particular string matches a particular pattern.   * See if a particular string matches a particular pattern.

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8