aboutsummaryrefslogtreecommitdiffstats
path: root/html.c
diff options
context:
space:
mode:
authorGravatar Lukas Fleischer <cgit@cryptocrack.de>2013-03-04 00:04:29 (JST)
committerGravatar Lukas Fleischer <cgit@cryptocrack.de>2013-03-04 09:12:48 (JST)
commit53bc747d311d18642fa3ad0cc0de34f3899ed1f4 (patch)
tree97e6fa2e4e7300f55a180917059b71e566c260fe /html.c
parent7f4e8c33aeb65bdc5695c9fd13ec1ceb100303c7 (diff)
downloadcgit-53bc747d311d18642fa3ad0cc0de34f3899ed1f4.zip
cgit-53bc747d311d18642fa3ad0cc0de34f3899ed1f4.tar.gz
Fix several whitespace errors
* Remove whitespace at the end of lines. * Replace space indentation by tabs. * Add whitespace before/after several operators ("+", "-", "*", ...) * Add whitespace to assignments ("foo = bar;"). * Fix whitespace in parameter lists ("foobar(foo, bar, 42)"). Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Diffstat (limited to 'html.c')
-rw-r--r--html.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/html.c b/html.c
index 8f6e4f6..ed6cefc 100644
--- a/html.c
+++ b/html.c
@@ -54,7 +54,7 @@ char *fmt(const char *format, ...)
54 va_start(args, format); 54 va_start(args, format);
55 len = vsnprintf(buf[bufidx], sizeof(buf[bufidx]), format, args); 55 len = vsnprintf(buf[bufidx], sizeof(buf[bufidx]), format, args);
56 va_end(args); 56 va_end(args);
57 if (len>sizeof(buf[bufidx])) { 57 if (len > sizeof(buf[bufidx])) {
58 fprintf(stderr, "[html.c] string truncated: %s\n", format); 58 fprintf(stderr, "[html.c] string truncated: %s\n", format);
59 exit(1); 59 exit(1);
60 } 60 }
@@ -94,19 +94,19 @@ void html_txt(const char *txt)
94 const char *t = txt; 94 const char *t = txt;
95 while(t && *t){ 95 while(t && *t){
96 int c = *t; 96 int c = *t;
97 if (c=='<' || c=='>' || c=='&') { 97 if (c == '<' || c == '>' || c == '&') {
98 html_raw(txt, t - txt); 98 html_raw(txt, t - txt);
99 if (c=='>') 99 if (c == '>')
100 html("&gt;"); 100 html("&gt;");
101 else if (c=='<') 101 else if (c == '<')
102 html("&lt;"); 102 html("&lt;");
103 else if (c=='&') 103 else if (c == '&')
104 html("&amp;"); 104 html("&amp;");
105 txt = t+1; 105 txt = t + 1;
106 } 106 }
107 t++; 107 t++;
108 } 108 }
109 if (t!=txt) 109 if (t != txt)
110 html(txt); 110 html(txt);
111} 111}
112 112
@@ -115,21 +115,21 @@ void html_ntxt(int len, const char *txt)
115 const char *t = txt; 115 const char *t = txt;
116 while(t && *t && len--){ 116 while(t && *t && len--){
117 int c = *t; 117 int c = *t;
118 if (c=='<' || c=='>' || c=='&') { 118 if (c == '<' || c == '>' || c == '&') {
119 html_raw(txt, t - txt); 119 html_raw(txt, t - txt);
120 if (c=='>') 120 if (c == '>')
121 html("&gt;"); 121 html("&gt;");
122 else if (c=='<') 122 else if (c == '<')
123 html("&lt;"); 123 html("&lt;");
124 else if (c=='&') 124 else if (c == '&')
125 html("&amp;"); 125 html("&amp;");
126 txt = t+1; 126 txt = t + 1;
127 } 127 }
128 t++; 128 t++;
129 } 129 }
130 if (t!=txt) 130 if (t != txt)
131 html_raw(txt, t - txt); 131 html_raw(txt, t - txt);
132 if (len<0) 132 if (len < 0)
133 html("..."); 133 html("...");
134} 134}
135 135
@@ -138,23 +138,23 @@ void html_attr(const char *txt)
138 const char *t = txt; 138 const char *t = txt;
139 while(t && *t){ 139 while(t && *t){
140 int c = *t; 140 int c = *t;
141 if (c=='<' || c=='>' || c=='\'' || c=='\"' || c=='&') { 141 if (c == '<' || c == '>' || c == '\'' || c == '\"' || c == '&') {
142 html_raw(txt, t - txt); 142 html_raw(txt, t - txt);
143 if (c=='>') 143 if (c == '>')
144 html("&gt;"); 144 html("&gt;");
145 else if (c=='<') 145 else if (c == '<')
146 html("&lt;"); 146 html("&lt;");
147 else if (c=='\'') 147 else if (c == '\'')
148 html("&#x27;"); 148 html("&#x27;");
149 else if (c=='"') 149 else if (c == '"')
150 html("&quot;"); 150 html("&quot;");
151 else if (c=='&') 151 else if (c == '&')
152 html("&amp;"); 152 html("&amp;");
153 txt = t+1; 153 txt = t + 1;
154 } 154 }
155 t++; 155 t++;
156 } 156 }
157 if (t!=txt) 157 if (t != txt)
158 html(txt); 158 html(txt);
159} 159}
160 160
@@ -164,14 +164,14 @@ void html_url_path(const char *txt)
164 while(t && *t){ 164 while(t && *t){
165 unsigned char c = *t; 165 unsigned char c = *t;
166 const char *e = url_escape_table[c]; 166 const char *e = url_escape_table[c];
167 if (e && c!='+' && c!='&') { 167 if (e && c != '+' && c != '&') {
168 html_raw(txt, t - txt); 168 html_raw(txt, t - txt);
169 html(e); 169 html(e);
170 txt = t+1; 170 txt = t + 1;
171 } 171 }
172 t++; 172 t++;
173 } 173 }
174 if (t!=txt) 174 if (t != txt)
175 html(txt); 175 html(txt);
176} 176}
177 177
@@ -186,11 +186,11 @@ void html_url_arg(const char *txt)
186 if (e) { 186 if (e) {
187 html_raw(txt, t - txt); 187 html_raw(txt, t - txt);
188 html(e); 188 html(e);
189 txt = t+1; 189 txt = t + 1;
190 } 190 }
191 t++; 191 t++;
192 } 192 }
193 if (t!=txt) 193 if (t != txt)
194 html(txt); 194 html(txt);
195} 195}
196 196
@@ -286,14 +286,14 @@ char *convert_query_hexchar(char *txt)
286 *txt = '\0'; 286 *txt = '\0';
287 return txt-1; 287 return txt-1;
288 } 288 }
289 d1 = hextoint(*(txt+1)); 289 d1 = hextoint(*(txt + 1));
290 d2 = hextoint(*(txt+2)); 290 d2 = hextoint(*(txt + 2));
291 if (d1<0 || d2<0) { 291 if (d1 < 0 || d2 < 0) {
292 memmove(txt, txt+3, n-2); 292 memmove(txt, txt + 3, n - 2);
293 return txt-1; 293 return txt-1;
294 } else { 294 } else {
295 *txt = d1 * 16 + d2; 295 *txt = d1 * 16 + d2;
296 memmove(txt+1, txt+3, n-2); 296 memmove(txt + 1, txt + 3, n - 2);
297 return txt; 297 return txt;
298 } 298 }
299} 299}
@@ -311,22 +311,22 @@ int http_parse_querystring(const char *txt_, void (*fn)(const char *name, const
311 exit(1); 311 exit(1);
312 } 312 }
313 while((c=*t) != '\0') { 313 while((c=*t) != '\0') {
314 if (c=='=') { 314 if (c == '=') {
315 *t = '\0'; 315 *t = '\0';
316 value = t+1; 316 value = t + 1;
317 } else if (c=='+') { 317 } else if (c == '+') {
318 *t = ' '; 318 *t = ' ';
319 } else if (c=='%') { 319 } else if (c == '%') {
320 t = convert_query_hexchar(t); 320 t = convert_query_hexchar(t);
321 } else if (c=='&') { 321 } else if (c == '&') {
322 *t = '\0'; 322 *t = '\0';
323 (*fn)(txt, value); 323 (*fn)(txt, value);
324 txt = t+1; 324 txt = t + 1;
325 value = NULL; 325 value = NULL;
326 } 326 }
327 t++; 327 t++;
328 } 328 }
329 if (t!=txt) 329 if (t != txt)
330 (*fn)(txt, value); 330 (*fn)(txt, value);
331 free(o); 331 free(o);
332 return 0; 332 return 0;