Are the peek routines standard? I'm on my phone so I can't easily check right now. Barring that, there's an ioctl call that can tell whether data is available, though I'm not sure offhand what the result would be for a file if you haven't read anything yet.
Peek doesn't help. You can't, in a non-blocking way, tell if input will be forthcoming without actually receiving the input.
-Steve
