Commit 28df1afd authored by Geoff Simmons's avatar Geoff Simmons

test_config: printing strings to files simplified

parent fa2ee3e9
...@@ -61,7 +61,7 @@ char verbose_buffer[9000]; ...@@ -61,7 +61,7 @@ char verbose_buffer[9000];
/***** functions **************************************************************/ /***** functions **************************************************************/
static char * static const char *
getConfigContent(void) getConfigContent(void)
{ {
int i = 0; int i = 0;
...@@ -96,20 +96,13 @@ static int ...@@ -96,20 +96,13 @@ static int
saveConfig(const char * fname) saveConfig(const char * fname)
{ {
FILE *fp; FILE *fp;
char * content;
fp = fopen( fname, "w" ); fp = fopen( fname, "w" );
if ( fp == NULL ) { if ( fp == NULL ) {
perror(fname); perror(fname);
return 4; return 4;
} }
content = getConfigContent(); fprintf(fp, getConfigContent());
for (int i = 0; *(content + i) != 0; i++) {
if (EOF == putc(*(content + i), fp)) {
fclose( fp);
return 8;
}
}
fclose ( fp ); fclose ( fp );
return 0; 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