summaryrefslogtreecommitdiff
path: root/src/shared/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/util.h')
-rw-r--r--src/shared/util.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/shared/util.h b/src/shared/util.h
index 2aa8da0989..e9178b9bd3 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -140,7 +140,9 @@ char *truncate_nl(char *s);
int rmdir_parents(const char *path, const char *stop);
char hexchar(int x) _const_;
+int unhexchar(char c) _const_;
char octchar(int x) _const_;
+int unoctchar(char c) _const_;
char *cescape(const char *s);
size_t cescape_char(char c, char *buf);
@@ -219,6 +221,7 @@ int fopen_temporary(const char *path, FILE **_f, char **_temp_path);
ssize_t loop_read(int fd, void *buf, size_t nbytes, bool do_poll);
int loop_read_exact(int fd, void *buf, size_t nbytes, bool do_poll);
+int loop_write(int fd, const void *buf, size_t nbytes, bool do_poll);
char* dirname_malloc(const char *path);
@@ -383,13 +386,15 @@ int unlink_noerrno(const char *path);
static inline void qsort_safe(void *base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *)) {
- if (nmemb) {
- assert(base);
- qsort(base, nmemb, size, compar);
- }
+ if (nmemb <= 1)
+ return;
+
+ assert(base);
+ qsort(base, nmemb, size, compar);
}
int proc_cmdline(char **ret);
+int parse_proc_cmdline(int (*parse_word)(const char *key, const char *value));
int getpeercred(int fd, struct ucred *ucred);
#if HAVE_DECL_MKOSTEMP
@@ -408,6 +413,13 @@ int tempfn_xxxxxx(const char *p, char **ret);
int is_dir(const char *path, bool follow);
+typedef enum UnquoteFlags {
+ UNQUOTE_RELAX = 1,
+ UNQUOTE_CUNESCAPE = 2,
+} UnquoteFlags;
+
+int unquote_first_word(const char **p, char **ret, UnquoteFlags flags);
+
int execute_command(const char *command, char *const argv[]);
#define INOTIFY_EVENT_MAX (sizeof(struct inotify_event) + NAME_MAX + 1)