:>     fgets() with the proper length limitation, using a statically allocated
:>     buffer is not a big deal.  Most configuration files couldn't have long
:>     lines and still be legal anyway.
:
:Note that the classical loop
:    while (fgets(buf, n, fp) != NULL) {
:         tokenize(buf, args...);
:         ...
:   }
:may have problems if the line is too long, so one needs to detect it by
:looking for the '\n'. if none is found, then one can either abort on error
:or ignore the line. In the latter case, you need to read the remaining chars
:so that the next fgets won't get them.
:
:regards,
:mouss

    Yes, but we are talking about simple stupid config files here.  Programs
    which actually tokenize an input stream typically do not use fgets().
    Tokenizers either use [f]lex, [f]getc(), read() (and handle the buffering
    themselves), or mmap().

                                                -Matt




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to