diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-07-08 17:13:53 -0300 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-07-08 17:13:53 -0300 |
commit | 1434eb3838581f8ee1cef1f15ce9bcd45398183c (patch) | |
tree | 06569be09f377c94322f1c6522b85f8c62376887 /src/basic/fileio.h | |
parent | 380aea0c5ba373df9fe37bdf0404442bd9034b92 (diff) | |
parent | ad118bda159d3f9c27c5a15ace54cf808a6e8788 (diff) |
Merge pull request #500 from zonque/fileio
fileio: consolidate write_string_file*()
Diffstat (limited to 'src/basic/fileio.h')
-rw-r--r-- | src/basic/fileio.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/basic/fileio.h b/src/basic/fileio.h index 91d4a0d2d5..2e8148ff24 100644 --- a/src/basic/fileio.h +++ b/src/basic/fileio.h @@ -25,10 +25,14 @@ #include "macro.h" -int write_string_stream(FILE *f, const char *line); -int write_string_file(const char *fn, const char *line); -int write_string_file_no_create(const char *fn, const char *line); -int write_string_file_atomic(const char *fn, const char *line); +typedef enum { + WRITE_STRING_FILE_CREATE = 1, + WRITE_STRING_FILE_ATOMIC = 2, + WRITE_STRING_FILE_AVOID_NEWLINE = 4, +} WriteStringFileFlags; + +int write_string_stream(FILE *f, const char *line, bool enforce_newline); +int write_string_file(const char *fn, const char *line, WriteStringFileFlags flags); int read_one_line_file(const char *fn, char **line); int read_full_file(const char *fn, char **contents, size_t *size); |