Mercurial > pidgin
changeset 8989:a88d4463d233
[gaim-migrate @ 9764]
Patch from datallah for crlf losers who want to use tcl
committer: Tailor Script <tailor@pidgin.im>
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Thu, 20 May 2004 20:09:44 +0000 |
parents | d6fea11c62d7 |
children | c209e287bb6e |
files | plugins/tcl/tcl.c |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/tcl/tcl.c Thu May 20 18:14:18 2004 +0000 +++ b/plugins/tcl/tcl.c Thu May 20 20:09:44 2004 +0000 @@ -169,13 +169,22 @@ len = st.st_size; buf = g_malloc(len + 1); - if ((fread(buf, len, 1, fp)) != 1) { + + cur = buf; + while (fgets(cur, (int) buf - (buf - cur), fp)) { + cur += strlen(cur); + if (feof(fp)) + break; + } + + if (ferror(fp)) { + gaim_debug(GAIM_DEBUG_ERROR, "tcl", "error reading %s (%s)\n", plugin->path, strerror(errno)); g_free(buf); fclose(fp); return FALSE; } + fclose(fp); - buf[len] = '\0'; if ((interp = tcl_create_interp()) == NULL) { return FALSE;