/[mailutils]/mailutils/mailbox/sendmail.c
ViewVC logotype

Diff of /mailutils/mailbox/sendmail.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.22 by gray, Sat Feb 22 22:33:53 2003 UTC revision 1.23 by gray, Fri Aug 22 13:58:31 2003 UTC
# Line 348  sendmail_send_message (mailer_t mailer, Line 348  sendmail_send_message (mailer_t mailer,
348          int rc;          int rc;
349          size_t offset = 0;          size_t offset = 0;
350          header_t hdr;          header_t hdr;
351            body_t body;
352            int found_nl = 0;
353                    
354          message_get_stream (msg, &stream);          message_get_header (msg, &hdr);
355            header_get_stream (hdr, &stream);
356    
357          if (message_get_header (msg, &hdr)          MAILER_DEBUG0 (mailer, MU_DEBUG_TRACE, "Sending headers...\n");
358              && header_get_value (hdr, MU_HEADER_FCC, NULL, 0, NULL) == 0)          while ((status = stream_readline (stream, buffer, sizeof (buffer),
359                                              offset, &len)) == 0
360                   && len != 0)
361            {            {
362              while ((status = stream_readline (stream, buffer, sizeof (buffer),              if (strncasecmp (buffer, MU_HEADER_FCC,
363                                                offset, &len)) == 0                               sizeof (MU_HEADER_FCC) - 1))
                    && len != 0)  
364                {                {
                 if (strncasecmp (buffer, MU_HEADER_FCC,  
                                  sizeof (MU_HEADER_FCC) - 1) == 0)  
                   continue;  
   
365                  if (write (sendmail->fd, buffer, len) == -1)                  if (write (sendmail->fd, buffer, len) == -1)
366                    {                    {
367                      status = errno;                      status = errno;
368                        
369                      MAILER_DEBUG1 (mailer, MU_DEBUG_TRACE,                      MAILER_DEBUG1 (mailer, MU_DEBUG_TRACE,
370                                     "write() failed: %s\n", strerror (status));                                     "write() failed: %s\n", strerror (status));
371                                            
372                      break;                      break;
373                    }                    }
374                  offset += len;                }
375                  sendmail->offset += len;              found_nl = (len == 1 && buffer[0] == '\n');
376                  
377                offset += len;
378                sendmail->offset += len;
379              }
380    
381            if (!found_nl)
382              {
383                if (write (sendmail->fd, "\n", 1) == -1)
384                  {
385                    status = errno;
386                    
387                    MAILER_DEBUG1 (mailer, MU_DEBUG_TRACE,
388                                   "write() failed: %s\n", strerror (status));
389                }                }
390            }            }
391                    
392            message_get_body (msg, &body);
393            body_get_stream (body, &stream);
394    
395            MAILER_DEBUG0 (mailer, MU_DEBUG_TRACE, "Sending body...\n");
396            offset = 0;
397          while ((status = stream_read (stream, buffer, sizeof (buffer),          while ((status = stream_read (stream, buffer, sizeof (buffer),
398                                        offset, &len)) == 0                                        offset, &len)) == 0
399                 && len != 0)                 && len != 0)
# Line 386  sendmail_send_message (mailer_t mailer, Line 404  sendmail_send_message (mailer_t mailer,
404    
405                  MAILER_DEBUG1 (mailer, MU_DEBUG_TRACE,                  MAILER_DEBUG1 (mailer, MU_DEBUG_TRACE,
406                                 "write() failed: %s\n", strerror (status));                                 "write() failed: %s\n", strerror (status));
407                    
408                  break;                  break;
409                }                }
410              offset += len;              offset += len;

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26