/* get_line() makes sure to only return complete whole lines that fit in 'len' bytes and end with a newline.  */
char* Curl_get_line(char *buf, int len, FILE *input)
/* get_line() makes sure to only return complete whole lines that fit in 'len' bytes and end with a newline.  */
char* Curl_get_line(char *buf, int len, FILE *input)
{
  bool partial = FALSE;
  while(1) {
    char *b = fgets(buf, len, input);
    if(b) {
      size_t rlen = strlen(b);
      if(rlen && (b[rlen-1] == '\n')) {
        if(partial) {
          partial = FALSE;
          continue;
        }
        return b;
      }
      partial = TRUE;
    }
    else
      break;
  }
  return NULL;
}