author | Lars Hjemli <hjemli@gmail.com> | 2006-12-10 21:41:14 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2006-12-10 21:41:14 (UTC) |
commit | 7640d90b73c01b16bb04ce4c541f52cbaae5f82a (patch) (unidiff) | |
tree | a0ec3e5222dbb0cff965487def39f5781e5cb231 /html.c | |
parent | 25105d7ecaba474d4b7c364ebb586aac3dfc5abb (diff) | |
download | cgit-7640d90b73c01b16bb04ce4c541f52cbaae5f82a.zip cgit-7640d90b73c01b16bb04ce4c541f52cbaae5f82a.tar.gz cgit-7640d90b73c01b16bb04ce4c541f52cbaae5f82a.tar.bz2 |
Add license file and copyright notices
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | html.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -1,32 +1,40 @@ | |||
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 | ||
3 | char *fmt(const char *format, ...) | 11 | char *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 | ||
21 | void html(const char *txt) | 29 | void html(const char *txt) |
22 | { | 30 | { |
23 | write(htmlfd, txt, strlen(txt)); | 31 | write(htmlfd, txt, strlen(txt)); |
24 | } | 32 | } |
25 | 33 | ||
26 | void htmlf(const char *format, ...) | 34 | void htmlf(const char *format, ...) |
27 | { | 35 | { |
28 | static char buf[65536]; | 36 | static char buf[65536]; |
29 | va_list args; | 37 | va_list args; |
30 | 38 | ||
31 | va_start(args, format); | 39 | va_start(args, format); |
32 | vsnprintf(buf, sizeof(buf), format, args); | 40 | vsnprintf(buf, sizeof(buf), format, args); |