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

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/usr.bin/make/str.c between version 1.67 and 1.68

version 1.67, 2020/10/05 19:24:29 version 1.68, 2020/10/05 19:27:47
Line 269  done:
Line 269  done:
 }  }
   
 /*  /*
  * Str_FindSubstring -- See if a string contains a particular substring.  
  *  
  * Input:  
  *      string          String to search.  
  *      substring       Substring to find in string.  
  *  
  * 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(const char *string, const char *substring)  
 {  
         const 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++) {  
                 if (*string != *b)  
                         continue;  
                 a = string;  
                 for (;;) {  
                         if (*b == 0)  
                                 return UNCONST(string);  
                         if (*a++ != *b++)  
                                 break;  
                 }  
                 b = substring;  
         }  
         return NULL;  
 }  
   
 /*  
  * Str_Match -- Test if a string matches a pattern like "*.[ch]".   * Str_Match -- Test if a string matches a pattern like "*.[ch]".
  *   *
  * XXX this function does not detect or report malformed patterns.   * XXX this function does not detect or report malformed patterns.

Legend:
Removed from v.1.67  
changed lines
  Added in v.1.68

CVSweb <webmaster@jp.NetBSD.org>