aboutsummaryrefslogtreecommitdiffstats
path: root/open.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--open.c (renamed from openfile.c)18
1 files changed, 18 insertions, 0 deletions
diff --git a/openfile.c b/open.c
index e019d05..8d1a4c5 100644
--- a/openfile.c
+++ b/open.c
@@ -3,6 +3,24 @@
int
+patheq(const char *have, const char *want, const char **end_out)
+{
+ while (*want) {
+ if (*have != *want)
+ return 0;
+ if (*have == '/') {
+ while (*++have == '/');
+ while (*++want == '/');
+ }
+ }
+ if (!end_out)
+ return !*have;
+ *end_out = have;
+ return 1;
+}
+
+
+int
openfile(const char *path, int *is_new_fd_out, const char **fname_out)
{
const char *p;