tail print the last part of input.
How do you print the first part, say first 10 lines?
This is one of the best ways to locate related commands.
Bill 'shortsig' Hassell, HP Remote Engineering Services
-----BEGIN PGP SIGNED MESSAGE-----
Gawain> I have successfully implemented tail -f functionality by
Gawain> detecting file size changes using stat(). If the file size
Gawain> has changed I do whatever I want to do, if it has not changed
Gawain> I just sleep(1).
Gawain> This actually works quite well and is not CPU intensive at all
Gawain> - in fact it seems LESS CPU intensive then whatever "tail -f"
Gawain> is doing!!
Martin> That is all fine and dandy, but you can only read from regular
Martin> files (or maybe pipes as well?) that way. Try to read from a
Martin> character device, and you loose[sic]. (I think that this can make
Martin> quite a lot of sense at times.)
Well the solution is a "hairy" tail (hmm ;-) which checks whether it
is an ordinary file or a device at the start, and has a read-loop of
-----BEGIN PGP SIGNATURE-----
Comment: Processed by Mailcrypt 3.4, an Emacs/PGP interface
-----END PGP SIGNATURE-----
APM Ltd., Poseidon House, Castle Park, Cambridge CB3 0RD