envmap.h (814B)
1 #ifndef MINIROON_ENVMAP_H 2 #define MINIROON_ENVMAP_H 3 4 // implementation: 5 // {IMP} envmap.c 6 7 #include "bytebuffer.h" 8 9 #define MAX_ENV_ALLOW 256 10 11 typedef struct miniroon_env_entry_s { 12 bytebuffer name; 13 bytebuffer value; 14 enum miniroon_env_state { 15 ENV_NO_CHANGE = 0, 16 ENV_SET = 1, 17 ENV_REMOVE = 2 18 } state; 19 } miniroon_env_entry; 20 21 typedef struct miniroon_env_map_s { 22 miniroon_env_entry env[MAX_ENV_ALLOW]; 23 size_t env_count; 24 } miniroon_env_map; 25 26 void miniroon_env_map_zero(miniroon_env_map *emap); 27 void miniroon_env_map_init(miniroon_env_map *emap); 28 void miniroon_env_map_add(miniroon_env_map *emap, const bytebuffer name); 29 miniroon_env_entry * miniroon_env_map_find(miniroon_env_map *emap, const bytebuffer name); 30 void miniroon_env_map_exec(miniroon_env_map *emap, char const *const *argv); 31 32 #endif 33