aboutsummaryrefslogtreecommitdiffstats
path: root/plugin_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugin_file.c')
-rw-r--r--plugin_file.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/plugin_file.c b/plugin_file.c
index ed9faa8..7103027 100644
--- a/plugin_file.c
+++ b/plugin_file.c
@@ -1,4 +1,4 @@
-/* $Id: plugin_file.c 728 2007-01-14 11:14:38Z michael $
+/* $Id: plugin_file.c 783 2007-03-22 06:10:36Z michael $
* $URL: https://ssl.bulix.org/svn/lcd4linux/branches/0.10.1/plugin_file.c $
*
* plugin to perform simple file operations
@@ -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);