libpkgconf: document argvsplit module

feature/tap-sh
William Pitcock 2016-12-10 18:56:09 -06:00
parent bf4674fa1b
commit 828c290207
3 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,23 @@
libpkgconf `argvsplit` module
=============================
This is a lowlevel module which provides parsing of strings into argument vectors,
similar to what a shell would do.
.. c:function:: void pkgconf_argv_free(char **argv)
Frees an argument vector.
:param char** argv: The argument vector to free.
:return: nothing
.. c:function:: int pkgconf_argv_split(const char *src, int *argc, char ***argv)
Splits a string into an argument vector.
:param char* src: The string to split.
:param int* argc: A pointer to an integer to store the argument count.
:param char*** argv: A pointer to a pointer for an argument vector.
:return: 0 on success, -1 on error.
:rtype: int

View File

@ -4,4 +4,5 @@ libpkgconf - an API for managing `pkg-config` modules
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
libpkgconf-argvsplit
libpkgconf-client libpkgconf-client

View File

@ -15,6 +15,26 @@
#include <libpkgconf/libpkgconf.h> #include <libpkgconf/libpkgconf.h>
/*
* !doc
*
* libpkgconf `argvsplit` module
* =============================
*
* This is a lowlevel module which provides parsing of strings into argument vectors,
* similar to what a shell would do.
*/
/*
* !doc
*
* .. c:function:: void pkgconf_argv_free(char **argv)
*
* Frees an argument vector.
*
* :param char** argv: The argument vector to free.
* :return: nothing
*/
void void
pkgconf_argv_free(char **argv) pkgconf_argv_free(char **argv)
{ {
@ -22,6 +42,19 @@ pkgconf_argv_free(char **argv)
free(argv); free(argv);
} }
/*
* !doc
*
* .. c:function:: int pkgconf_argv_split(const char *src, int *argc, char ***argv)
*
* Splits a string into an argument vector.
*
* :param char* src: The string to split.
* :param int* argc: A pointer to an integer to store the argument count.
* :param char*** argv: A pointer to a pointer for an argument vector.
* :return: 0 on success, -1 on error.
* :rtype: int
*/
int int
pkgconf_argv_split(const char *src, int *argc, char ***argv) pkgconf_argv_split(const char *src, int *argc, char ***argv)
{ {