[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.16 and 1.17

version 1.16, 2016/10/10 21:29:23 version 1.17, 2017/01/24 20:15:32
Line 169 
Line 169 
         free(envent);          free(envent);
 }  }
   
 /*  /* Copy variables from a destination into a source * environment. */
  * Copy a space-separated list of variables from a destination into a source  
  * environment.  
  */  
 void  void
 environ_update(const char *vars, struct environ *srcenv,  environ_update(struct options *oo, struct environ *src, struct environ *dst)
     struct environ *dstenv)  
 {  {
         struct environ_entry    *envent;          struct environ_entry    *envent;
         char                    *copyvars, *var, *next;          struct options_entry    *o;
           u_int                    size, idx;
           const char              *value;
   
         copyvars = next = xstrdup(vars);          o = options_get(oo, "update-environment");
         while ((var = strsep(&next, " ")) != NULL) {          if (o == NULL || options_array_size(o, &size) == -1)
                 if ((envent = environ_find(srcenv, var)) == NULL)                  return;
                         environ_clear(dstenv, var);          for (idx = 0; idx < size; idx++) {
                   value = options_array_get(o, idx);
                   if (value == NULL)
                           continue;
                   if ((envent = environ_find(src, value)) == NULL)
                           environ_clear(dst, value);
                 else                  else
                         environ_set(dstenv, envent->name, "%s", envent->value);                          environ_set(dst, envent->name, "%s", envent->value);
         }          }
         free(copyvars);  
 }  }
   
 /* Push environment into the real environment - use after fork(). */  /* Push environment into the real environment - use after fork(). */

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17