line endings function