#define _GNU_SOURCE
#include <iso646.h> // and
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

// max number of characters in a line including '\n' and '\0'
const size_t maxline = 16;

int main() {
 FILE *fp = stdin; // read from stdin
 char line[maxline];
 char *str = NULL, *s = NULL;
 for (int i = 1; fgets(line, maxline, fp) != NULL; ++i) {
   const size_t n = strlen(line) + 1; // +1 for '\0'
   if (n == maxline and (maxline < 2 or line[maxline-2] != '\n')) {
     fprintf(stderr, "error: line #%d is too long: %s", i, line);
     exit(EXIT_FAILURE);
   }
   // if line starts with "name" and '=' is in the string
   const char* name = "name";
   if (strncmp(name, line, strlen(name)) == 0 and
       (s = strchr(line, '=')) != NULL) {
     str = strdup(s+1); // copy everything after the first '='
      if (str == NULL) {
        perror("strdup");
        exit(EXIT_FAILURE);
      }
      printf("line #%d: name: %s", i, str);
      break;
   }
 }
 // do other stuff with `str` here
 // ...
 free(str);
}