brewco/futil.c

changeset 441
bde74a8f2ad7
parent 409
cdf68044adaf
child 445
3ec477cda546
--- a/brewco/futil.c	Sat Nov 28 13:47:00 2015 +0100
+++ b/brewco/futil.c	Sat Nov 28 20:15:38 2015 +0100
@@ -58,3 +58,20 @@
 }
 
 
+
+/*
+ * Test if the given file exists. The second option is:
+ * R_OK - test for Read rights 
+ * W_OK - test for Write rights
+ * X_OK - test for eXecute rights
+ * F_OK - test file presence only
+ */ 
+int file_exist(char *path, int mode)
+{
+    if (access(path, mode) != 0)
+	return errno;
+
+    return 0;
+}
+
+

mercurial