diff options
Diffstat (limited to 'strbuf.h')
-rw-r--r-- | strbuf.h | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -99,6 +99,16 @@ __attribute__((format (printf,2,3))) extern void strbuf_addf(struct strbuf *sb, const char *fmt, ...); __attribute__((format (printf,2,0))) extern void strbuf_vaddf(struct strbuf *sb, const char *fmt, va_list ap); +__attribute__((format (printf,2,3))) +extern void strbuf_addf_ln(struct strbuf *sb, const char *fmt, ...); + +extern void strbuf_add_lines(struct strbuf *sb, const char *prefix, const char *buf, size_t size); + +static inline void strbuf_complete_line(struct strbuf *sb) +{ + if (sb->len && sb->buf[sb->len - 1] != '\n') + strbuf_addch(sb, '\n'); +} extern size_t strbuf_fread(struct strbuf *, size_t, FILE *); /* XXX: if read fails, any partial read is undone */ @@ -108,6 +118,7 @@ extern int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint); extern int strbuf_getwholeline(struct strbuf *, FILE *, int); extern int strbuf_getline(struct strbuf *, FILE *, int); +extern int strbuf_getwholeline_fd(struct strbuf *, int, int); extern void stripspace(struct strbuf *buf, int skip_comments); extern int launch_editor(const char *path, struct strbuf *buffer, const char *const *env); @@ -115,4 +126,14 @@ extern int launch_editor(const char *path, struct strbuf *buffer, const char *co extern int strbuf_branchname(struct strbuf *sb, const char *name); extern int strbuf_check_branch_ref(struct strbuf *sb, const char *name); +extern void strbuf_add_urlencode(struct strbuf *, const char *, size_t, + int reserved); +extern void strbuf_addstr_urlencode(struct strbuf *, const char *, + int reserved); + +__attribute__((format (printf,1,2))) +extern int printf_ln(const char *fmt, ...); +__attribute__((format (printf,2,3))) +extern int fprintf_ln(FILE *fp, const char *fmt, ...); + #endif /* STRBUF_H */ |