aboutsummaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2005-11-09 07:30:14 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2005-11-09 07:30:14 +0000
commiteadf16a660310162bcc3cadda26f44acd3b83077 (patch)
tree7d384ed3923bb28c553d57bf9ca760f5aba51703 /buffer.c
parentAdded ENABLE_INLINE_FILES feature. (diff)
downloadopenvpn-eadf16a660310162bcc3cadda26f44acd3b83077.tar.xz
Removed annoying 'i' variable from add_option.
Allow plugin and push directives to have multiple parameters specified instead of only 1 quoted parameter. Allow plugin and push directives to have multi-line parameter lists, such as: <plugin> my-plugin.so parm1 parm2 </plugin> git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@785 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/buffer.c b/buffer.c
index 3b856bc..5ff6123 100644
--- a/buffer.c
+++ b/buffer.c
@@ -398,6 +398,19 @@ buf_chomp (struct buffer *buf)
buf_null_terminate (buf);
}
+const char *
+skip_leading_whitespace (const char *str)
+{
+ while (*str)
+ {
+ const char c = *str;
+ if (!(c == ' ' || c == '\t'))
+ break;
+ ++str;
+ }
+ return str;
+}
+
/*
* like buf_null_terminate, but operate on strings
*/
@@ -475,6 +488,42 @@ string_clear (char *str)
}
/*
+ * Return the length of a string array
+ */
+int
+string_array_len (const char **array)
+{
+ int i = 0;
+ if (array)
+ {
+ while (array[i])
+ ++i;
+ }
+ return i;
+}
+
+char *
+print_argv (const char **p, struct gc_arena *gc, const unsigned int flags)
+{
+ struct buffer out = alloc_buf_gc (256, gc);
+ int i = 0;
+ for (;;)
+ {
+ const char *cp = *p++;
+ if (!cp)
+ break;
+ if (i)
+ buf_printf (&out, " ");
+ if (flags & PA_BRACKET)
+ buf_printf (&out, "[%s]", cp);
+ else
+ buf_printf (&out, "%s", cp);
+ ++i;
+ }
+ return BSTR (&out);
+}
+
+/*
* Allocate a string inside a buffer
*/
struct buffer