rem: if (fileptr[i + 1] == ENDLIST)
add: if (i + 1 == nfiles)
context: paste_parallel (int nfiles, char **fnamptr){  int errors = 0;		/* 1 if open or read errors occur. */  /* Number of files for which space is allocated in `delbuf' and `fileptr'.     Enlarged as necessary. */  int file_list_size = 12;  int chr IF_LINT (= 0);	/* Input character. */  int line_length;		/* Number of chars in line. */  int somedone;			/* 0 if all files empty for this line. */  /* If all files are just ready to be closed, or will be on this     round, the string of delimiters must be preserved.     delbuf[0] through delbuf[file_list_size]     store the delimiters for closed files. */  char *delbuf;  size_t delims_saved;		/* Number of delims saved in `delbuf'. */  register char *delimptr;	/* Cycling pointer into `delims'. */  FILE **fileptr;		/* Streams open to the files to process. */  int files_open;		/* Number of files still open to process. */  int i;			/* Loop index. */  int opened_stdin = 0;		/* Nonzero if any fopen got fd 0. */  delbuf = (char *) xmalloc (file_list_size + 2);  fileptr = (FILE **) xmalloc ((file_list_size + 1) * sizeof (FILE *));  /* Attempt to open all files.  This could be expanded to an infinite     number of files, but at the (considerable) expense of remembering     each file and its current offset, then opening/reading/closing.  */  for (files_open = 0; files_open < nfiles; ++files_open)    {      if (files_open == file_list_size - 2)	{	  file_list_size += 12;	  delbuf = (char *) xrealloc (delbuf, file_list_size + 2);	  fileptr = (FILE **) xrealloc ((char *) fileptr, (file_list_size + 1)					* sizeof (FILE *));	}      if (STREQ (fnamptr[files_open], "-"))	{	  have_read_stdin = 1;	  fileptr[files_open] = stdin;	}      else	{	  fileptr[files_open] = fopen (fnamptr[files_open], "r");	  if (fileptr[files_open] == NULL)	    error (EXIT_FAILURE, errno, "%s", fnamptr[files_open]);	  else if (fileno (fileptr[files_open]) == 0)	    opened_stdin = 1;	}    }  fileptr[files_open] = ENDLIST;  if (opened_stdin && have_read_stdin)    error (EXIT_FAILURE, 0, _("standard input is closed"));  /* Read a line from each file and output it to stdout separated by a     delimiter, until we go through the loop without successfully     reading from any of the files. */  while (files_open)    {      /* Set up for the next line. */      somedone = 0;      delimptr = delims;      delims_saved = 0;      for (i = 0; fileptr[i] != ENDLIST && files_open; i++)	{	  line_length = 0;	/* Clear so we can easily detect EOF. */	  if (fileptr[i] != CLOSED)	    {	      chr = getc (fileptr[i]);	      if (chr != EOF && delims_saved)		{		  fwrite (delbuf, sizeof (char), delims_saved, stdout);		  delims_saved = 0;		}	      while (chr != EOF)		{		  line_length++;		  if (chr == '\n')		    break;		  putc (chr, stdout);		  chr = getc (fileptr[i]);		}	    }	  if (line_length == 0)	    {	      /* EOF, read error, or closed file.		 If an EOF or error, close the file and mark it in the list. */	      if (fileptr[i] != CLOSED)		{		  if (ferror (fileptr[i]))		    {		      error (0, errno, "%s", fnamptr[i]);		      errors = 1;		    }		  if (fileptr[i] == stdin)		    clearerr (fileptr[i]); /* Also clear EOF. */		  else if (fclose (fileptr[i]) == EOF)		    {		      error (0, errno, "%s", fnamptr[i]);		      errors = 1;		    }		  fileptr[i] = CLOSED;		  files_open--;		}	      if (fileptr[i + 1] == ENDLIST)		{		  /* End of this output line.		     Is this the end of the whole thing? */		  if (somedone)		    {		      /* No.  Some files were not closed for this line. */		      if (delims_saved)			{			  fwrite (delbuf, sizeof (char), delims_saved, stdout);			  delims_saved = 0;			}		      putc ('\n', stdout);		    }		  continue;	/* Next read of files, or exit. */		}	      else		{		  /* Closed file; add delimiter to `delbuf'. */		  if (*delimptr != EMPTY_DELIM)		    delbuf[delims_saved++] = *delimptr;		  if (++delimptr == delim_end)		    delimptr = delims;		}	    }	  else	    {	      /* Some data read. */	      somedone++;	      /* Except for last file, replace last newline with delim. */	      if (fileptr[i + 1] != ENDLIST)		{		  if (chr != '\n')		    putc (chr, stdout);		  if (*delimptr != EMPTY_DELIM)		    putc (*delimptr, stdout);		  if (++delimptr == delim_end)		    delimptr = delims;		}	      else		putc (chr, stdout);	    }	}    }  return errors;}