• Status Closed
  • Percent Complete
  • Task Type Bugs
  • Category
  • Assigned To
  • Operating System
  • Severity Low
  • Priority Very Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by Anonymous Submitter - 2002-10-13
Last edited by zagor - 2003-04-15

FS#412 - *.cfg reading can ignore settings

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:

  1. it has parameters for the buffer and its size
  2. if the line is longer than the buffer the buffer

must not be exceeded

  1. the string that it fills the buffer with must always

be zero terminated

  1. the string that it fills the buffer with must not

contain eol tokens

  1. it must be able to handle cr, lf and cr+lf as eol


  1. 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?


Closed by  zagor
2003-04-15 22:39
Reason for closing:  Fixed
Project Manager

This is fixed in CVS.


Available keyboard shortcuts


Task Details

Task Editing