File tree 2 files changed +16
-0
lines changed
2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,19 @@ void sq_quote_buf(struct strbuf *dst, const char *src)
43
43
free (to_free );
44
44
}
45
45
46
+ void sq_quotef (struct strbuf * dst , const char * fmt , ...)
47
+ {
48
+ struct strbuf src = STRBUF_INIT ;
49
+
50
+ va_list ap ;
51
+ va_start (ap , fmt );
52
+ strbuf_vaddf (& src , fmt , ap );
53
+ va_end (ap );
54
+
55
+ sq_quote_buf (dst , src .buf );
56
+ strbuf_release (& src );
57
+ }
58
+
46
59
void sq_quote_argv (struct strbuf * dst , const char * * argv , size_t maxlen )
47
60
{
48
61
int i ;
Original file line number Diff line number Diff line change @@ -25,10 +25,13 @@ struct strbuf;
25
25
* sq_quote_buf() writes to an existing buffer of specified size; it
26
26
* will return the number of characters that would have been written
27
27
* excluding the final null regardless of the buffer size.
28
+ *
29
+ * sq_quotef() quotes the entire formatted string as a single result.
28
30
*/
29
31
30
32
extern void sq_quote_buf (struct strbuf * , const char * src );
31
33
extern void sq_quote_argv (struct strbuf * , const char * * argv , size_t maxlen );
34
+ extern void sq_quotef (struct strbuf * , const char * fmt , ...);
32
35
33
36
/* This unwraps what sq_quote() produces in place, but returns
34
37
* NULL if the input does not look like what sq_quote would have
You can’t perform that action at this time.
0 commit comments