diff options
author | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-09 13:02:45 +0200 |
---|---|---|
committer | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-09 13:02:45 +0200 |
commit | 96cf8dffe4f7b0b910f790066ae622dc429eb522 (patch) | |
tree | cc1343a0ac92bb4836cae2dd63a97fa045765e7f /open.c |
initial commit of version 23fehQlibs-23
Diffstat (limited to 'open.c')
-rw-r--r-- | open.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -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); } |