8 #define POPT_ARGV_ARRAY_GROW_DELTA 5
11 int * argcPtr,
const char *** argvPtr)
13 size_t nb = (argc + 1) *
sizeof(*argv);
18 for (i = 0; i < argc; i++) {
21 nb += strlen(argv[i]) + 1;
24 dst = (
char *)malloc(nb);
25 argv2 = (
const char**) dst;
26 dst += (argc + 1) *
sizeof(*argv);
28 for (i = 0; i < argc; i++) {
30 dst += strlen(strcpy(dst, argv[i])) + 1;
44 const char ** argv = (
const char **)malloc(
sizeof(*argv) * argvAlloced);
46 int buflen = strlen(s) + 1;
47 char * buf = (
char*)memset(
alloca(buflen), 0, buflen);
51 for (src = s; *src; src++) {
61 if (*src != quote) *buf++ =
'\\';
64 }
else if (isspace(*src)) {
67 if (argc == argvAlloced) {
69 argv = (
const char**)realloc((
void*)argv,
sizeof(*argv) * argvAlloced);
73 }
else switch (*src) {
91 if (strlen(argv[argc])) {
#define POPT_ERROR_BADQUOTE
int poptDupArgv(int argc, const char **argv, int *argcPtr, const char ***argvPtr)
#define POPT_ARGV_ARRAY_GROW_DELTA
int poptParseArgvString(const char *s, int *argcPtr, const char ***argvPtr)