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

Diff for /src/usr.bin/make/var.c between version 1.29 and 1.30

version 1.29, 2000/01/08 09:45:16 version 1.30, 2000/03/26 16:21:33
Line 320 
Line 320 
      * look for it in VAR_CMD, VAR_GLOBAL and the environment, in that order,       * look for it in VAR_CMD, VAR_GLOBAL and the environment, in that order,
      * depending on the FIND_* flags in 'flags'       * depending on the FIND_* flags in 'flags'
      */       */
     var = Lst_Find(ctxt->context, VarCmp, (ClientData)name);      var = Lst_Find(ctxt->context, VarCmp, name);
   
     if ((var == NULL) && (flags & FIND_CMD) && (ctxt != VAR_CMD))      if ((var == NULL) && (flags & FIND_CMD) && (ctxt != VAR_CMD))
         var = Lst_Find(VAR_CMD->context, VarCmp, (ClientData)name);          var = Lst_Find(VAR_CMD->context, VarCmp, name);
     if (!checkEnvFirst && (var == NULL) && (flags & FIND_GLOBAL) &&      if (!checkEnvFirst && (var == NULL) && (flags & FIND_GLOBAL) &&
         (ctxt != VAR_GLOBAL)) {          (ctxt != VAR_GLOBAL)) {
         var = Lst_Find(VAR_GLOBAL->context, VarCmp, (ClientData)name);          var = Lst_Find(VAR_GLOBAL->context, VarCmp, name);
     }      }
     if ((var == NULL) && (flags & FIND_ENV)) {      if ((var == NULL) && (flags & FIND_ENV)) {
         var = Lst_Find(VAR_ENV->context, VarCmp, (ClientData)name);          var = Lst_Find(VAR_ENV->context, VarCmp, name);
         if (var == NULL) {          if (var == NULL) {
             char *env;              char *env;
   
Line 339 
Line 339 
     }      }
     if (var == NULL && checkEnvFirst && (flags & FIND_GLOBAL) &&      if (var == NULL && checkEnvFirst && (flags & FIND_GLOBAL) &&
                    (ctxt != VAR_GLOBAL))                     (ctxt != VAR_GLOBAL))
             var = Lst_Find(VAR_GLOBAL->context, VarCmp, (ClientData)name);              var = Lst_Find(VAR_GLOBAL->context, VarCmp, name);
     if (var == NULL)      if (var == NULL)
         return NULL;          return NULL;
     else      else
Line 379 
Line 379 
   
     v->flags = 0;      v->flags = 0;
   
     Lst_AtFront(ctxt->context, (ClientData)v);      Lst_AtFront(ctxt->context, v);
     Lst_AtEnd(allVars, (ClientData)v);      Lst_AtEnd(allVars, v);
     if (DEBUG(VAR)) {      if (DEBUG(VAR)) {
         printf("%s:%s = %s\n", ctxt->name, name, val);          printf("%s:%s = %s\n", ctxt->name, name, val);
     }      }
Line 435 
Line 435 
     if (DEBUG(VAR)) {      if (DEBUG(VAR)) {
         printf("%s:delete %s\n", ctxt->name, name);          printf("%s:delete %s\n", ctxt->name, name);
     }      }
     ln = Lst_Find(ctxt->context, VarCmp, (ClientData)name);      ln = Lst_Find(ctxt->context, VarCmp, name);
     if (ln != NULL) {      if (ln != NULL) {
         register Var      *v;          register Var      *v;
   
Line 443 
Line 443 
         Lst_Remove(ctxt->context, ln);          Lst_Remove(ctxt->context, ln);
         ln = Lst_Member(allVars, v);          ln = Lst_Member(allVars, v);
         Lst_Remove(allVars, ln);          Lst_Remove(allVars, ln);
         VarDelete((ClientData) v);          VarDelete(v);
     }      }
 }  }
   
Line 1569 
Line 1569 
                         val = VarValue(v);                          val = VarValue(v);
   
                         if (str[3] == 'D') {                          if (str[3] == 'D') {
                             val = VarModify(val, VarHead, (ClientData)0);                              val = VarModify(val, VarHead, NULL);
                         } else {                          } else {
                             val = VarModify(val, VarTail, (ClientData)0);                              val = VarModify(val, VarTail, NULL);
                         }                          }
                         /*                          /*
                          * Resulting string is dynamically allocated, so                           * Resulting string is dynamically allocated, so
Line 1753 
Line 1753 
                         pattern = &tstr[1];                          pattern = &tstr[1];
                     }                      }
                     if (*tstr == 'M' || *tstr == 'm') {                      if (*tstr == 'M' || *tstr == 'm') {
                         newStr = VarModify(str, VarMatch, (ClientData)pattern);                          newStr = VarModify(str, VarMatch, pattern);
                     } else {                      } else {
                         newStr = VarModify(str, VarNoMatch,                          newStr = VarModify(str, VarNoMatch, pattern);
                                            (ClientData)pattern);  
                     }                      }
                     if (copy) {                      if (copy) {
                         free(pattern);                          free(pattern);
Line 1807 
Line 1806 
                     }                      }
   
                     termc = *cp;                      termc = *cp;
                     newStr = VarModify(str, VarSubstitute,                      newStr = VarModify(str, VarSubstitute, &pattern);
                                        (ClientData)&pattern);  
   
                     /*                      /*
                      * Free the two strings.                       * Free the two strings.
Line 1870 
Line 1868 
                         pattern.nsub = 10;                          pattern.nsub = 10;
                     pattern.matches = emalloc(pattern.nsub *                      pattern.matches = emalloc(pattern.nsub *
                                               sizeof(regmatch_t));                                                sizeof(regmatch_t));
                     newStr = VarModify(str, VarRESubstitute,                      newStr = VarModify(str, VarRESubstitute, &pattern);
                                        (ClientData) &pattern);  
                     regfree(&pattern.re);                      regfree(&pattern.re);
                     free(pattern.replace);                      free(pattern.replace);
                     free(pattern.matches);                      free(pattern.matches);
Line 1888 
Line 1885 
                     /*FALLTHRU*/                      /*FALLTHRU*/
                 case 'T':                  case 'T':
                     if (tstr[1] == endc || tstr[1] == ':') {                      if (tstr[1] == endc || tstr[1] == ':') {
                         newStr = VarModify (str, VarTail, (ClientData)0);                          newStr = VarModify(str, VarTail, NULL);
                         cp = tstr + 1;                          cp = tstr + 1;
                         termc = *cp;                          termc = *cp;
                         break;                          break;
Line 1896 
Line 1893 
                     /*FALLTHRU*/                      /*FALLTHRU*/
                 case 'H':                  case 'H':
                     if (tstr[1] == endc || tstr[1] == ':') {                      if (tstr[1] == endc || tstr[1] == ':') {
                         newStr = VarModify (str, VarHead, (ClientData)0);                          newStr = VarModify(str, VarHead, NULL);
                         cp = tstr + 1;                          cp = tstr + 1;
                         termc = *cp;                          termc = *cp;
                         break;                          break;
Line 1904 
Line 1901 
                     /*FALLTHRU*/                      /*FALLTHRU*/
                 case 'E':                  case 'E':
                     if (tstr[1] == endc || tstr[1] == ':') {                      if (tstr[1] == endc || tstr[1] == ':') {
                         newStr = VarModify (str, VarSuffix, (ClientData)0);                          newStr = VarModify(str, VarSuffix, NULL);
                         cp = tstr + 1;                          cp = tstr + 1;
                         termc = *cp;                          termc = *cp;
                         break;                          break;
Line 1912 
Line 1909 
                     /*FALLTHRU*/                      /*FALLTHRU*/
                 case 'R':                  case 'R':
                     if (tstr[1] == endc || tstr[1] == ':') {                      if (tstr[1] == endc || tstr[1] == ':') {
                         newStr = VarModify (str, VarRoot, (ClientData)0);                          newStr = VarModify(str, VarRoot, NULL);
                         cp = tstr + 1;                          cp = tstr + 1;
                         termc = *cp;                          termc = *cp;
                         break;                          break;
Line 1920 
Line 1917 
                     /*FALLTHRU*/                      /*FALLTHRU*/
                 case 'U':                  case 'U':
                     if (tstr[1] == endc || tstr[1] == ':') {                      if (tstr[1] == endc || tstr[1] == ':') {
                         newStr = VarModify (str, VarUppercase, (ClientData)0);                          newStr = VarModify(str, VarUppercase, NULL);
                         cp = tstr + 1;                          cp = tstr + 1;
                         termc = *cp;                          termc = *cp;
                         break;                          break;
Line 1928 
Line 1925 
                     /*FALLTHRU*/                      /*FALLTHRU*/
                 case 'L':                  case 'L':
                     if (tstr[1] == endc || tstr[1] == ':') {                      if (tstr[1] == endc || tstr[1] == ':') {
                         newStr = VarModify (str, VarLowercase, (ClientData)0);                          newStr = VarModify(str, VarLowercase, NULL);
                         cp = tstr + 1;                          cp = tstr + 1;
                         termc = *cp;                          termc = *cp;
                         break;                          break;
Line 2007 
Line 2004 
                          * SYSV modifications happen through the whole                           * SYSV modifications happen through the whole
                          * string. Note the pattern is anchored at the end.                           * string. Note the pattern is anchored at the end.
                          */                           */
                         newStr = VarModify(str, VarSYSVMatch,                          newStr = VarModify(str, VarSYSVMatch, &pattern);
                                            (ClientData)&pattern);  
   
                         /*                          /*
                          * Restore the nulled characters                           * Restore the nulled characters
Line 2278 
Line 2274 
 Var_GetTail(file)  Var_GetTail(file)
     char        *file;      /* Filename to modify */      char        *file;      /* Filename to modify */
 {  {
     return(VarModify(file, VarTail, (ClientData)0));      return VarModify(file, VarTail, NULL);
 }  }
   
 /*-  /*-
Line 2300 
Line 2296 
 Var_GetHead(file)  Var_GetHead(file)
     char        *file;      /* Filename to manipulate */      char        *file;      /* Filename to manipulate */
 {  {
     return(VarModify(file, VarHead, (ClientData)0));      return VarModify(file, VarHead, NULL);
 }  }
   
 /*-  /*-
Line 2354 
Line 2350 
 Var_Dump (ctxt)  Var_Dump (ctxt)
     GNode          *ctxt;      GNode          *ctxt;
 {  {
     Lst_ForEach (ctxt->context, VarPrintVar, (ClientData) 0);      Lst_ForEach(ctxt->context, VarPrintVar, NULL);
 }  }

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30