List file types

Rebased @mcphail 's branch myself, removed compiler warnings, and added a unit test. fixes #391 .