summaryrefslogtreecommitdiff
path: root/src/open.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-09 13:58:20 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-09 13:58:20 +0200
commit249866e3d1e11dc72eaa1305f4bb479ded92ef38 (patch)
tree7118c5f58e29fe61c100e4d067bb90ba8d52589e /src/open.c
parent96cf8dffe4f7b0b910f790066ae622dc429eb522 (diff)
reorganized file structure
Moved c files into src/. Corrected VERSION file. Removed BUILD and FILES.
Diffstat (limited to 'src/open.c')
-rw-r--r--src/open.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/open.c b/src/open.c
new file mode 100644
index 0000000..c430698
--- /dev/null
+++ b/src/open.c
@@ -0,0 +1,25 @@
+#include <sys/types.h>
+#include <fcntl.h>
+#include "open.h"
+
+/**
+ @file open.c
+ @author djb
+ @source qmail
+ @brief open a file
+*/
+
+int open_append(const char *fn)
+{ return open(fn,O_WRONLY | O_NDELAY | O_APPEND | O_CREAT,0600); }
+
+int open_excl(const char *fn)
+{ return open(fn,O_WRONLY | O_EXCL | O_CREAT,0644); }
+
+int open_read(const char *fn)
+{ return open(fn,O_RDONLY | O_NDELAY); }
+
+int open_trunc(const char *fn)
+{ return open(fn,O_WRONLY | O_NDELAY | O_TRUNC | O_CREAT,0644); }
+
+int open_write(const char *fn)
+{ return open(fn,O_WRONLY | O_NDELAY); }