[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.6 and 1.7

version 1.6, 1996/11/30 21:08:53 version 1.7, 1997/04/01 07:28:11
Line 1 
Line 1 
 /*      $OpenBSD$       */  /*      $OpenBSD$       */
 /*      $NetBSD: dir.c,v 1.12 1996/11/06 17:59:04 christos Exp $        */  /*      $NetBSD: dir.c,v 1.14 1997/03/29 16:51:26 christos Exp $        */
   
 /*  /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.   * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
Line 285 
Line 285 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  * Dir_HasWildcards  --   * Dir_HasWildcards  --
  *      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.
    *      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:   * Results:
  *      returns TRUE if the word should be expanded, FALSE otherwise   *      returns TRUE if the word should be expanded, FALSE otherwise
Line 298 
Line 303 
     char          *name;        /* name to check */      char          *name;        /* name to check */
 {  {
     register char *cp;      register char *cp;
       int wild = 0, brace = 0, bracket = 0;
   
     for (cp = name; *cp; cp++) {      for (cp = name; *cp; cp++) {
         switch(*cp) {          switch(*cp) {
         case '{':          case '{':
               brace++;
               wild = 1;
               break;
           case '}':
               brace--;
               break;
         case '[':          case '[':
               bracket++;
               wild = 1;
               break;
           case ']':
               bracket--;
               break;
         case '?':          case '?':
         case '*':          case '*':
             return (TRUE);              wild = 1;
               break;
           default:
               break;
         }          }
     }      }
     return (FALSE);      return (wild && bracket == 0 && brace == 0);
 }  }
   
 /*-  /*-

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