chiark / gitweb /
Prep v233: Add missing updates from upstream in src/basic
[elogind.git] / src / basic / fileio.c
index 5cf33b48bb0cbaab5c415767916ca9ab254ef864..822855c9d939e5dd92101bf1941536e6cbf57dc5 100644 (file)
@@ -553,13 +553,14 @@ static int parse_env_file_internal(
                 }
         }
 
-        if (state == PRE_VALUE ||
-            state == VALUE ||
-            state == VALUE_ESCAPE ||
-            state == SINGLE_QUOTE_VALUE ||
-            state == SINGLE_QUOTE_VALUE_ESCAPE ||
-            state == DOUBLE_QUOTE_VALUE ||
-            state == DOUBLE_QUOTE_VALUE_ESCAPE) {
+        if (IN_SET(state,
+                   PRE_VALUE,
+                   VALUE,
+                   VALUE_ESCAPE,
+                   SINGLE_QUOTE_VALUE,
+                   SINGLE_QUOTE_VALUE_ESCAPE,
+                   DOUBLE_QUOTE_VALUE,
+                   DOUBLE_QUOTE_VALUE_ESCAPE)) {
 
                 key[n_key] = 0;
 
@@ -712,6 +713,7 @@ int load_env_file(FILE *f, const char *fname, const char *newline, char ***rl) {
         *rl = m;
         return 0;
 }
+#endif // 0
 
 static int load_env_file_push_pairs(
                 const char *filename, unsigned line,
@@ -761,6 +763,7 @@ int load_env_file_pairs(FILE *f, const char *fname, const char *newline, char **
         *rl = m;
         return 0;
 }
+#if 0 /// UNNEEDED by elogind
 
 static int merge_env_file_push(
                 const char *filename, unsigned line,
@@ -785,7 +788,9 @@ static int merge_env_file_push(
         }
 
         expanded_value = replace_env(value, *env,
-                                     REPLACE_ENV_USE_ENVIRONMENT|REPLACE_ENV_ALLOW_BRACELESS);
+                                     REPLACE_ENV_USE_ENVIRONMENT|
+                                     REPLACE_ENV_ALLOW_BRACELESS|
+                                     REPLACE_ENV_ALLOW_EXTENDED);
         if (!expanded_value)
                 return -ENOMEM;
 
@@ -800,7 +805,7 @@ int merge_env_file(
                 const char *fname) {
 
         /* NOTE: this function supports braceful and braceless variable expansions,
-         * unlike other exported parsing functions.
+         * plus "extended" substitutions, unlike other exported parsing functions.
          */
 
         return parse_env_file_internal(f, fname, NEWLINE, merge_env_file_push, env, NULL);
@@ -1311,6 +1316,7 @@ int fputs_with_space(FILE *f, const char *s, const char *separator, bool *space)
 
         return fputs(s, f);
 }
+#endif // 0
 
 int open_tmpfile_unlinkable(const char *directory, int flags) {
         char *p;
@@ -1341,6 +1347,7 @@ int open_tmpfile_unlinkable(const char *directory, int flags) {
         return fd;
 }
 
+#if 0 /// UNNEEDED by elogind
 int open_tmpfile_linkable(const char *target, int flags, char **ret_path) {
         _cleanup_free_ char *tmp = NULL;
         int r, fd;
@@ -1384,6 +1391,7 @@ int open_tmpfile_linkable(const char *target, int flags, char **ret_path) {
 
         return fd;
 }
+#endif // 0
 
 int open_serialization_fd(const char *ident) {
         int fd = -1;
@@ -1404,6 +1412,7 @@ int open_serialization_fd(const char *ident) {
         return fd;
 }
 
+#if 0 /// UNNEEDED by elogind
 int link_tmpfile(int fd, const char *path, const char *target) {
 
         assert(fd >= 0);