chiark / gitweb /
util: introduce mkdir_parents() that creates parent paths of sockets and suchlike
[elogind.git] / util.h
diff --git a/util.h b/util.h
index bdbaa36e13b0719756c0a98f92d4ce3edf5ebbb6..ba7e542baa15cac6b8092e3d48985dfc8e635b2f 100644 (file)
--- a/util.h
+++ b/util.h
@@ -3,6 +3,25 @@
 #ifndef fooutilhfoo
 #define fooutilhfoo
 
+/***
+  This file is part of systemd.
+
+  Copyright 2010 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
 #include <inttypes.h>
 #include <time.h>
 #include <sys/time.h>
@@ -78,6 +97,7 @@ int safe_atolli(const char *s, long long int *ret_i);
 
 char *split_spaces(const char *c, size_t *l, char **state);
 char *split_quoted(const char *c, size_t *l, char **state);
+char *split_slash(const char *c, size_t *l, char **state);
 
 #define FOREACH_WORD(word, length, s, state)                            \
         for ((state) = NULL, (word) = split_spaces((s), &(l), &(state)); (word); (word) = split_spaces((s), &(l), &(state)))
@@ -85,6 +105,9 @@ char *split_quoted(const char *c, size_t *l, char **state);
 #define FOREACH_WORD_QUOTED(word, length, s, state)                     \
         for ((state) = NULL, (word) = split_quoted((s), &(l), &(state)); (word); (word) = split_quoted((s), &(l), &(state)))
 
+#define FOREACH_WORD_SLASH(word, length, s, state)                      \
+        for ((state) = NULL, (word) = split_slash((s), &(l), &(state)); (word); (word) = split_slash((s), &(l), &(state)))
+
 pid_t get_parent_of_pid(pid_t pid, pid_t *ppid);
 
 int write_one_line_file(const char *fn, const char *line);
@@ -104,6 +127,7 @@ int reset_all_signal_handlers(void);
 
 char *strstrip(char *s);
 char *file_in_same_dir(const char *path, const char *filename);
+int mkdir_parents(const char *path, mode_t mode);
 
 char hexchar(int x);
 int unhexchar(char c);