Merge Tim Golden's improvements to _scandir.c

Tim Golden has significantly overhauled _scandir.c and made it a real iterator. These changes are his work on this (on and off over the last year).