Unidiff1 files changed, 4 insertions, 2 deletions
|
diff --git a/html.c b/html.c index 5780dc1..bf1490f 100644 --- a/ html.c+++ b/ html.c |
|
@@ -15,26 +15,28 @@ char *fmt(const char *format, ...) |
15 | va_end(args); |
15 | va_end(args); |
16 | if (len>sizeof(buf[bufidx])) |
16 | if (len>sizeof(buf[bufidx])) |
17 | die("[html.c] string truncated: %s", format); |
17 | die("[html.c] string truncated: %s", format); |
18 | return buf[bufidx]; |
18 | return buf[bufidx]; |
19 | } |
19 | } |
20 | |
20 | |
21 | void html(const char *txt) |
21 | void html(const char *txt) |
22 | { |
22 | { |
23 | fputs(txt, stdout); |
23 | write(htmlfd, txt, strlen(txt)); |
24 | } |
24 | } |
25 | |
25 | |
26 | void htmlf(const char *format, ...) |
26 | void htmlf(const char *format, ...) |
27 | { |
27 | { |
| |
28 | static char buf[65536]; |
28 | va_list args; |
29 | va_list args; |
29 | |
30 | |
30 | va_start(args, format); |
31 | va_start(args, format); |
31 | vprintf(format, args); |
32 | vsnprintf(buf, sizeof(buf), format, args); |
32 | va_end(args); |
33 | va_end(args); |
| |
34 | html(buf); |
33 | } |
35 | } |
34 | |
36 | |
35 | void html_txt(char *txt) |
37 | void html_txt(char *txt) |
36 | { |
38 | { |
37 | char *t = txt; |
39 | char *t = txt; |
38 | while(*t){ |
40 | while(*t){ |
39 | int c = *t; |
41 | int c = *t; |
40 | if (c=='<' || c=='>' || c=='&') { |
42 | if (c=='<' || c=='>' || c=='&') { |
|