This implements getline instead of fgets, but there are still issues.