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

Diff for /src/usr.bin/make/direxpand.c between version 1.2 and 1.3

version 1.2, 2007/09/16 12:19:15 version 1.3, 2007/09/17 09:28:36
Line 135 
Line 135 
                         if (slash != word) {                          if (slash != word) {
                                 char    *dirpath;                                  char    *dirpath;
   
                                 /* If the glob isn't in the first component,                                  /* If the glob isn't in the first component,
                                  * try and find all the components up to                                   * try and find all the components up to
                                  * the one with a wildcard.  */                                   * the one with a wildcard.  */
                                 dirpath = Dir_FindFilei(word, slash+1, path);                                  dirpath = Dir_FindFilei(word, slash+1, path);
                                 /* dirpath is null if we can't find the                                  /* dirpath is null if we can't find the
                                  * leading component                                   * leading component
                                  * XXX: Dir_FindFile won't find internal                                   * XXX: Dir_FindFile won't find internal
                                  * components.  i.e. if the path contains                                   * components.  i.e. if the path contains
                                  * ../Etc/Object and we're looking for Etc,                                   * ../Etc/Object and we're looking for Etc,
                                  * it won't be found. */                                   * it won't be found. */
                                 if (dirpath != NULL) {                                  if (dirpath != NULL) {
                                         char *dp;                                          char *dp;
Line 155 
Line 155 
   
                                         Lst_Init(&temp);                                          Lst_Init(&temp);
                                         Dir_AddDiri(&temp, dirpath, dp);                                          Dir_AddDiri(&temp, dirpath, dp);
                                         PathMatchFilesi(slash+1, eword, &temp,                                          PathMatchFilesi(slash+1, eword, &temp,
                                             expansions);                                              expansions);
                                         Lst_Destroy(&temp, NOFREE);                                          Lst_Destroy(&temp, NOFREE);
                                 }                                  }
Line 207 
Line 207 
                 int bracelevel; /* Keep track of nested braces. If we hit                  int bracelevel; /* Keep track of nested braces. If we hit
                                  * the right brace with bracelevel == 0,                                   * the right brace with bracelevel == 0,
                                  * this is the end of the clause. */                                   * this is the end of the clause. */
                 size_t endLen;  /* The length of the ending non-curlied                  size_t endLen;  /* The length of the ending non-curlied
                                  * part of the current expansion */                                   * part of the current expansion */
   
                 /* End case: no curly left to expand */                  /* End case: no curly left to expand */
Line 219 
Line 219 
                         } else                          } else
                                 Lst_AtEnd(expansions, toexpand);                                  Lst_AtEnd(expansions, toexpand);
                         continue;                          continue;
                 }                  }
   
                 start = brace+1;                  start = brace+1;
   
                 /* Find the end of the brace clause first, being wary of                  /* Find the end of the brace clause first, being wary of
                  * nested brace clauses.  */                   * nested brace clauses.  */
                 for (end = start, bracelevel = 0;; end++) {                  for (end = start, bracelevel = 0;; end++) {
                         if (*end == '{')                          if (*end == '{')
Line 240 
Line 240 
                 for (;;) {                  for (;;) {
                         char *file;     /* To hold current expansion */                          char *file;     /* To hold current expansion */
                         const char *cp; /* Current position in brace clause */                          const char *cp; /* Current position in brace clause */
   
                         /* Find the end of the current expansion */                          /* Find the end of the current expansion */
                         for (bracelevel = 0, cp = start;                          for (bracelevel = 0, cp = start;
                             bracelevel != 0 || (*cp != '}' && *cp != ',');                              bracelevel != 0 || (*cp != '}' && *cp != ',');
                             cp++) {                              cp++) {
                                 if (*cp == '{')                                  if (*cp == '{')
                                         bracelevel++;                                          bracelevel++;
Line 252 
Line 252 
                         }                          }
   
                         /* Build the current combination and enqueue it.  */                          /* Build the current combination and enqueue it.  */
                         file = emalloc((brace - toexpand) + (cp - start) +                          file = emalloc((brace - toexpand) + (cp - start) +
                             endLen + 1);                              endLen + 1);
                         if (brace != toexpand)                          if (brace != toexpand)
                                 memcpy(file, toexpand, brace-toexpand);                                  memcpy(file, toexpand, brace-toexpand);
                         if (cp != start)                          if (cp != start)
                                 memcpy(file+(brace-toexpand), start, cp-start);                                  memcpy(file+(brace-toexpand), start, cp-start);
                         memcpy(file+(brace-toexpand)+(cp-start), end,                          memcpy(file+(brace-toexpand)+(cp-start), end,
                             endLen + 1);                              endLen + 1);
                         Lst_EnQueue(&curled, file);                          Lst_EnQueue(&curled, file);
                         if (*cp == '}')                          if (*cp == '}')

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3