move line conversion code to file.c