aboutsummaryrefslogtreecommitdiffstats
path: root/plugin_file.c
diff options
context:
space:
mode:
authormichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2007-03-21 05:01:11 +0000
committermichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2007-03-21 05:01:11 +0000
commit41d245f9e30f5ffe9ca7492f853f75db259b01fc (patch)
treecc8a9048d1102ad0e8a7bcddc3aa2675d587a992 /plugin_file.c
parent3fe74144bf1b5b43256dcc33640bb2293d86202d (diff)
downloadlcd4linux-41d245f9e30f5ffe9ca7492f853f75db259b01fc.tar.gz
plugin_file patch from Mark Richards
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@782 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'plugin_file.c')
-rw-r--r--plugin_file.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/plugin_file.c b/plugin_file.c
index 3492ea5..a246870 100644
--- a/plugin_file.c
+++ b/plugin_file.c
@@ -55,7 +55,6 @@
static void my_readline(RESULT * result, RESULT * arg1, RESULT * arg2)
{
char value[80], val2[80];
- char *pos;
FILE *fp;
int reqline, i, size;
@@ -68,14 +67,12 @@ static void my_readline(RESULT * result, RESULT * arg1, RESULT * arg2)
i = 0;
while (!feof(fp) && i++ < reqline) {
fgets(val2, sizeof(val2), fp);
- size = strcspn(val2, "\n");
+ size = strcspn(val2, "\r\n");
strncpy(value, val2, size);
value[size] = '\0';
- pos = strchr(val2, '\n');
/* more than 80 chars, chew up rest of line */
- while (!pos) {
+ while (!feof(fp) && strchr(val2, '\n') == NULL) {
fgets(val2, sizeof(val2), fp);
- pos = strchr(val2, '\n');
}
}
fclose(fp);