Ported to Windows by Steve Kemp (skx@tardis.ed.ac.uk)
