These functions can parse a string into argv style arguments.
Splits the string
into individual arguments and returns an argv vector.
The first element of the returned vector is non-NULL it contains
an error message and the conversion was a failure.
Otherwise the remainder of the vector contains the parsed arguments,
terminated by a NULL element.
The returned argv and the storage for the arguments are allocated with
but should only be freed with the
argument is non-zero, any argument starting with a # character will
terminate the parsing, rendering the remainder of the input string a comment.
Arguments can be included in double quotes " and the usual backslash
escapes are recognized and converted.
av = PhkArgvParse(p, 0);
if (av != NULL)
err(1, "Parse error: %s", av);
for (i = 1; av[i] != NULL; i++)
printf("av[%d] = %s\n", i, av[i]);