Ron Yorston wrote: >Better, though, might be to put the test in open_file_and_read_lines, >where all input files are opened. This would prevent read_lines from >trying to read non-regular files.
Actually, my concern that read_lines might react badly to being fed /dev/zero was misplaced. read_lines doesn't deal in lines as we know them, it handles terminal-width-sized partial lines, and it inserts a fake EOF after it's read MAXLINES of these things. So even if its input has no newlines and no EOF read_lines will eventually terminate. I still think it would be better to detect non-regular files earlier and I'll put together a patch for that. >The real 'less' does this: > > [rmy@vulcan ~]$ less /dev/zero > /dev/zero is not a regular file (use -f to see it) > [rmy@vulcan ~]$ Interestingly if you try -f it doesn't work as well as BusyBox less. 'less -f /dev/zero' is OK but 'less -f -S /dev/zero' loops forever (or until it fills memory, I killed it after 2GB). Ron _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
