News for hackers. Stuff that matters.
Re:Regex character "$" doesn't mean "end-of-string" by nomel on Wednesday March 20, 2024 @12:44PM (#39769052)
Posix getline() includes EOF as a line terminator:

    getline() reads an entire line from stream, storing the address
       of the buffer containing the text into *lineptr.  The buffer is
       null-terminated and includes the newline character, if one was
       found.
    ...
    ... a delimiter character is not added if one was
       not present in the input before end of file was reached.
EOF seems same as end-of-string.
Re:Regex character "$" doesn't mean "end-of-string" by lsaferite on Friday March 22, 2024 @11:55AM (#39791923)
Your quoted documentation says otherwise. It says that a 'line' include the delimiter, '\n', in the line buffer. It also says that is no delimiter is found before the EOF is reached that the line buffer will not include the delimiter. That means the line buffer can clearly indicate an incomplete line by the absence of the delimiter. To be clear, EOF isn't a 'line terminator', it's the end of the data stream.
Re:Regex character "$" doesn't mean "end-of-string" by nomel on Friday March 22, 2024 @06:24PM (#39795489)
Yes, "EOF seems same as end-of-string."
Re:Regex character "$" doesn't mean "end-of-string" by pepa65 on Friday March 29, 2024 @02:58AM (#39861359)
No, getline() will stop reading at the newline, even if more (non-NUL) characters follow. EOF is end-of-file.