diff options
Diffstat (limited to 'apps/settings.c')
-rw-r--r-- | apps/settings.c | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/apps/settings.c b/apps/settings.c index 63ba04a356..81e4d12f69 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include "file.h" | 44 | #include "file.h" |
45 | #include "errno.h" | 45 | #include "errno.h" |
46 | #include "system.h" | 46 | #include "system.h" |
47 | #include "misc.h" | ||
47 | #ifdef HAVE_LCD_BITMAP | 48 | #ifdef HAVE_LCD_BITMAP |
48 | #include "icons.h" | 49 | #include "icons.h" |
49 | #include "font.h" | 50 | #include "font.h" |
@@ -707,42 +708,6 @@ void settings_load(void) | |||
707 | settings_apply(); | 708 | settings_apply(); |
708 | } | 709 | } |
709 | 710 | ||
710 | /* Read (up to) a line of text from fd into buffer and return number of bytes | ||
711 | * read (which may be larger than the number of bytes stored in buffer). If | ||
712 | * an error occurs, -1 is returned (and buffer contains whatever could be | ||
713 | * read). A line is terminated by a LF char. Neither LF nor CR chars are | ||
714 | * stored in buffer. | ||
715 | */ | ||
716 | static int read_line(int fd, char* buffer, int buffer_size) | ||
717 | { | ||
718 | int count = 0; | ||
719 | int num_read = 0; | ||
720 | |||
721 | errno = 0; | ||
722 | |||
723 | while (count < buffer_size) | ||
724 | { | ||
725 | unsigned char c; | ||
726 | |||
727 | if (1 != read(fd, &c, 1)) | ||
728 | break; | ||
729 | |||
730 | num_read++; | ||
731 | |||
732 | if ( c == '\n' ) | ||
733 | break; | ||
734 | |||
735 | if ( c == '\r' ) | ||
736 | continue; | ||
737 | |||
738 | buffer[count++] = c; | ||
739 | } | ||
740 | |||
741 | buffer[MIN(count, buffer_size - 1)] = 0; | ||
742 | |||
743 | return errno ? -1 : num_read; | ||
744 | } | ||
745 | |||
746 | /* parse a line from a configuration file. the line format is: | 711 | /* parse a line from a configuration file. the line format is: |
747 | 712 | ||
748 | setting name: setting value | 713 | setting name: setting value |