add getline replacement
getline() is POSIX only, so we need a portable replacement.