From: Arun Persaud Date: Sat, 25 Sep 2010 04:17:50 +0000 (-0700) Subject: added warning if icsLogon file couldn't be opened X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=6b443e7b875f25eaceb11f64d17660260587829e;p=xboard.git added warning if icsLogon file couldn't be opened --- diff --git a/xboard.c b/xboard.c index abf3c26..9a073d0 100644 --- a/xboard.c +++ b/xboard.c @@ -2642,23 +2642,33 @@ CmailSigHandlerCallBack(isr, closure, message, count, error) void ICSInitScript() { - FILE *f; - char buf[MSG_SIZ]; - char *p; + /* try to open the icsLogon script, either in the location given + * or in the users HOME directory + */ + + FILE *f; + char buf[MSG_SIZ]; + char *homedir; - f = fopen(appData.icsLogon, "r"); - if (f == NULL) { - p = getenv("HOME"); - if (p != NULL) { - safeStrCpy(buf, p, sizeof(buf)/sizeof(buf[0]) ); + f = fopen(appData.icsLogon, "r"); + if (f == NULL) + { + homedir = getenv("HOME"); + if (homedir != NULL) + { + safeStrCpy(buf, homedir, sizeof(buf)/sizeof(buf[0]) ); strncat(buf, "/", MSG_SIZ - strlen(buf) - 1); strncat(buf, appData.icsLogon, MSG_SIZ - strlen(buf) - 1); f = fopen(buf, "r"); } } - if (f != NULL) - ProcessICSInitScript(f); + if (f != NULL) + ProcessICSInitScript(f); + else + printf("Warning: Couldn't open icsLogon file (checked %s and %s).\n", appData.icsLogon, buf); + + return; } void