/[mailutils]/mailutils/mail.local/main.c
ViewVC logotype

Diff of /mailutils/mail.local/main.c

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

revision 1.18 by gray, Tue Aug 13 13:24:57 2002 UTC revision 1.19 by gray, Sun Nov 3 12:50:32 2002 UTC
# Line 292  make_tmp (const char *from, char **tempf Line 292  make_tmp (const char *from, char **tempf
292      }      }
293    
294    line = 0;    line = 0;
295    while (getline (&buf, &n, stdin) > 0) {    while (getline (&buf, &n, stdin) > 0)
296      line++;      {
297      if (line == 1)        line++;
298        {        if (line == 1)
299          if (memcmp (buf, "From ", 5))          {
300            {            if (memcmp (buf, "From ", 5))
301              struct mu_auth_data *auth;              {
302              if (!from)                struct mu_auth_data *auth;
303                {                if (!from)
304                  auth = mu_get_auth_by_uid (uid);                  {
305                  if (auth)                    auth = mu_get_auth_by_uid (uid);
306                    from = auth->name;                    if (auth)
307                }                      from = auth->name;
308              if (from)                  }
309                {                if (from)
310                  time (&t);                  {
311                  fprintf (fp, "From %s %s", from, ctime (&t));                    time (&t);
312                }                    fprintf (fp, "From %s %s", from, ctime (&t));
313              else                  }
314                {                else
315                  mailer_err ("Can't determine sender address");                  {
316                  exit (EX_UNAVAILABLE);                    mailer_err ("Can't determine sender address");
317                }                    exit (EX_UNAVAILABLE);
318              if (auth)                  }
319                mu_auth_data_free (auth);                if (auth)
320            }                  mu_auth_data_free (auth);
321        }              }
322      else if (!memcmp (buf, "From ", 5))          }
323        fputc ('>', fp);        else if (!memcmp (buf, "From ", 5))
324      if (fputs (buf, fp) == EOF)          fputc ('>', fp);
325        {        if (fputs (buf, fp) == EOF)
326          mailer_err ("temporary file write error");          {
327          fclose (fp);            mailer_err ("temporary file write error");
328          return NULL;            fclose (fp);
329        }            return NULL;
330    }          }
331        }
332      
333    if (buf && strchr (buf, '\n') == NULL)    if (buf && strchr (buf, '\n') == NULL)
334      putc ('\n', fp);      putc ('\n', fp);
335      
336    putc ('\n', fp);    putc ('\n', fp);
337    free (buf);    free (buf);
338        
# Line 465  deliver (FILE *fp, char *name) Line 466  deliver (FILE *fp, char *name)
466        n = 0;        n = 0;
467        status = 0;        status = 0;
468        fseek (fp, 0, SEEK_SET);        fseek (fp, 0, SEEK_SET);
469        while (getline(&buf, &n, fp) > 0) {        while (getline(&buf, &n, fp) > 0)
470          status = stream_write (stream, buf, strlen (buf), off, &nwr);          {
471          if (status)            status = stream_write (stream, buf, strlen (buf), off, &nwr);
472            {            if (status)
473              mailer_err ("error writing to mailbox: %s", mu_errstring (status));              {
474              break;                mailer_err ("error writing to mailbox: %s",
475            }                            mu_errstring (status));
476          off += nwr;                break;
477        }              }
478              off += nwr;
479            }
480        free (buf);        free (buf);
481        switch_user_id (0);        switch_user_id (0);
482      }      }

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

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