X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=quote.c;h=7a49fcf69671646a0d3ba6de6478cfc6767c31fe;hb=a0c0447b8eda07529eec2ae8fbc6bf68e1ff2d67;hp=ea49c7a99fb1fc28f786d53f528addf4dcbf5a02;hpb=ebbc088e13e1bf0dbf8eb08b00519602c176f864;p=git.git diff --git a/quote.c b/quote.c index ea49c7a99..7a49fcf69 100644 --- a/quote.c +++ b/quote.c @@ -120,6 +120,23 @@ char *sq_dequote(char *arg) return sq_dequote_step(arg, NULL); } +int sq_dequote_to_argv(char *arg, const char ***argv, int *nr, int *alloc) +{ + char *next = arg; + + if (!*arg) + return 0; + do { + char *dequoted = sq_dequote_step(next, &next); + if (!dequoted) + return -1; + ALLOC_GROW(*argv, *nr + 1, *alloc); + (*argv)[(*nr)++] = dequoted; + } while (next); + + return 0; +} + /* 1 means: quote as octal * 0 means: quote as octal if (quote_path_fully) * -1 means: never quote