aboutsummaryrefslogtreecommitdiffstats
path: root/html.c
diff options
context:
space:
mode:
authorLukas Fleischer <cgit@cryptocrack.de>2013-03-03 16:04:29 +0100
committerLukas Fleischer <cgit@cryptocrack.de>2013-03-04 01:12:48 +0100
commit53bc747d311d18642fa3ad0cc0de34f3899ed1f4 (patch)
tree97e6fa2e4e7300f55a180917059b71e566c260fe /html.c
parent7f4e8c33aeb65bdc5695c9fd13ec1ceb100303c7 (diff)
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, ...)
va_start(args, format);
len = vsnprintf(buf[bufidx], sizeof(buf[bufidx]), format, args);
va_end(args);
- if (len>sizeof(buf[bufidx])) {
+ if (len > sizeof(buf[bufidx])) {
fprintf(stderr, "[html.c] string truncated: %s\n", format);
exit(1);
}
@@ -94,19 +94,19 @@ void html_txt(const char *txt)
const char *t = txt;
while(t && *t){
int c = *t;
- if (c=='<' || c=='>' || c=='&') {
+ if (c == '<' || c == '>' || c == '&') {
html_raw(txt, t - txt);
- if (c=='>')
+ if (c == '>')
html("&gt;");
- else if (c=='<')
+ else if (c == '<')
html("&lt;");
- else if (c=='&')
+ else if (c == '&')
html("&amp;");
- txt = t+1;
+ txt = t + 1;
}
t++;
}
- if (t!=txt)
+ if (t != txt)
html(txt);
}
@@ -115,21 +115,21 @@ void html_ntxt(int len, const char *txt)
const char *t = txt;
while(t && *t && len--){
int c = *t;
- if (c=='<' || c=='>' || c=='&') {
+ if (c == '<' || c == '>' || c == '&') {
html_raw(txt, t - txt);
- if (c=='>')
+ if (c == '>')
html("&gt;");
- else if (c=='<')
+ else if (c == '<')
html("&lt;");
- else if (c=='&')
+ else if (c == '&')
html("&amp;");
- txt = t+1;
+ txt = t + 1;
}
t++;
}
- if (t!=txt)
+ if (t != txt)
html_raw(txt, t - txt);
- if (len<0)
+ if (len < 0)
html("...");
}
@@ -138,23 +138,23 @@ void html_attr(const char *txt)
const char *t = txt;
while(t && *t){
int c = *t;
- if (c=='<' || c=='>' || c=='\'' || c=='\"' || c=='&') {
+ if (c == '<' || c == '>' || c == '\'' || c == '\"' || c == '&') {
html_raw(txt, t - txt);
- if (c=='>')
+ if (c == '>')
html("&gt;");
- else if (c=='<')
+ else if (c == '<')
html("&lt;");
- else if (c=='\'')
+ else if (c == '\'')
html("&#x27;");
- else if (c=='"')
+ else if (c == '"')
html("&quot;");
- else if (c=='&')
+ else if (c == '&')
html("&amp;");
- txt = t+1;
+ txt = t + 1;
}
t++;
}
- if (t!=txt)
+ if (t != txt)
html(txt);
}
@@ -164,14 +164,14 @@ void html_url_path(const char *txt)
while(t && *t){
unsigned char c = *t;
const char *e = url_escape_table[c];
- if (e && c!='+' && c!='&') {
+ if (e && c != '+' && c != '&') {
html_raw(txt, t - txt);
html(e);
- txt = t+1;
+ txt = t + 1;
}
t++;
}
- if (t!=txt)
+ if (t != txt)
html(txt);
}
@@ -186,11 +186,11 @@ void html_url_arg(const char *txt)
if (e) {
html_raw(txt, t - txt);
html(e);
- txt = t+1;
+ txt = t + 1;
}
t++;
}
- if (t!=txt)
+ if (t != txt)
html(txt);
}
@@ -286,14 +286,14 @@ char *convert_query_hexchar(char *txt)
*txt = '\0';
return txt-1;
}
- d1 = hextoint(*(txt+1));
- d2 = hextoint(*(txt+2));
- if (d1<0 || d2<0) {
- memmove(txt, txt+3, n-2);
+ d1 = hextoint(*(txt + 1));
+ d2 = hextoint(*(txt + 2));
+ if (d1 < 0 || d2 < 0) {
+ memmove(txt, txt + 3, n - 2);
return txt-1;
} else {
*txt = d1 * 16 + d2;
- memmove(txt+1, txt+3, n-2);
+ memmove(txt + 1, txt + 3, n - 2);
return txt;
}
}
@@ -311,22 +311,22 @@ int http_parse_querystring(const char *txt_, void (*fn)(const char *name, const
exit(1);
}
while((c=*t) != '\0') {
- if (c=='=') {
+ if (c == '=') {
*t = '\0';
- value = t+1;
- } else if (c=='+') {
+ value = t + 1;
+ } else if (c == '+') {
*t = ' ';
- } else if (c=='%') {
+ } else if (c == '%') {
t = convert_query_hexchar(t);
- } else if (c=='&') {
+ } else if (c == '&') {
*t = '\0';
(*fn)(txt, value);
- txt = t+1;
+ txt = t + 1;
value = NULL;
}
t++;
}
- if (t!=txt)
+ if (t != txt)
(*fn)(txt, value);
free(o);
return 0;