summaryrefslogtreecommitdiffstats
path: root/misc.c
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2008-06-11 10:48:50 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2008-06-11 10:48:50 +0000
commit4e9a51d78ffa0696cf7d14ff0292ca8863689f70 (patch)
tree0509760011393888bddef1bfc0330d6a5b670671 /misc.c
parent90efcacba6378a4e29275cd6e9914d73d836a4a4 (diff)
downloadopenvpn-4e9a51d78ffa0696cf7d14ff0292ca8863689f70.tar.gz
openvpn-4e9a51d78ffa0696cf7d14ff0292ca8863689f70.tar.xz
openvpn-4e9a51d78ffa0696cf7d14ff0292ca8863689f70.zip
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.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/misc.c b/misc.c
index 5f0ec12..0ac1250 100644
--- a/misc.c
+++ b/misc.c
@@ -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