| 1 | #ifndef BABELTRACE_COMMON_INTERNAL_H |
| 2 | #define BABELTRACE_COMMON_INTERNAL_H |
| 3 | |
| 4 | #include <stdbool.h> |
| 5 | #include <babeltrace/babeltrace-internal.h> |
| 6 | |
| 7 | #define BT_COMMON_COLOR_RESET "\033[0m" |
| 8 | #define BT_COMMON_COLOR_BOLD "\033[1m" |
| 9 | #define BT_COMMON_COLOR_FG_DEFAULT "\033[39m" |
| 10 | #define BT_COMMON_COLOR_FG_RED "\033[31m" |
| 11 | #define BT_COMMON_COLOR_FG_GREEN "\033[32m" |
| 12 | #define BT_COMMON_COLOR_FG_YELLOW "\033[33m" |
| 13 | #define BT_COMMON_COLOR_FG_BLUE "\033[34m" |
| 14 | #define BT_COMMON_COLOR_FG_MAGENTA "\033[35m" |
| 15 | #define BT_COMMON_COLOR_FG_CYAN "\033[36m" |
| 16 | #define BT_COMMON_COLOR_FG_LIGHT_GRAY "\033[37m" |
| 17 | #define BT_COMMON_COLOR_BG_DEFAULT "\033[49m" |
| 18 | #define BT_COMMON_COLOR_BG_RED "\033[41m" |
| 19 | #define BT_COMMON_COLOR_BG_GREEN "\033[42m" |
| 20 | #define BT_COMMON_COLOR_BG_YELLOW "\033[43m" |
| 21 | #define BT_COMMON_COLOR_BG_BLUE "\033[44m" |
| 22 | #define BT_COMMON_COLOR_BG_MAGENTA "\033[45m" |
| 23 | #define BT_COMMON_COLOR_BG_CYAN "\033[46m" |
| 24 | #define BT_COMMON_COLOR_BG_LIGHT_GRAY "\033[47m" |
| 25 | |
| 26 | struct bt_common_lttng_live_url_parts { |
| 27 | GString *proto; |
| 28 | GString *hostname; |
| 29 | GString *target_hostname; |
| 30 | GString *session_name; |
| 31 | |
| 32 | /* -1 means default port */ |
| 33 | int port; |
| 34 | }; |
| 35 | |
| 36 | BT_HIDDEN |
| 37 | bool bt_common_is_setuid_setgid(void); |
| 38 | |
| 39 | BT_HIDDEN |
| 40 | const char *bt_common_get_system_plugin_path(void); |
| 41 | |
| 42 | BT_HIDDEN |
| 43 | char *bt_common_get_home_plugin_path(void); |
| 44 | |
| 45 | BT_HIDDEN |
| 46 | int bt_common_append_plugin_path_dirs(const char *paths, GPtrArray *dirs); |
| 47 | |
| 48 | BT_HIDDEN |
| 49 | bool bt_common_colors_supported(void); |
| 50 | |
| 51 | BT_HIDDEN |
| 52 | const char *bt_common_color_reset(void); |
| 53 | |
| 54 | BT_HIDDEN |
| 55 | const char *bt_common_color_bold(void); |
| 56 | |
| 57 | BT_HIDDEN |
| 58 | const char *bt_common_color_fg_default(void); |
| 59 | |
| 60 | BT_HIDDEN |
| 61 | const char *bt_common_color_fg_red(void); |
| 62 | |
| 63 | BT_HIDDEN |
| 64 | const char *bt_common_color_fg_green(void); |
| 65 | |
| 66 | BT_HIDDEN |
| 67 | const char *bt_common_color_fg_yellow(void); |
| 68 | |
| 69 | BT_HIDDEN |
| 70 | const char *bt_common_color_fg_blue(void); |
| 71 | |
| 72 | BT_HIDDEN |
| 73 | const char *bt_common_color_fg_magenta(void); |
| 74 | |
| 75 | BT_HIDDEN |
| 76 | const char *bt_common_color_fg_cyan(void); |
| 77 | |
| 78 | BT_HIDDEN |
| 79 | const char *bt_common_color_fg_light_gray(void); |
| 80 | |
| 81 | BT_HIDDEN |
| 82 | const char *bt_common_color_bg_default(void); |
| 83 | |
| 84 | BT_HIDDEN |
| 85 | const char *bt_common_color_bg_red(void); |
| 86 | |
| 87 | BT_HIDDEN |
| 88 | const char *bt_common_color_bg_green(void); |
| 89 | |
| 90 | BT_HIDDEN |
| 91 | const char *bt_common_color_bg_yellow(void); |
| 92 | |
| 93 | BT_HIDDEN |
| 94 | const char *bt_common_color_bg_blue(void); |
| 95 | |
| 96 | BT_HIDDEN |
| 97 | const char *bt_common_color_bg_magenta(void); |
| 98 | |
| 99 | BT_HIDDEN |
| 100 | const char *bt_common_color_bg_cyan(void); |
| 101 | |
| 102 | BT_HIDDEN |
| 103 | const char *bt_common_color_bg_light_gray(void); |
| 104 | |
| 105 | BT_HIDDEN |
| 106 | GString *bt_common_string_until(const char *input, const char *escapable_chars, |
| 107 | const char *end_chars, size_t *end_pos); |
| 108 | |
| 109 | BT_HIDDEN |
| 110 | GString *bt_common_shell_quote(const char *input, bool with_single_quotes); |
| 111 | |
| 112 | BT_HIDDEN |
| 113 | bool bt_common_string_is_printable(const char *input); |
| 114 | |
| 115 | BT_HIDDEN |
| 116 | void bt_common_destroy_lttng_live_url_parts( |
| 117 | struct bt_common_lttng_live_url_parts *parts); |
| 118 | |
| 119 | BT_HIDDEN |
| 120 | struct bt_common_lttng_live_url_parts bt_common_parse_lttng_live_url( |
| 121 | const char *url, char *error_buf, size_t error_buf_size); |
| 122 | |
| 123 | BT_HIDDEN |
| 124 | void bt_common_normalize_star_glob_pattern(char *pattern); |
| 125 | |
| 126 | BT_HIDDEN |
| 127 | bool bt_common_star_glob_match(const char *pattern, size_t pattern_len, |
| 128 | const char *candidate, size_t candidate_len); |
| 129 | |
| 130 | BT_HIDDEN |
| 131 | GString *bt_common_normalize_path(const char *path, const char *wd); |
| 132 | |
| 133 | #endif /* BABELTRACE_COMMON_INTERNAL_H */ |