X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Futil.h;h=504f63a28fe02bc5711be3492c9a4054784b1455;hb=4545a231fcccc2ef670ef70f7b38f4e0a04f86ae;hp=d90b8084769ce77efa7673600e10386fd44a10e4;hpb=04d39279245834494baccfdb9349db8bf80abd13;p=elogind.git diff --git a/src/shared/util.h b/src/shared/util.h index d90b80847..504f63a28 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -237,9 +237,6 @@ char *cunescape_length_with_prefix(const char *s, size_t length, const char *pre char *xescape(const char *s, const char *bad); -char *bus_path_escape(const char *s); -char *bus_path_unescape(const char *s); - char *ascii_strlower(char *path); bool dirent_is_file(const struct dirent *de) _pure_; @@ -398,6 +395,10 @@ static inline const char *ansi_highlight_green(void) { return on_tty() ? ANSI_HIGHLIGHT_GREEN_ON : ""; } +static inline const char *ansi_highlight_yellow(void) { + return on_tty() ? ANSI_HIGHLIGHT_YELLOW_ON : ""; +} + static inline const char *ansi_highlight_off(void) { return on_tty() ? ANSI_HIGHLIGHT_OFF : ""; } @@ -622,6 +623,7 @@ typedef enum DrawSpecialChar { DRAW_TREE_RIGHT, DRAW_TREE_SPACE, DRAW_TRIANGULAR_BULLET, + DRAW_BLACK_CIRCLE, _DRAW_SPECIAL_CHAR_MAX } DrawSpecialChar; const char *draw_special_char(DrawSpecialChar ch); @@ -634,7 +636,6 @@ int on_ac_power(void); int search_and_fopen(const char *path, const char *mode, const char **search, FILE **_f); int search_and_fopen_nulstr(const char *path, const char *mode, const char *search, FILE **_f); -int create_tmp_dir(char template[], char** dir_name); #define FOREACH_LINE(line, f, on_error) \ for (;;) \ @@ -668,8 +669,11 @@ char *strextend(char **x, ...) _sentinel_; char *strrep(const char *s, unsigned n); void* greedy_realloc(void **p, size_t *allocated, size_t need); +void* greedy_realloc0(void **p, size_t *allocated, size_t need); #define GREEDY_REALLOC(array, allocated, need) \ greedy_realloc((void**) &(array), &(allocated), sizeof((array)[0]) * (need)) +#define GREEDY_REALLOC0(array, allocated, need) \ + greedy_realloc0((void**) &(array), &(allocated), sizeof((array)[0]) * (need)) static inline void _reset_errno_(int *saved_errno) { errno = *saved_errno; @@ -770,7 +774,7 @@ void parse_user_at_host(char *arg, char **user, char **host); int split_pair(const char *s, const char *sep, char **l, char **r); -bool restore_state(void); +int shall_restore_state(void); /** * Normal qsort requires base to be nonnull. Here were require @@ -783,3 +787,5 @@ static inline void qsort_safe(void *base, size_t nmemb, size_t size, qsort(base, nmemb, size, compar); } } + +int proc_cmdline(char **ret);