Index: qparse.c =================================================================== --- qparse.c (revision 4635) +++ qparse.c (revision 4636) @@ -19,6 +19,7 @@ #include #include +#include "qparse.h" typedef enum qp_state_e { qp_normal, @@ -56,7 +57,7 @@ argv = realloc(argv, sizeof(char *) * allocated); \ } \ buff[buff_used] = '\0'; \ - argv[argc] = strdup(buff); \ + argv[argc] = qparse_strdup(buff); \ argc++; \ *buff = '\0'; \ buff_used = 0; \ @@ -140,3 +141,12 @@ free(*argv_ret); *argv_ret = NULL; } + +char *qparse_strdup(const char *s) +{ + int l = strlen(s); + char *o; + o = malloc(l+1); + memcpy(o, s, l+1); + return o; +} Index: qparse.h =================================================================== --- qparse.h (revision 4635) +++ qparse.h (revision 4636) @@ -7,3 +7,5 @@ /* Free an argv_ret array allocated by qparse. */ void qparse_free(int argc, char **argv_ret[]); +/* for C89 - that doesn't have strdup()*/ +char *qparse_strdup(const char *s);