Briefly explain the zoo of quoting functions.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
This is just a starting point, I fear. Not even compile-tested.
Problems:
- not very brief
- not a great overview
But I was happy to have the chance to read through the available
functions.
Suggestions and other improvements welcome.
Documentation/technical/api-quote.txt | 124 ++++++++++++++++++++++++++++++---
quote.h | 14 ++--
2 files changed, 121 insertions(+), 17 deletions(-)
rewrite Documentation/technical/api-quote.txt (84%)
diff --git a/Documentation/technical/api-quote.txt b/Documentation/technical/api-quote.txt
dissimilarity index 84%
index e8a1bce..18da370 100644
--- a/Documentation/technical/api-quote.txt
+++ b/Documentation/technical/api-quote.txt
@@ -1,10 +1,114 @@
-quote API
-=========
-
-Talk about <quote.h>, things like
-
-* sq_quote and unquote
-* c_style quote and unquote
-* quoting for foreign languages
-
-(JC)
+quote API
+=========
+
+The quoting API can be used to replace unusual characters for
+shell safety or for output readability and parseability.
+It also can be used to perform the inverse operation and recover
+the unusual characters again.
+
+C-style quoting
+---------------
+
+`quote_c_style` quotes a string in a manner that might be familiar
+to C programmers. This can be used to quote newlines and tabs in
+filenames for patches, for example.
+
+. if sb and fp are both NULL, it returns the number of bytes needed
+ to hold the quoted version of "name", counting the double quotes
+ around it but not terminating NUL. If "name" does not need quoting,
+ it returns 0.
+
+. otherwise, it emits the quoted version of "name" to a stream,
+ strbuf, or both. Output will have enclosing double quotes
+ suppressed if requested with the "no_dq" parameter.
+
+`quote_two_c_style`::
+ Quote two paths (prefix + path) in C-style and concatenate them.
+ One should use this instead of ...