summaryrefslogtreecommitdiff
path: root/quote.h
diff options
context:
space:
mode:
authorChristian Couder <chriscool@tuxfamily.org>2009-03-29 09:44:44 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-03-30 08:22:53 (GMT)
commitebbc088e13e1bf0dbf8eb08b00519602c176f864 (patch)
tree95af836ac5362c32303967cc733b93c228691562 /quote.h
parent89fbda24256157cc43848488429fd20cf3bb21ab (diff)
downloadgit-ebbc088e13e1bf0dbf8eb08b00519602c176f864.zip
git-ebbc088e13e1bf0dbf8eb08b00519602c176f864.tar.gz
git-ebbc088e13e1bf0dbf8eb08b00519602c176f864.tar.bz2
quote: implement "sq_dequote_many" to unwrap many args in one string
The sq_dequote() function does not allow parsing a string with more than one single-quoted parameter easily; use its code to implement a new API sq_dequote_step() to allow the caller iterate through such a string to parse them one-by-one. The original sq_dequote() becomes a thin wrapper around it. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'quote.h')
-rw-r--r--quote.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/quote.h b/quote.h
index c5eea6f..2315105 100644
--- a/quote.h
+++ b/quote.h
@@ -39,6 +39,14 @@ extern void sq_quote_argv(struct strbuf *, const char **argv, size_t maxlen);
*/
extern char *sq_dequote(char *);
+/*
+ * Same as the above, but can be used to unwrap many arguments in the
+ * same string separated by space. "next" is changed to point to the
+ * next argument that should be passed as first parameter. When there
+ * is no more argument to be dequoted, "next" is updated to point to NULL.
+ */
+extern char *sq_dequote_step(char *arg, char **next);
+
extern int unquote_c_style(struct strbuf *, const char *quoted, const char **endp);
extern size_t quote_c_style(const char *name, struct strbuf *, FILE *, int no_dq);
extern void quote_two_c_style(struct strbuf *, const char *, const char *, int);