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

Diff for /src/usr.bin/tmux/environ.c between version 1.26 and 1.27

version 1.26, 2020/10/07 08:23:55 version 1.27, 2022/08/15 08:37:03
Line 182 
Line 182 
 environ_update(struct options *oo, struct environ *src, struct environ *dst)  environ_update(struct options *oo, struct environ *src, struct environ *dst)
 {  {
         struct environ_entry            *envent;          struct environ_entry            *envent;
           struct environ_entry            *envent1;
         struct options_entry            *o;          struct options_entry            *o;
         struct options_array_item       *a;          struct options_array_item       *a;
         union options_value             *ov;          union options_value             *ov;
           int                              found;
   
         o = options_get(oo, "update-environment");          o = options_get(oo, "update-environment");
         if (o == NULL)          if (o == NULL)
Line 192 
Line 194 
         a = options_array_first(o);          a = options_array_first(o);
         while (a != NULL) {          while (a != NULL) {
                 ov = options_array_item_value(a);                  ov = options_array_item_value(a);
                 RB_FOREACH(envent, environ, src) {                  found = 0;
                         if (fnmatch(ov->string, envent->name, 0) == 0)                  RB_FOREACH_SAFE(envent, environ, src, envent1) {
                                 break;                          if (fnmatch(ov->string, envent->name, 0) == 0) {
                                   environ_set(dst, envent->name, 0, "%s", envent->value);
                                   found = 1;
                           }
                 }                  }
                 if (envent == NULL)                  if (!found)
                         environ_clear(dst, ov->string);                          environ_clear(dst, ov->string);
                 else  
                         environ_set(dst, envent->name, 0, "%s", envent->value);  
                 a = options_array_next(a);                  a = options_array_next(a);
         }          }
 }  }

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