static int copy_delete_attach (HEADER *h, BODY *b, FILE *fpin, FILE *fpout, int update)
static int copy_delete_attach (BODY *b, FILE *fpin, FILE *fpout)
static int copy_delete_attach (HEADER *h, BODY *b, FILE *fpin, FILE *fpout,			       int update){  long saved_fpout_offset = ftell (fpout);  BODY *part;  BODY *previous = NULL;  int did_deletion = 0;  dprint (1, (debugfile, "orig length: %ld  orig offset: %ld\n",	      b->length, b->offset));  for (part = b->parts ; part ; part = part->next)  {    if (part->deleted)    {      BODY *deleted = new_deleted_body ();      /* Copy message from current position to deleted attachment headers */      mutt_copy_bytes (fpin, fpout, part->hdr_offset - ftell (fpin));      if (mutt_write_mime_header (deleted, fpout) == -1)	return -1;      if (putc ('\n', fpout) == EOF)	return -1;      if (mutt_copy_hdr (fpin, fpout, ftell (fpin), part->offset,			 0, NULL) == -1)	return -1;      /* Skip the deleted body */      fseek (fpin, part->offset + part->length, SEEK_SET);      did_deletion = 1;      if (update)      {	part->deleted = 0;	if (previous)	  previous->next = deleted;	else	  b->parts = deleted;	deleted->next = part->next;	deleted->parts = part;	part->next = NULL;      }      else	mutt_free_body (&deleted);    }    else if (part->parts)    {      int rc;      /* Copy message from current position to attachment headers */      mutt_copy_bytes (fpin, fpout, part->hdr_offset - ftell (fpin));      rc = copy_delete_attach (NULL, part, fpin, fpout, update);      if (rc == -1)	return -1;      else if (rc == 1)      {	did_deletion = 1;	if (part->hdr && update)	  part->hdr->lines = 0;      }    }    previous = part;  }  /* Copy til end of message */  mutt_copy_bytes (fpin, fpout, b->length - (ftell (fpin) - b->offset));  /*   * Update the content-length and offset.  This offset will be wrong for   * mbox/mh type folders, but will be corrected in mbox_sync_mailbox()   */  if (update && did_deletion)  {    if (h)    {      h->attach_del = 0;      h->lines = 0;    }    b->offset = saved_fpout_offset;    b->length = ftell (fpout) - saved_fpout_offset;    dprint (1, (debugfile, "new length: %ld  new offset: %ld\n",		b->length, b->offset));  }  return did_deletion;}