diff options
author | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2008-06-11 10:48:50 +0000 |
---|---|---|
committer | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2008-06-11 10:48:50 +0000 |
commit | 4e9a51d78ffa0696cf7d14ff0292ca8863689f70 (patch) | |
tree | 0509760011393888bddef1bfc0330d6a5b670671 /misc.c | |
parent | Updated version to 2.1_rc7e. (diff) | |
download | openvpn-4e9a51d78ffa0696cf7d14ff0292ca8863689f70.tar.xz |
Merged connection profiles from
http://svn.openvpn.net/projects/openvpn/test/conn
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@2993 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -940,6 +940,7 @@ setenv_str_ex (struct env_set *es, { const char *str = construct_name_value (name_tmp, val_tmp, &gc); env_set_add (es, str); + /*msg (M_INFO, "SETENV_ES '%s'", str);*/ } else env_set_del (es, name_tmp); @@ -975,6 +976,38 @@ setenv_str_ex (struct env_set *es, } /* + * Setenv functions that append an integer index to the name + */ +static const char * +setenv_format_indexed_name (const char *name, const int i, struct gc_arena *gc) +{ + struct buffer out = alloc_buf_gc (strlen (name) + 16, gc); + if (i >= 0) + buf_printf (&out, "%s_%d", name, i); + else + buf_printf (&out, "%s", name); + return BSTR (&out); +} + +void +setenv_int_i (struct env_set *es, const char *name, const int value, const int i) +{ + struct gc_arena gc = gc_new (); + const char *name_str = setenv_format_indexed_name (name, i, &gc); + setenv_int (es, name_str, value); + gc_free (&gc); +} + +void +setenv_str_i (struct env_set *es, const char *name, const char *value, const int i) +{ + struct gc_arena gc = gc_new (); + const char *name_str = setenv_format_indexed_name (name, i, &gc); + setenv_str (es, name_str, value); + gc_free (&gc); +} + +/* * taken from busybox networking/ifupdown.c */ unsigned int |