main.c, rewrite readinit
This commit is contained in:
parent
3c8a18a93b
commit
c161ee2e62
28
src/main.c
28
src/main.c
|
|
@ -1076,27 +1076,19 @@ main(int argc, char **argv)
|
||||||
signal(SIGSYS, (SIGNAL_FUNCTION) sig_sys);
|
signal(SIGSYS, (SIGNAL_FUNCTION) sig_sys);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* load user's initialisation file */
|
|
||||||
if (readinit) {
|
if (readinit) {
|
||||||
bool good;
|
/* load user's initialisation file
|
||||||
|
try accessing the initialisation file in the current directory
|
||||||
/* Try accessing the initialisation file in the current directory */
|
if that fails try the alternate name */
|
||||||
good = read_initialisation_file("",INITSTR);
|
if(FALSE == read_initialisation_file("", INITSTR) &&
|
||||||
|
FALSE == read_initialisation_file("", ALT_INITSTR)) {
|
||||||
/* if that fail try the alternate name */
|
|
||||||
if(good == FALSE)
|
|
||||||
good = read_initialisation_file("",ALT_INITSTR);
|
|
||||||
|
|
||||||
/* if that failed try in the user's home directory
|
/* if that failed try in the user's home directory
|
||||||
if their HOME environment variable is set */
|
if their HOME environment variable is set */
|
||||||
if(good == FALSE) {
|
char *homedir = getenv("HOME");
|
||||||
char * homedir;
|
if(homedir != NULL)
|
||||||
homedir = getenv("HOME");
|
if(FALSE == read_initialisation_file(homedir, INITSTR) &&
|
||||||
if(homedir !=NULL) {
|
FALSE == read_initialisation_file(homedir, ALT_INITSTR)) {
|
||||||
good = read_initialisation_file(homedir,INITSTR);
|
;
|
||||||
if(good == FALSE) {
|
|
||||||
good = read_initialisation_file(homedir,ALT_INITSTR);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue