aboutsummaryrefslogtreecommitdiffstats
path: root/configfile.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 /configfile.c
parent7f4e8c33aeb65bdc5695c9fd13ec1ceb100303c7 (diff)
downloadcgit-53bc747d311d18642fa3ad0cc0de34f3899ed1f4.tar.gz
cgit-53bc747d311d18642fa3ad0cc0de34f3899ed1f4.tar.xz
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 'configfile.c')
-rw-r--r--configfile.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/configfile.c b/configfile.c
index 4908058..fe5f9c5 100644
--- a/configfile.c
+++ b/configfile.c
@@ -13,9 +13,9 @@
int next_char(FILE *f)
{
int c = fgetc(f);
- if (c=='\r') {
+ if (c == '\r') {
c = fgetc(f);
- if (c!='\n') {
+ if (c != '\n') {
ungetc(c, f);
c = '\r';
}
@@ -27,7 +27,7 @@ void skip_line(FILE *f)
{
int c;
- while((c=next_char(f)) && c!='\n' && c!=EOF)
+ while((c = next_char(f)) && c != '\n' && c != EOF)
;
}
@@ -36,31 +36,31 @@ int read_config_line(FILE *f, char *line, const char **value, int bufsize)
int i = 0, isname = 0;
*value = NULL;
- while(i<bufsize-1) {
+ while(i < bufsize - 1) {
int c = next_char(f);
- if (!isname && (c=='#' || c==';')) {
+ if (!isname && (c == '#' || c == ';')) {
skip_line(f);
continue;
}
if (!isname && isspace(c))
continue;
- if (c=='=' && !*value) {
+ if (c == '=' && !*value) {
line[i] = 0;
- *value = &line[i+1];
- } else if (c=='\n' && !isname) {
+ *value = &line[i + 1];
+ } else if (c == '\n' && !isname) {
i = 0;
continue;
- } else if (c=='\n' || c==EOF) {
+ } else if (c == '\n' || c == EOF) {
line[i] = 0;
break;
} else {
- line[i]=c;
+ line[i] = c;
}
isname = 1;
i++;
}
- line[i+1] = 0;
+ line[i + 1] = 0;
return i;
}