Commit 3c4583a6 authored by Geoff Simmons's avatar Geoff Simmons

style fascism:

* consistent brace style (K&R for if, while, for, do etc.)
* I'm prejudiced against cuddled elses %^)
parent 59734e30
......@@ -99,16 +99,13 @@ saveConfig(const char * fname)
char * content;
fp = fopen( fname, "w" );
if ( fp == NULL )
{
if ( fp == NULL ) {
perror(fname);
return 4;
}
content = getConfigContent();
for (int i = 0; *(content + i) != 0; i++)
{
if (EOF == putc(*(content + i), fp))
{
for (int i = 0; *(content + i) != 0; i++) {
if (EOF == putc(*(content + i), fp)) {
fclose( fp);
return 8;
}
......
......@@ -59,25 +59,21 @@ TEST_compareFiles(const char * fname1, const char * fname2)
verbose("comparing files %s : %s", fname1, fname2);
fp1 = fopen( fname1, "r" );
if ( fp1 == NULL )
{
if ( fp1 == NULL ) {
perror(fname1);
return -2;
}
fp2 = fopen( fname2, "r" ) ;
if (fp2 == NULL)
{
if (fp2 == NULL) {
perror(fname2);
return -3;
}
do
{
do {
col++;
ch1 = getc( fp1 );
ch2 = getc( fp2 );
if ( ch1 == '\n' && ch2 == '\n')
{
if ( ch1 == '\n' && ch2 == '\n') {
line++;
col = 0;
}
......@@ -88,7 +84,8 @@ TEST_compareFiles(const char * fname1, const char * fname2)
printf(" comparing files %s : %s, ", fname1, fname2);
printf("files differ at line: %i col: %i \n", line, col);
return line;
} else {
}
else {
return 0;
}
}
......@@ -104,19 +101,16 @@ TEST_compareFileWithString(const char * fname, const char * text)
verbose("comparing file %s with text", fname);
fp1 = fopen( fname, "r" );
if ( fp1 == NULL )
{
if ( fp1 == NULL ) {
perror(fname);
return -2;
}
do
{
do {
col++;
ch1 = getc( fp1 );
ch2 = *(text + i++);
if ( ch1 == '\n' && ch2 == '\n')
{
if ( ch1 == '\n' && ch2 == '\n') {
line++;
col = 0;
}
......@@ -126,7 +120,8 @@ TEST_compareFileWithString(const char * fname, const char * text)
printf(" comparing file %s with text, ", fname);
printf("file differs at line: %i col: %i \n", line, col);
return line;
} else {
}
else {
return 0;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment