path: root/dir.h
diff options
authorJohannes Schindelin <>2007-08-01 00:29:17 (GMT)
committerJunio C Hamano <>2007-08-01 07:38:30 (GMT)
commite663674722d8a64a208d8c176d5bfc340c04b964 (patch)
tree65a56b68ff6a1bc7d1eb20ad1b3af9c23c297a10 /dir.h
parente5392c51469c25851f9c6e53165d75fc61901768 (diff)
Add functions get_relative_cwd() and is_inside_dir()
The function get_relative_cwd() works just as getcwd(), only that it takes an absolute path as additional parameter, returning the prefix of the current working directory relative to the given path. If the cwd is no subdirectory of the given path, it returns NULL. is_inside_dir() is just a trivial wrapper over get_relative_cwd(). Signed-off-by: Johannes Schindelin <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'dir.h')
1 files changed, 3 insertions, 0 deletions
diff --git a/dir.h b/dir.h
index ec0e8ab..f55a87b 100644
--- a/dir.h
+++ b/dir.h
@@ -61,4 +61,7 @@ extern void add_exclude(const char *string, const char *base,
extern int file_exists(const char *);
extern struct dir_entry *dir_add_name(struct dir_struct *dir, const char *pathname, int len);
+extern char *get_relative_cwd(char *buffer, int size, const char *dir);
+extern int is_inside_dir(const char *dir);