Thanks. Though, there's still something funny with
search, and now
read-line (and
seek).
E.g.
Code: Select all
$ ./newlisp
newLISP v.10.7.1 64-bit on Linux IPv4/6 UTF-8 libffi, options: newlisp -h
> (open "newlisp.c" "r")
3
> (search 3 "You")
611
> (read-line 3)
"You should have received a copy of the GNU General Public License"
> (search 3 "see")
90748
> (read-line 3)
" along with this program. If not, see <http://www.gnu.org/licenses/>."
> (seek 3 90748)
90748
> (read-line 3)
"*/"
>
It now is as if
read-line dup's the file descriptor?? Or is it the internal function
getIOstream that is the culprit?
Obviously I don't have any deeper insight in the implementation here. For example, I also got quite confused about the
search implementation, which successively loads and scans 4K blocks; how it deals with the case where the search string matches across a block boundary.
In any case, I've reworked my script to rather just use successive
read-line, and then sniff at each line (since my search strings in this script are all within single lines).