Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pcre2grep: avoid portability minefield with buffered fseek(stdin)
To allow pcre2grep to do an early exit in a resumable way, -m uses fseek on stdin, which is sadly not supported in several platforms. Most of the conflicting issues come from the fact that managing the position while buffering is not trivial, and is therefore an optional feature[1] of POSIX.1-2017 Workaround this by removing the buffer to stdin, if the -m option is being used. There is likely not a significant performance benefit even for the platforms that support it, but it could be conditionally added in that case, later. Fixes: #10 [1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/fseek.html
- Loading branch information