From 6aff8d5418d7c6c5eb9e093bded53fb0d0712a15 Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 3 Jan 2015 20:56:42 +0100 Subject: [PATCH] src/main.c, rewrite to be autoindent friendly --- src/main.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main.c b/src/main.c index 0c44cf3cd..01b3ae00d 100644 --- a/src/main.c +++ b/src/main.c @@ -724,9 +724,6 @@ append_to_stream(FILE *dest, FILE *source) static bool read_initialisation_file(char *dir, char *name) { -#ifndef HAVE_UNISTD_H - FILE *fp = NULL; -#endif /* not HAVE_UNISTD_H */ char *path; bool result = FALSE; @@ -744,16 +741,23 @@ read_initialisation_file(char *dir, char *name) /* now access the file */ #ifdef HAVE_UNISTD_H - if (access(path, R_OK) == 0) { + if (access(path, R_OK) == 0) + result = TRUE; #else - if ((fp = fopen(path, "r")) != NULL) { - (void) fclose(fp); + { + FILE *fp = fopen(path, "r"); + if (fp) { + fclose(fp); + result = TRUE; + } + } #endif /* HAVE_UNISTD_H */ + + if (result) { inp_source(path); #ifdef TRACE printf("Init file: '%s'\n", path); #endif /* TRACE */ - result = TRUE; /* loaded okay */ } if (path != name)