inbuf = realloc (inbuf, maxlen); if (inbuf == NULL) error (0, errno, _("unable to allocate buffer for input"));
process_fd (iconv_t cd, int fd, FILE *output){  /* we have a problem with reading from a desriptor since we must not     provide the iconv() function an incomplete character or shift     sequence at the end of the buffer.  Since we have to deal with     arbitrary encodings we must read the whole text in a buffer and     process it in one step.  */  static char *inbuf = NULL;  static size_t maxlen = 0;  char *inptr = NULL;  size_t actlen = 0;  while (actlen < maxlen)    {      ssize_t n = read (fd, inptr, maxlen - actlen);      if (n == 0)	/* No more text to read.  */	break;      if (n == -1)	{	  /* Error while reading.  */	  error (0, errno, _("error while reading the input"));	  return -1;	}      inptr += n;      actlen += n;    }  if (actlen == maxlen)    while (1)      {	ssize_t n;	/* Increase the buffer.  */	maxlen += 32768;	inbuf = realloc (inbuf, maxlen);	if (inbuf == NULL)	  error (0, errno, _("unable to allocate buffer for input"));	inptr = inbuf + actlen;	do	  {	    n = read (fd, inptr, maxlen - actlen);	    if (n == 0)	      /* No more text to read.  */	      break;	    if (n == -1)	      {		/* Error while reading.  */		error (0, errno, _("error while reading the input"));		return -1;	      }	    inptr += n;	    actlen += n;	  }	while (actlen < maxlen);	if (n == 0)	  /* Break again so we leave both loops.  */	  break;      }  /* Now we have all the input in the buffer.  Process it in one run.  */  return process_block (cd, inbuf, actlen, output);}