chiark / gitweb /
systemctl: beef up highlighting of service states a little
[elogind.git] / src / util.h
index fed0e670ef97dec420fd0c2294dfa5dda0c75044..d08c7b0e7ad5000e8f56e7c953c28786dff07cd7 100644 (file)
@@ -61,6 +61,7 @@ typedef struct dual_timestamp {
 #define FORMAT_TIMESPAN_MAX 64
 
 #define ANSI_HIGHLIGHT_ON "\x1B[1;31m"
+#define ANSI_HIGHLIGHT_GREEN_ON "\x1B[1;32m"
 #define ANSI_HIGHLIGHT_OFF "\x1B[0m"
 
 usec_t now(clockid_t clock);
@@ -183,6 +184,10 @@ int write_one_line_file(const char *fn, const char *line);
 int read_one_line_file(const char *fn, char **line);
 
 char *strappend(const char *s, const char *suffix);
+char *strnappend(const char *s, const char *suffix, size_t length);
+
+char *replace_env(const char *format, char **env);
+char **replace_env_argv(char **argv, char **env);
 
 int readlink_malloc(const char *p, char **r);
 int readlink_and_make_absolute(const char *p, char **r);
@@ -208,6 +213,8 @@ int safe_mkdir(const char *path, mode_t mode, uid_t uid, gid_t gid);
 int mkdir_parents(const char *path, mode_t mode);
 int mkdir_p(const char *path, mode_t mode);
 
+int parent_of_path(const char *path, char **parent);
+
 int rmdir_parents(const char *path, const char *stop);
 
 int get_process_name(pid_t pid, char **name);
@@ -222,6 +229,12 @@ int undecchar(char c);
 
 char *cescape(const char *s);
 char *cunescape(const char *s);
+char *cunescape_length(const char *s, size_t length);
+
+char *xescape(const char *s, const char *bad);
+
+char *bus_path_escape(const char *s);
+char *bus_path_unescape(const char *s);
 
 char *path_kill_slashes(char *path);
 
@@ -230,11 +243,6 @@ bool path_equal(const char *a, const char *b);
 
 char *ascii_strlower(char *path);
 
-char *xescape(const char *s, const char *bad);
-
-char *bus_path_escape(const char *s);
-char *bus_path_unescape(const char *s);
-
 bool ignore_file(const char *filename);
 
 bool chars_intersect(const char *a, const char *b);
@@ -323,6 +331,12 @@ void status_vprintf(const char *format, va_list ap);
 void status_printf(const char *format, ...);
 void status_welcome(void);
 
+int columns(void);
+
+int running_in_chroot(void);
+
+char *ellipsize(const char *s, unsigned length, unsigned percent);
+
 const char *ioprio_class_to_string(int i);
 int ioprio_class_from_string(const char *s);
 
@@ -344,4 +358,17 @@ int rlimit_from_string(const char *s);
 const char *ip_tos_to_string(int i);
 int ip_tos_from_string(const char *s);
 
+const char *signal_to_string(int i);
+int signal_from_string(const char *s);
+
+int label_init(void);
+int label_fix(const char *path);
+void label_finish(void);
+int label_socket_set(const char *label);
+void label_socket_clear(void);
+int label_fifofile_set(const char *label, const char *path);
+void label_file_clear(void);
+void label_free(const char *label);
+int label_get_socket_label_from_exe(const char *exe, char **label);
+
 #endif