diff options
author | Lukas Fleischer <cgit@cryptocrack.de> | 2013-03-04 00:04:29 (JST) |
---|---|---|
committer | Lukas Fleischer <cgit@cryptocrack.de> | 2013-03-04 09:12:48 (JST) |
commit | 53bc747d311d18642fa3ad0cc0de34f3899ed1f4 (patch) | |
tree | 97e6fa2e4e7300f55a180917059b71e566c260fe /configfile.c | |
parent | 7f4e8c33aeb65bdc5695c9fd13ec1ceb100303c7 (diff) | |
download | cgit-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 'configfile.c')
-rw-r--r-- | configfile.c | 22 |
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 @@ | |||
13 | int next_char(FILE *f) | 13 | int next_char(FILE *f) |
14 | { | 14 | { |
15 | int c = fgetc(f); | 15 | int c = fgetc(f); |
16 | if (c=='\r') { | 16 | if (c == '\r') { |
17 | c = fgetc(f); | 17 | c = fgetc(f); |
18 | if (c!='\n') { | 18 | if (c != '\n') { |
19 | ungetc(c, f); | 19 | ungetc(c, f); |
20 | c = '\r'; | 20 | c = '\r'; |
21 | } | 21 | } |
@@ -27,7 +27,7 @@ void skip_line(FILE *f) | |||
27 | { | 27 | { |
28 | int c; | 28 | int c; |
29 | 29 | ||
30 | while((c=next_char(f)) && c!='\n' && c!=EOF) | 30 | while((c = next_char(f)) && c != '\n' && c != EOF) |
31 | ; | 31 | ; |
32 | } | 32 | } |
33 | 33 | ||
@@ -36,31 +36,31 @@ int read_config_line(FILE *f, char *line, const char **value, int bufsize) | |||
36 | int i = 0, isname = 0; | 36 | int i = 0, isname = 0; |
37 | 37 | ||
38 | *value = NULL; | 38 | *value = NULL; |
39 | while(i<bufsize-1) { | 39 | while(i < bufsize - 1) { |
40 | int c = next_char(f); | 40 | int c = next_char(f); |
41 | if (!isname && (c=='#' || c==';')) { | 41 | if (!isname && (c == '#' || c == ';')) { |
42 | skip_line(f); | 42 | skip_line(f); |
43 | continue; | 43 | continue; |
44 | } | 44 | } |
45 | if (!isname && isspace(c)) | 45 | if (!isname && isspace(c)) |
46 | continue; | 46 | continue; |
47 | 47 | ||
48 | if (c=='=' && !*value) { | 48 | if (c == '=' && !*value) { |
49 | line[i] = 0; | 49 | line[i] = 0; |
50 | *value = &line[i+1]; | 50 | *value = &line[i + 1]; |
51 | } else if (c=='\n' && !isname) { | 51 | } else if (c == '\n' && !isname) { |
52 | i = 0; | 52 | i = 0; |
53 | continue; | 53 | continue; |
54 | } else if (c=='\n' || c==EOF) { | 54 | } else if (c == '\n' || c == EOF) { |
55 | line[i] = 0; | 55 | line[i] = 0; |
56 | break; | 56 | break; |
57 | } else { | 57 | } else { |
58 | line[i]=c; | 58 | line[i] = c; |
59 | } | 59 | } |
60 | isname = 1; | 60 | isname = 1; |
61 | i++; | 61 | i++; |
62 | } | 62 | } |
63 | line[i+1] = 0; | 63 | line[i + 1] = 0; |
64 | return i; | 64 | return i; |
65 | } | 65 | } |
66 | 66 | ||