Although popt is usually used for parsing arguments already divided into an argv-style array, some programs need to parse strings that are formatted identically to command lines. To facilitate this, popt provides a function that parses a string into an array of string, using rules similar to normal shell parsing.
#include <popt.h> int poptParseArgvString(char * s, int * argcPtr, char *** argvPtr);
The string s is parsed into an argv-style array. The integer pointed to by the second parameter, argcPtr, contains the number of elements parsed, and the pointer pointed to by the final parameter is set to point to the newly created array. The array is dynamically allocated and should be free() ed when the application is finished with it.
The argvPtr created by poptParseArgvString() is suitable to pass directly to poptGetContext().
 This is often a good time to use POPT_CONTEXT_KEEP_FIRST.