Read gzipped files

This pull request allows gzipped files to be read without any changes to the interface. I also cleaned up the Makefile and removed some unsafe calls to sprintf