Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index 206d594370..b2d24da73f 100644
--- a/cache.h
+++ b/cache.h
@@ -1740,6 +1740,14 @@ static inline ssize_t write_str_in_full(int fd, const char *str)
*/
extern void write_file_buf(const char *path, const char *buf, size_t len);
+/**
+ * Like write_file_buf(), but format the contents into a buffer first.
+ * Additionally, write_file() will append a newline if one is not already
+ * present, making it convenient to write text files:
+ *
+ * write_file(path, "counter: %d", ctr);
+ */
+__attribute__((format (printf, 2, 3)))
extern void write_file(const char *path, const char *fmt, ...);
/* pager.c */