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

Diff for /src/usr.bin/doas/env.c between version 1.1 and 1.2

version 1.1, 2016/06/16 17:40:30 version 1.2, 2016/06/19 19:29:43
Line 16 
Line 16 
  */   */
   
 #include <sys/types.h>  #include <sys/types.h>
   #include <sys/tree.h>
   
 #include <string.h>  #include <string.h>
 #include <stdio.h>  #include <stdio.h>
Line 26 
Line 27 
   
 #include "doas.h"  #include "doas.h"
   
   struct envnode {
           RB_ENTRY(envnode) node;
           const char *key;
           const char *value;
   };
   
   struct env {
           RB_HEAD(envtree, envnode) root;
           u_int count;
   };
   
 int  int
 envcmp(struct envnode *a, struct envnode *b)  envcmp(struct envnode *a, struct envnode *b)
 {  {
         return strcmp(a->key, b->key);          return strcmp(a->key, b->key);
 }  }
 RB_GENERATE(envtree, envnode, node, envcmp)  RB_GENERATE_STATIC(envtree, envnode, node, envcmp)
   
   struct env *createenv(char **);
   struct env *filterenv(struct env *, struct rule *);
   char **flattenenv(struct env *);
   
 struct env *  struct env *
 createenv(char **envp)  createenv(char **envp)
 {  {
Line 150 
Line 166 
         copyenv(orig, copy, safeset);          copyenv(orig, copy, safeset);
   
         return copy;          return copy;
   }
   
   char **
   prepenv(struct rule *rule)
   {
           extern char **environ;
           struct env *env;
   
           env = createenv(environ);
           env = filterenv(env, rule);
           return flattenenv(env);
 }  }

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