diff options
Diffstat (limited to 'doc/en')
-rw-r--r-- | doc/en/weechat_plugin_api.en.txt | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/doc/en/weechat_plugin_api.en.txt b/doc/en/weechat_plugin_api.en.txt index 0bbdf514d..9d3d8ebc5 100644 --- a/doc/en/weechat_plugin_api.en.txt +++ b/doc/en/weechat_plugin_api.en.txt @@ -1326,6 +1326,51 @@ weechat_string_free_split (argv); [NOTE] This function is not available in scripting API. +==== weechat_string_split_shell + +_WeeChat ≥ 0.4.4._ + +Split a string like the shell does for a command with arguments. + +This function is a C conversion of Python class "shlex" (file: Lib/shlex.py in +Python repository), see: http://docs.python.org/3/library/shlex.html. + +Prototype: + +[source,C] +---- +char **weechat_string_split_shell (const char *string, int *num_items); +---- + +Arguments: + +* 'string': string to split +* 'num_items': pointer to int which will contain number of items created + +Return value: + +* array of strings, NULL if problem (must be freed by calling + <<_weechat_string_free_split,weechat_string_free_split>> after use) + +C example: + +[source,C] +---- +char **argv; +int argc; +argv = weechat_string_split_shell ("test 'first arg' \"second arg\"", &argc); +/* result: argv[0] == "test" + argv[1] == "first arg" + argv[2] == "second arg" + argv[3] == NULL + argc == 3 +*/ +weechat_string_free_split (argv); +---- + +[NOTE] +This function is not available in scripting API. + ==== weechat_string_free_split Free memory used by a split string. |