diff options
| author | Jiang Xin <worldhello.net@gmail.com> | 2012-02-28 12:23:26 +0800 |
|---|---|---|
| committer | Jiang Xin <worldhello.net@gmail.com> | 2012-02-28 12:23:26 +0800 |
| commit | 508d1244dc8d38188c70e98207efa8a97d16b47c (patch) | |
| tree | fc8688b80be453755f8135df11bf1db2d247725a /strbuf.c | |
| parent | l10n: fast-forward here is ff-only merge, not push (diff) | |
| parent | Merge branch 'maint' (diff) | |
| download | git-508d1244dc8d38188c70e98207efa8a97d16b47c.tar.gz git-508d1244dc8d38188c70e98207efa8a97d16b47c.zip | |
Merge branch 'master' into git-po
Diffstat (limited to 'strbuf.c')
| -rw-r--r-- | strbuf.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -383,6 +383,22 @@ int strbuf_getline(struct strbuf *sb, FILE *fp, int term) return 0; } +int strbuf_getwholeline_fd(struct strbuf *sb, int fd, int term) +{ + strbuf_reset(sb); + + while (1) { + char ch; + ssize_t len = xread(fd, &ch, 1); + if (len <= 0) + return EOF; + strbuf_addch(sb, ch); + if (ch == term) + break; + } + return 0; +} + int strbuf_read_file(struct strbuf *sb, const char *path, size_t hint) { int fd, len; |
