EOF detection on BSD (I hope)