| 1425 | } |
| 1426 | |
| 1427 | static void wrap_in_html(struct strbuf *msg) |
| 1428 | { |
| 1429 | struct strbuf buf = STRBUF_INIT; |
| 1430 | static const char *content_type = "Content-Type: text/html;\n"; |
| 1431 | static const char *pre_open = "<pre>\n"; |
| 1432 | static const char *pre_close = "</pre>\n"; |
| 1433 | const char *body = strstr(msg->buf, "\n\n"); |
| 1434 | |
| 1435 | if (!body) |
| 1436 | return; /* Headers but no body; no wrapping needed */ |
| 1437 | |
| 1438 | body += 2; |
| 1439 | |
| 1440 | strbuf_add(&buf, msg->buf, body - msg->buf - 1); |
| 1441 | strbuf_addstr(&buf, content_type); |
| 1442 | strbuf_addch(&buf, '\n'); |
| 1443 | strbuf_addstr(&buf, pre_open); |
| 1444 | strbuf_addstr_xml_quoted(&buf, body); |
| 1445 | strbuf_addstr(&buf, pre_close); |
| 1446 | |
| 1447 | strbuf_release(msg); |
| 1448 | *msg = buf; |
| 1449 | } |
| 1450 | |
| 1451 | static int count_messages(struct strbuf *all_msgs) |
| 1452 | { |
no test coverage detected