| skipped 109 lines |
110 | 110 | | buffer[0] = '\0'; |
111 | 111 | | if (hours > 0) { |
112 | 112 | | snprintf(duration_str, sizeof(duration_str), "\033[33m%ih\033[0m", hours); |
113 | | - | bs -= (int)strlen(duration_str); |
114 | | - | if(bs <= 0) { |
| 113 | + | bs -= (int) strlen(duration_str); |
| 114 | + | if (bs <= 0) { |
115 | 115 | | return; |
116 | 116 | | } |
117 | 117 | | strcat(buffer, duration_str); |
| skipped 3 lines |
121 | 121 | | strcat(buffer, " "); |
122 | 122 | | } |
123 | 123 | | snprintf(duration_str, sizeof(duration_str), "\033[32m%im\033[0m", min); |
124 | | - | bs -= (int)strlen(duration_str); |
125 | | - | if(bs <= 0) { |
| 124 | + | bs -= (int) strlen(duration_str); |
| 125 | + | if (bs <= 0) { |
126 | 126 | | return; |
127 | 127 | | } |
128 | 128 | | strcat(buffer, duration_str); |
| skipped 3 lines |
132 | 132 | | strcat(buffer, " "); |
133 | 133 | | } |
134 | 134 | | snprintf(duration_str, sizeof(duration_str), "\033[34m%is\033[0m", sec); |
135 | | - | bs -= (int)strlen(duration_str); |
136 | | - | if(bs <= 0) { |
| 135 | + | bs -= (int) strlen(duration_str); |
| 136 | + | if (bs <= 0) { |
137 | 137 | | return; |
138 | 138 | | } |
139 | 139 | | strcat(buffer, duration_str); |
| 140 | + | } |
| 141 | + | if (buffer[0] == '\0') { |
| 142 | + | if (bs <= 1) { |
| 143 | + | return; |
| 144 | + | } |
| 145 | + | |
| 146 | + | snprintf(buffer, bs, "\033[2m—\033[0m"); |
140 | 147 | | } |
141 | 148 | | } |
142 | 149 | | |
| skipped 28 lines |
171 | 178 | | |
172 | 179 | | static void create_tags(char *buffer, int bs, const char *tags) { |
173 | 180 | | //char colors[][10] = {"\033[31m", "\033[32m", "\033[33m", "\033[34m", "\033[35m", "\033[36m", "\033[37m"}; |
174 | | - | char colors[][10] = { "\033[1;34m", "\033[1;33m", "\033[1;32m", "\033[1;31m"}; |
| 181 | + | char colors[][10] = {"\033[1;34m", "\033[1;33m", "\033[1;32m", "\033[1;31m"}; |
175 | 182 | | |
176 | 183 | | char *color; |
177 | 184 | | int color_idx = 0; |
| skipped 89 lines |
267 | 274 | | strncat(line_buffer, buffer, bs); |
268 | 275 | | |
269 | 276 | | snprintf(buffer, bs, "\033[36m%s\033[0m", entry->message); |
270 | | - | pad_right(buffer, bs, paddings[PAD_LINE]); |
271 | 277 | | strncat(line_buffer, buffer, bs); |
272 | 278 | | line_buffer[lbs - 1] = '\0'; |
273 | 279 | | printf("%s\n", line_buffer); |
| skipped 162 lines |