[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.25 and 1.26

version 1.25, 1999/12/18 02:11:27 version 1.26, 1999/12/18 21:53:33
Line 260 
Line 260 
  *   *
  * Results:   * Results:
  *      A pointer to the structure describing the desired variable or   *      A pointer to the structure describing the desired variable or
  *      NIL if the variable does not exist.   *      NULL if the variable does not exist.
  *   *
  * Side Effects:   * Side Effects:
  *      Caches env variables in the VAR_ENV context.   *      Caches env variables in the VAR_ENV context.
Line 322 
Line 322 
      */       */
     var = Lst_Find(ctxt->context, (ClientData)name, VarCmp);      var = Lst_Find(ctxt->context, (ClientData)name, VarCmp);
   
     if ((var == NILLNODE) && (flags & FIND_CMD) && (ctxt != VAR_CMD))      if ((var == NULL) && (flags & FIND_CMD) && (ctxt != VAR_CMD))
         var = Lst_Find (VAR_CMD->context, (ClientData)name, VarCmp);          var = Lst_Find (VAR_CMD->context, (ClientData)name, VarCmp);
     if (!checkEnvFirst && (var == NILLNODE) && (flags & FIND_GLOBAL) &&      if (!checkEnvFirst && (var == NULL) && (flags & FIND_GLOBAL) &&
         (ctxt != VAR_GLOBAL)) {          (ctxt != VAR_GLOBAL)) {
         var = Lst_Find (VAR_GLOBAL->context, (ClientData)name, VarCmp);          var = Lst_Find (VAR_GLOBAL->context, (ClientData)name, VarCmp);
     }      }
     if ((var == NILLNODE) && (flags & FIND_ENV)) {      if ((var == NULL) && (flags & FIND_ENV)) {
         var = Lst_Find(VAR_ENV->context, (ClientData)name, VarCmp);          var = Lst_Find(VAR_ENV->context, (ClientData)name, VarCmp);
         if (var == NILLNODE) {          if (var == NULL) {
             char *env;              char *env;
   
             if ((env = getenv(name)) != NULL)              if ((env = getenv(name)) != NULL)
                 return VarAdd(name, env, VAR_ENV);                  return VarAdd(name, env, VAR_ENV);
         }          }
     }      }
     if (var == NILLNODE && checkEnvFirst && (flags & FIND_GLOBAL) &&      if (var == NULL && checkEnvFirst && (flags & FIND_GLOBAL) &&
                    (ctxt != VAR_GLOBAL))                     (ctxt != VAR_GLOBAL))
             var = Lst_Find(VAR_GLOBAL->context, (ClientData)name, VarCmp);              var = Lst_Find(VAR_GLOBAL->context, (ClientData)name, VarCmp);
     if (var == NILLNODE)      if (var == NULL)
         return ((Var *) NIL);          return NULL;
     else      else
         return ((Var *) Lst_Datum (var));          return (Var *)Lst_Datum(var);
 }  }
   
 /*-  /*-
Line 436 
Line 436 
         printf("%s:delete %s\n", ctxt->name, name);          printf("%s:delete %s\n", ctxt->name, name);
     }      }
     ln = Lst_Find(ctxt->context, (ClientData)name, VarCmp);      ln = Lst_Find(ctxt->context, (ClientData)name, VarCmp);
     if (ln != NILLNODE) {      if (ln != NULL) {
         register Var      *v;          register Var      *v;
   
         v = (Var *)Lst_Datum(ln);          v = (Var *)Lst_Datum(ln);
Line 482 
Line 482 
      * point in searching them all just to save a bit of memory...       * point in searching them all just to save a bit of memory...
      */       */
     v = VarFind (name, ctxt, 0);      v = VarFind (name, ctxt, 0);
     if (v == (Var *) NIL) {      if (v == NULL) {
         (void)VarAdd(name, val, ctxt);          (void)VarAdd(name, val, ctxt);
     } else {      } else {
         Buf_Reset(&(v->val));          Buf_Reset(&(v->val));
Line 537 
Line 537 
   
     v = VarFind (name, ctxt, (ctxt == VAR_GLOBAL) ? FIND_ENV : 0);      v = VarFind (name, ctxt, (ctxt == VAR_GLOBAL) ? FIND_ENV : 0);
   
     if (v == (Var *) NIL) {      if (v == NULL) {
         (void)VarAdd(name, val, ctxt);          (void)VarAdd(name, val, ctxt);
     } else {      } else {
         Buf_AddSpace(&(v->val));          Buf_AddSpace(&(v->val));
Line 572 
Line 572 
   
     v = VarFind(name, ctxt, FIND_CMD|FIND_GLOBAL|FIND_ENV);      v = VarFind(name, ctxt, FIND_CMD|FIND_GLOBAL|FIND_ENV);
   
     if (v == (Var *)NIL)      if (v == NULL)
         return FALSE;          return FALSE;
     else      else
         return TRUE;          return TRUE;
Line 598 
Line 598 
     Var            *v;      Var            *v;
   
     v = VarFind(name, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);      v = VarFind(name, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
     if (v != (Var *)NIL)      if (v != NULL)
         return VarValue(v);          return VarValue(v);
     else      else
         return NULL;          return NULL;
Line 1473 
Line 1473 
         name[1] = '\0';          name[1] = '\0';
   
         v = VarFind (name, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);          v = VarFind (name, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
         if (v == (Var *)NIL) {          if (v == NULL) {
             *lengthPtr = 2;              *lengthPtr = 2;
   
             if ((ctxt == VAR_CMD) || (ctxt == VAR_GLOBAL)) {              if ((ctxt == VAR_CMD) || (ctxt == VAR_GLOBAL)) {
Line 1535 
Line 1535 
         *tstr = '\0';          *tstr = '\0';
   
         v = VarFind (str + 2, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);          v = VarFind (str + 2, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
         if ((v == (Var *)NIL) && (ctxt != VAR_CMD) && (ctxt != VAR_GLOBAL) &&          if ((v == NULL) && (ctxt != VAR_CMD) && (ctxt != VAR_GLOBAL) &&
             ((tstr-str) == 4) && (str[3] == 'F' || str[3] == 'D'))              ((tstr-str) == 4) && (str[3] == 'F' || str[3] == 'D'))
         {          {
             /*              /*
Line 1560 
Line 1560 
                     vname[1] = '\0';                      vname[1] = '\0';
                     v = VarFind(vname, ctxt, 0);                      v = VarFind(vname, ctxt, 0);
   
                     if (v != (Var *)NIL) {                      if (v != NULL) {
                         /*                          /*
                          * No need for nested expansion or anything, as we're                           * No need for nested expansion or anything, as we're
                          * the only one who sets these things and we sure don't                           * the only one who sets these things and we sure don't
Line 1587 
Line 1587 
             }              }
         }          }
   
         if (v == (Var *)NIL) {          if (v == NULL) {
             if ((((tstr-str) == 3) ||              if ((((tstr-str) == 3) ||
                  ((((tstr-str) == 4) && (str[3] == 'F' ||                   ((((tstr-str) == 4) && (str[3] == 'F' ||
                                          str[3] == 'D')))) &&                                           str[3] == 'D')))) &&

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.26