]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/env-file.h
Merge pull request #27207 from masatake/busctl--help-msg
[thirdparty/systemd.git] / src / basic / env-file.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include <fcntl.h>
5 #include <stdarg.h>
6 #include <stdio.h>
7
8 #include "macro.h"
9
10 int parse_env_filev(FILE *f, const char *fname, va_list ap);
11 int parse_env_file_fdv(int fd, const char *fname, va_list ap);
12 int parse_env_file_sentinel(FILE *f, const char *fname, ...) _sentinel_;
13 #define parse_env_file(f, fname, ...) parse_env_file_sentinel(f, fname, __VA_ARGS__, NULL)
14 int parse_env_file_fd_sentinel(int fd, const char *fname, ...) _sentinel_;
15 #define parse_env_file_fd(fd, fname, ...) parse_env_file_fd_sentinel(fd, fname, __VA_ARGS__, NULL)
16 int load_env_file(FILE *f, const char *fname, char ***ret);
17 int load_env_file_pairs(FILE *f, const char *fname, char ***ret);
18 int load_env_file_pairs_fd(int fd, const char *fname, char ***ret);
19
20 int merge_env_file(char ***env, FILE *f, const char *fname);
21
22 int write_env_file_at(int dir_fd, const char *fname, char **l);
23 static inline int write_env_file(const char *fname, char **l) {
24 return write_env_file_at(AT_FDCWD, fname, l);
25 }