Detect line endings (Fixes #3)

See Issue #3 for discussion.