FS#412 - *.cfg reading can ignore settings

Attached to Project: Rockbox
Opened by Anonymous Submitter - Sunday, 13 October 2002, 10:26 GMT
Last edited by Björn Stenberg (zagor) - Tuesday, 15 April 2003, 22:39 GMT
Task Type Bugs
Status Closed
Assigned To Linus Nielsen Feltzing (linusnielsen)
Operating System
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Reading a *.cfg file stops when settings are defined after
an empty line. This is due to a bug in the read_line
function in settings.c

I did not cure this bug because I believe that there are
at least 3 or 4 different versions of read_line in various
patches. I believe read_line should go into file.c. But
we want to have a good one and I haven't seen a good

Requriements for a genera purpose read_line:
- it has parameters for the buffer and its size
- if the line is longer than the buffer the buffer
must not be exceeded
- the string that it fills the buffer with must always
be zero terminated
- the string that it fills the buffer with must not
contain eol tokens
- it must be able to handle cr, lf and cr+lf as eol
- it must return the number of bytes read from the file
including all eol characters. (only that way we can
keep track on the current file position)
- if an error occurred it must return -1

read_line is not as easy as it looks at first. For handling
cr/lf we must peek one character ahead to determine
wether we have one or two character eol tokens. We
cannot skip all potential eol tokens as there might be
applications that expect an empty string if an empty line

Has anybody made a good read_line yet?

This task depends upon

Closed by  Björn Stenberg (zagor)
Tuesday, 15 April 2003, 22:39 GMT
Reason for closing:  Fixed
Comment by Linus Nielsen Feltzing (linusnielsen) - Tuesday, 29 October 2002, 13:20 GMT

This is fixed in CVS.