nextc(): always return an '\n' at end of input

fix #1564
Merge pull request #1565 from Fleurer/fix1564

nextc(): always return an '\n' at end of input