Yet another implementation of getline/getdelim.