| 204 |
{ |
{ |
| 205 |
if (!quote_mode && !lml_tag_disabled && new_line) |
if (!quote_mode && !lml_tag_disabled && new_line) |
| 206 |
{ |
{ |
| 207 |
if (fb_quote_level > 0) |
fb_quote_level = 0; |
|
{ |
|
|
lml_tag_quote_level -= fb_quote_level; |
|
|
|
|
|
tag_output_len = snprintf(tag_output_buf, LML_TAG_OUTPUT_BUF_LEN, "%s", |
|
|
(lml_tag_quote_level > 0 ? lml_tag_quote_color[lml_tag_quote_level % LML_TAG_QUOTE_LEVEL_LOOP] : "\033[m")); |
|
|
if (j + tag_output_len >= buf_len) |
|
|
{ |
|
|
log_error("Buffer is not longer enough for output string %d >= %d\n", j + tag_output_len, buf_len); |
|
|
str_out[j] = '\0'; |
|
|
return j; |
|
|
} |
|
|
memcpy(str_out + j, tag_output_buf, (size_t)tag_output_len); |
|
|
j += tag_output_len; |
|
|
|
|
|
fb_quote_level = 0; |
|
|
} |
|
| 208 |
|
|
| 209 |
while (str_in[i + fb_quote_level * 2] == ':' && str_in[i + fb_quote_level * 2 + 1] == ' ') // FB2000 quote leading str |
while (str_in[i + fb_quote_level * 2] == ':' && str_in[i + fb_quote_level * 2 + 1] == ' ') // FB2000 quote leading str |
| 210 |
{ |
{ |
| 211 |
fb_quote_level++; |
fb_quote_level++; |
| 212 |
} |
} |
| 213 |
|
|
| 214 |
if (fb_quote_level > 0) |
lml_tag_quote_level += fb_quote_level; |
|
{ |
|
|
lml_tag_quote_level += fb_quote_level; |
|
| 215 |
|
|
| 216 |
|
if (lml_tag_quote_level > 0) |
| 217 |
|
{ |
| 218 |
tag_output_len = snprintf(tag_output_buf, LML_TAG_OUTPUT_BUF_LEN, "%s", |
tag_output_len = snprintf(tag_output_buf, LML_TAG_OUTPUT_BUF_LEN, "%s", |
| 219 |
lml_tag_quote_color[lml_tag_quote_level % LML_TAG_QUOTE_LEVEL_LOOP]); |
lml_tag_quote_color[lml_tag_quote_level % LML_TAG_QUOTE_LEVEL_LOOP]); |
| 220 |
if (j + tag_output_len >= buf_len) |
if (j + tag_output_len >= buf_len) |
| 271 |
j += tag_output_len; |
j += tag_output_len; |
| 272 |
} |
} |
| 273 |
|
|
| 274 |
|
if (fb_quote_level > 0) |
| 275 |
|
{ |
| 276 |
|
lml_tag_quote_level -= fb_quote_level; |
| 277 |
|
|
| 278 |
|
tag_output_len = snprintf(tag_output_buf, LML_TAG_OUTPUT_BUF_LEN, "\033[m"); |
| 279 |
|
if (j + tag_output_len >= buf_len) |
| 280 |
|
{ |
| 281 |
|
log_error("Buffer is not longer enough for output string %d >= %d\n", j + tag_output_len, buf_len); |
| 282 |
|
str_out[j] = '\0'; |
| 283 |
|
return j; |
| 284 |
|
} |
| 285 |
|
memcpy(str_out + j, tag_output_buf, (size_t)tag_output_len); |
| 286 |
|
j += tag_output_len; |
| 287 |
|
} |
| 288 |
|
|
| 289 |
tag_start_pos = -1; |
tag_start_pos = -1; |
| 290 |
tag_name_pos = -1; |
tag_name_pos = -1; |
| 291 |
new_line = 1; |
new_line = 1; |
| 297 |
|
|
| 298 |
if (!lml_tag_disabled && str_in[i] == '[') |
if (!lml_tag_disabled && str_in[i] == '[') |
| 299 |
{ |
{ |
| 300 |
|
if (tag_start_pos != -1) // tag is not closed |
| 301 |
|
{ |
| 302 |
|
tag_end_pos = i - 1; |
| 303 |
|
tag_output_len = tag_end_pos - tag_start_pos + 1; |
| 304 |
|
if (j + tag_output_len >= buf_len) |
| 305 |
|
{ |
| 306 |
|
log_error("Buffer is not longer enough for output string %ld >= %d\n", j + tag_output_len, buf_len); |
| 307 |
|
str_out[j] = '\0'; |
| 308 |
|
return j; |
| 309 |
|
} |
| 310 |
|
|
| 311 |
|
memcpy(str_out + j, str_in + tag_start_pos, (size_t)tag_output_len); |
| 312 |
|
j += tag_output_len; |
| 313 |
|
} |
| 314 |
|
|
| 315 |
tag_start_pos = i; |
tag_start_pos = i; |
| 316 |
tag_name_pos = i + 1; |
tag_name_pos = i + 1; |
| 317 |
} |
} |