projects
/
xboard.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
07212f7
)
added warning if icsLogon file couldn't be opened
author
Arun Persaud
<arun@nubati.net>
Sat, 25 Sep 2010 04:17:50 +0000
(21:17 -0700)
committer
Arun Persaud
<arun@nubati.net>
Fri, 8 Oct 2010 01:46:53 +0000
(18:46 -0700)
xboard.c
patch
|
blob
|
history
diff --git
a/xboard.c
b/xboard.c
index
abf3c26
..
9a073d0
100644
(file)
--- a/
xboard.c
+++ b/
xboard.c
@@
-2642,23
+2642,33
@@
CmailSigHandlerCallBack(isr, closure, message, count, error)
void
ICSInitScript()
{
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");
}
}
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
}
void