summaryrefslogtreecommitdiff
path: root/strbuf.h
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2014-07-28 20:24:29 +0200
committerJunio C Hamano <gitster@pobox.com>2014-07-28 13:48:07 -0700
commitf22a76e9110e8e31efa3781b1a3cf2b4565d9e8a (patch)
treead22c9025beca75ad94f43bede840ca46a529ba6 /strbuf.h
parentebc5da3208824e25a89672a3b91bd13629b215fe (diff)
downloadgit-f22a76e9110e8e31efa3781b1a3cf2b4565d9e8a.tar.gz
strbuf: add strbuf_getcwd()
Add strbuf_getcwd(), which puts the current working directory into a strbuf. Because it doesn't use a fixed-size buffer it supports arbitrarily long paths, provided the platform's getcwd() does as well. At least on Linux and FreeBSD it handles paths longer than PATH_MAX just fine. Suggested-by: Karsten Blees <karsten.blees@gmail.com> Helped-by: Duy Nguyen <pclouds@gmail.com> Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'strbuf.h')
-rw-r--r--strbuf.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/strbuf.h b/strbuf.h
index 39c14cfa38..23b16c6cdf 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -163,6 +163,7 @@ extern size_t strbuf_fread(struct strbuf *, size_t, FILE *);
extern ssize_t strbuf_read(struct strbuf *, int fd, size_t hint);
extern int strbuf_read_file(struct strbuf *sb, const char *path, size_t hint);
extern int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint);
+extern int strbuf_getcwd(struct strbuf *sb);
extern int strbuf_getwholeline(struct strbuf *, FILE *, int);
extern int strbuf_getline(struct strbuf *, FILE *, int);