summaryrefslogtreecommitdiffabout
path: root/html.c
Unidiff
Diffstat (limited to 'html.c') (more/less context) (show whitespace changes)
-rw-r--r--html.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/html.c b/html.c
index bf1490f..fab67bd 100644
--- a/html.c
+++ b/html.c
@@ -1,24 +1,32 @@
1/* html.c: helper functions for html output
2 *
3 * Copyright (C) 2006 Lars Hjemli
4 *
5 * Licensed under GNU General Public License v2
6 * (see COPYING for full license text)
7 */
8
1#include "cgit.h" 9#include "cgit.h"
2 10
3char *fmt(const char *format, ...) 11char *fmt(const char *format, ...)
4{ 12{
5 static char buf[8][1024]; 13 static char buf[8][1024];
6 static int bufidx; 14 static int bufidx;
7 int len; 15 int len;
8 va_list args; 16 va_list args;
9 17
10 bufidx++; 18 bufidx++;
11 bufidx &= 7; 19 bufidx &= 7;
12 20
13 va_start(args, format); 21 va_start(args, format);
14 len = vsnprintf(buf[bufidx], sizeof(buf[bufidx]), format, args); 22 len = vsnprintf(buf[bufidx], sizeof(buf[bufidx]), format, args);
15 va_end(args); 23 va_end(args);
16 if (len>sizeof(buf[bufidx])) 24 if (len>sizeof(buf[bufidx]))
17 die("[html.c] string truncated: %s", format); 25 die("[html.c] string truncated: %s", format);
18 return buf[bufidx]; 26 return buf[bufidx];
19} 27}
20 28
21void html(const char *txt) 29void html(const char *txt)
22{ 30{
23 write(htmlfd, txt, strlen(txt)); 31 write(htmlfd, txt, strlen(txt));
24} 32}