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

Diff for /src/usr.bin/make/dir.c between version 1.27 and 1.28

version 1.27, 2000/09/14 13:52:41 version 1.28, 2000/11/24 14:27:19
Line 346 
Line 346 
         p = hash_next(&openDirectories, &i))          p = hash_next(&openDirectories, &i))
             Dir_Destroy(p);              Dir_Destroy(p);
     hash_delete(&openDirectories);      hash_delete(&openDirectories);
     Hash_DeleteTable(&mtimes);      free_hash(&mtimes);
 #endif  #endif
 }  }
   
Line 356 
Line 356 
  *      see if the given name has any wildcard characters in it   *      see if the given name has any wildcard characters in it
  *      be careful not to expand unmatching brackets or braces.   *      be careful not to expand unmatching brackets or braces.
  *      XXX: This code is not 100% correct. ([^]] fails etc.)   *      XXX: This code is not 100% correct. ([^]] fails etc.)
  *      I really don't think that make(1) should be expanding  
  *      patterns, because then you have to set a mechanism for  
  *      escaping the expansion!  
  *  
  * Results:  
  *      returns TRUE if the word should be expanded, FALSE otherwise  
  *  
  * Side Effects:  
  *      none  
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 Boolean  Boolean
 Dir_HasWildcards (name)  Dir_HasWildcards (name)
     char          *name;        /* name to check */      const char          *name;  /* name to check */
 {  {
     register char *cp;      const char          *cp;
     int wild = 0, brace = 0, bracket = 0;      Boolean             wild = FALSE;
       unsigned long       brace = 0, bracket = 0;
   
     for (cp = name; *cp; cp++) {      for (cp = name; *cp != '\0' ; cp++) {
         switch(*cp) {          switch (*cp) {
         case '{':          case '{':
             brace++;              brace++;
             wild = 1;              wild = TRUE;
             break;              break;
         case '}':          case '}':
               if (brace == 0)
                   return FALSE;
             brace--;              brace--;
             break;              break;
         case '[':          case '[':
             bracket++;              bracket++;
             wild = 1;              wild = TRUE;
             break;              break;
         case ']':          case ']':
               if (bracket == 0)
                   return FALSE;
             bracket--;              bracket--;
             break;              break;
         case '?':          case '?':
         case '*':          case '*':
             wild = 1;              wild = TRUE;
             break;              break;
         default:          default:
             break;              break;
         }          }
     }      }
     return (wild && bracket == 0 && brace == 0);      return wild && bracket == 0 && brace == 0;
 }  }
   
 /*-  /*-

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28