clean up some header information; don't reopen tempfile as
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Fri, 21 Aug 1981 06:14:56 +0000 (22:14 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Fri, 21 Aug 1981 06:14:56 +0000 (22:14 -0800)
stdin (to fix some problems with saving mail on interrupts)

SCCS-vsn: usr.sbin/sendmail/src/alias.c 3.16
SCCS-vsn: usr.sbin/sendmail/src/conf.c 3.19
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 3.25
SCCS-vsn: usr.sbin/sendmail/src/collect.c 3.16
SCCS-vsn: usr.sbin/sendmail/src/err.c 3.9
SCCS-vsn: usr.sbin/sendmail/src/sendmail.h 3.28
SCCS-vsn: usr.sbin/sendmail/src/parseaddr.c 3.18
SCCS-vsn: usr.sbin/sendmail/src/savemail.c 3.13
SCCS-vsn: usr.sbin/sendmail/src/main.c 3.22
SCCS-vsn: usr.sbin/sendmail/src/readcf.c 3.10
SCCS-vsn: usr.sbin/sendmail/src/headers.c 3.3
SCCS-vsn: usr.sbin/sendmail/src/recipient.c 3.4

12 files changed:
usr/src/usr.sbin/sendmail/src/alias.c
usr/src/usr.sbin/sendmail/src/collect.c
usr/src/usr.sbin/sendmail/src/conf.c
usr/src/usr.sbin/sendmail/src/deliver.c
usr/src/usr.sbin/sendmail/src/err.c
usr/src/usr.sbin/sendmail/src/headers.c
usr/src/usr.sbin/sendmail/src/main.c
usr/src/usr.sbin/sendmail/src/parseaddr.c
usr/src/usr.sbin/sendmail/src/readcf.c
usr/src/usr.sbin/sendmail/src/recipient.c
usr/src/usr.sbin/sendmail/src/savemail.c
usr/src/usr.sbin/sendmail/src/sendmail.h

index 4466f33..50c7667 100644 (file)
@@ -1,12 +1,10 @@
-# include <stdio.h>
-# include <ctype.h>
 # include <pwd.h>
 # include "sendmail.h"
 
 # ifdef DBM
 # include <pwd.h>
 # include "sendmail.h"
 
 # ifdef DBM
-static char SccsId[] = "@(#)alias.c    3.15    %G%     (with DBM)";
+static char SccsId[] = "@(#)alias.c    3.16    %G%     (with DBM)";
 # else DBM
 # else DBM
-static char SccsId[] = "@(#)alias.c    3.15    %G%     (without DBM)";
+static char SccsId[] = "@(#)alias.c    3.16    %G%     (without DBM)";
 # endif DBM
 
 /*
 # endif DBM
 
 /*
index 4182e47..2271173 100644 (file)
@@ -1,9 +1,7 @@
-# include <stdio.h>
-# include <ctype.h>
 # include <errno.h>
 # include "sendmail.h"
 
 # include <errno.h>
 # include "sendmail.h"
 
-static char    SccsId[] = "@(#)collect.c       3.15    %G%";
+static char    SccsId[] = "@(#)collect.c       3.16    %G%";
 
 /*
 **  COLLECT -- read & parse message header & make temp file.
 
 /*
 **  COLLECT -- read & parse message header & make temp file.
@@ -36,6 +34,7 @@ static char   SccsId[] = "@(#)collect.c       3.15    %G%";
 */
 
 long   MsgSize;                /* size of message in bytes */
 */
 
 long   MsgSize;                /* size of message in bytes */
+FILE   *TempFile;              /* the tempfile (after creation) */
 
 maketemp(from)
        char *from;
 
 maketemp(from)
        char *from;
@@ -192,7 +191,7 @@ maketemp(from)
                .... so we will ignore the problem for the time being */
        }
 
                .... so we will ignore the problem for the time being */
        }
 
-       if (freopen(InFileName, "r", stdin) == NULL)
+       if ((TempFile = fopen(InFileName, "r")) == NULL)
                syserr("Cannot reopen %s", InFileName);
 
 # ifdef DEBUG
                syserr("Cannot reopen %s", InFileName);
 
 # ifdef DEBUG
index de17d12..71c1594 100644 (file)
@@ -1,4 +1,3 @@
-# include <stdio.h>
 # include <pwd.h>
 # include "sendmail.h"
 
 # include <pwd.h>
 # include "sendmail.h"
 
@@ -33,7 +32,7 @@
 
 
 
 
 
 
-static char SccsId[] = "@(#)conf.c     3.18    %G%";
+static char SccsId[] = "@(#)conf.c     3.19    %G%";
 
 
 # include <whoami.h>           /* definitions of machine id's at berkeley */
 
 
 # include <whoami.h>           /* definitions of machine id's at berkeley */
index dc1f3c5..f29a5c6 100644 (file)
@@ -1,14 +1,11 @@
-# include <stdio.h>
-# include <pwd.h>
 # include <signal.h>
 # include <signal.h>
-# include <ctype.h>
 # include <errno.h>
 # include "sendmail.h"
 # ifdef LOG
 # include <syslog.h>
 # endif LOG
 
 # include <errno.h>
 # include "sendmail.h"
 # ifdef LOG
 # include <syslog.h>
 # endif LOG
 
-static char SccsId[] = "@(#)deliver.c  3.24    %G%";
+static char SccsId[] = "@(#)deliver.c  3.25    %G%";
 
 /*
 **  DELIVER -- Deliver a message to a particular address.
 
 /*
 **  DELIVER -- Deliver a message to a particular address.
@@ -541,8 +538,8 @@ putmessage(fp, m)
                fprintf(fp, "\n");
 
        /* output the body of the message */
                fprintf(fp, "\n");
 
        /* output the body of the message */
-       rewind(stdin);
-       while (!ferror(fp) && (i = fread(buf, 1, BUFSIZ, stdin)) > 0)
+       rewind(TempFile);
+       while (!ferror(fp) && (i = fread(buf, 1, BUFSIZ, TempFile)) > 0)
                (void) fwrite(buf, 1, i, fp);
 
        if (ferror(fp) && errno != EPIPE)
                (void) fwrite(buf, 1, i, fp);
 
        if (ferror(fp) && errno != EPIPE)
index f615018..dca7011 100644 (file)
@@ -1,11 +1,9 @@
-# include <stdio.h>
-# include <ctype.h>
 # include "sendmail.h"
 # ifdef LOG
 # include <syslog.h>
 # endif LOG
 
 # include "sendmail.h"
 # ifdef LOG
 # include <syslog.h>
 # endif LOG
 
-static char    SccsId[] = "@(#)err.c   3.8     %G%";
+static char    SccsId[] = "@(#)err.c   3.9     %G%";
 
 extern bool    HasXscrpt;
 
 
 extern bool    HasXscrpt;
 
index ba8cbf8..7058739 100644 (file)
@@ -1,9 +1,7 @@
-# include <stdio.h>
-# include <ctype.h>
 # include <errno.h>
 # include "sendmail.h"
 
 # include <errno.h>
 # include "sendmail.h"
 
-static char    SccsId[] = "@(#)headers.c       3.2     %G%";
+static char    SccsId[] = "@(#)headers.c       3.3     %G%";
 
 /*
 **  CHOMPHEADER -- process and save a header line.
 
 /*
 **  CHOMPHEADER -- process and save a header line.
index 9f9fd52..5c66f31 100644 (file)
@@ -1,13 +1,11 @@
-# include <stdio.h>
 # include <signal.h>
 # include <signal.h>
-# include <ctype.h>
 # include <pwd.h>
 # include "sendmail.h"
 # ifdef LOG
 # include <syslog.h>
 # endif LOG
 
 # include <pwd.h>
 # include "sendmail.h"
 # ifdef LOG
 # include <syslog.h>
 # endif LOG
 
-static char    SccsId[] = "@(#)main.c  3.21    %G%";
+static char    SccsId[] = "@(#)main.c  3.22    %G%";
 
 /*
 **  SENDMAIL -- Post mail to a set of destinations.
 
 /*
 **  SENDMAIL -- Post mail to a set of destinations.
index 9b0fcda..cee75da 100644 (file)
@@ -1,8 +1,6 @@
-# include <stdio.h>
-# include <ctype.h>
 # include "sendmail.h"
 
 # include "sendmail.h"
 
-static char    SccsId[] = "@(#)parseaddr.c     3.17    %G%";
+static char    SccsId[] = "@(#)parseaddr.c     3.18    %G%";
 
 /*
 **  PARSE -- Parse an address
 
 /*
 **  PARSE -- Parse an address
index 6971568..6f4fae9 100644 (file)
@@ -1,8 +1,6 @@
-# include <stdio.h>
 # include "sendmail.h"
 # include "sendmail.h"
-# include <ctype.h>
 
 
-static char SccsId[] = "@(#)readcf.c   3.    %G%";
+static char SccsId[] = "@(#)readcf.c   3.10    %G%";
 
 /*
 **  READCF -- read control file.
 
 /*
 **  READCF -- read control file.
index 2c12e85..31fb799 100644 (file)
@@ -1,14 +1,7 @@
-# include <stdio.h>
 # include <pwd.h>
 # include <pwd.h>
-# include <signal.h>
-# include <ctype.h>
-# include <errno.h>
 # include "sendmail.h"
 # include "sendmail.h"
-# ifdef LOG
-# include <syslog.h>
-# endif LOG
 
 
-static char SccsId[] = "@(#)recipient.c        3.3     %G%";
+static char SccsId[] = "@(#)recipient.c        3.4     %G%";
 
 /*
 **  SENDTO -- Designate a send list.
 
 /*
 **  SENDTO -- Designate a send list.
index ef5b335..ef6e608 100644 (file)
@@ -1,8 +1,7 @@
-# include <stdio.h>
 # include <pwd.h>
 # include "sendmail.h"
 
 # include <pwd.h>
 # include "sendmail.h"
 
-static char    SccsId[] = "@(#)savemail.c      3.12    %G%";
+static char    SccsId[] = "@(#)savemail.c      3.13    %G%";
 
 /*
 **  SAVEMAIL -- Save mail on error
 
 /*
 **  SAVEMAIL -- Save mail on error
@@ -39,7 +38,7 @@ savemail()
        extern char *ttypath();
        static int exclusive;
 
        extern char *ttypath();
        static int exclusive;
 
-       if (exclusive++)
+       if (exclusive++ || TempFile == NULL)
                return;
 
        /*
                return;
 
        /*
index a7938f7..fbda5e9 100644 (file)
@@ -1,12 +1,14 @@
 /*
 **  SENDMAIL.H -- Global definitions for sendmail.
 **
 /*
 **  SENDMAIL.H -- Global definitions for sendmail.
 **
-**     @(#)sendmail.h  3.27    %G%
+**     @(#)sendmail.h  3.28    %G%
 */
 
 
 
 
 */
 
 
 
 
+# include <stdio.h>
+# include <ctype.h>
 # include "useful.h"
 
 /*
 # include "useful.h"
 
 /*
@@ -248,6 +250,7 @@ extern int  Errors;         /* set if errors */
 extern int     ExitStat;       /* exit status code */
 extern char    InFileName[];   /* input file name */
 extern char    Transcript[];   /* the transcript file name */
 extern int     ExitStat;       /* exit status code */
 extern char    InFileName[];   /* input file name */
 extern char    Transcript[];   /* the transcript file name */
+extern FILE    *TempFile;      /* mail temp file */
 extern ADDRESS From;           /* the person it is from */
 extern char    *To;            /* the target person */
 extern int     HopCount;       /* hop count */
 extern ADDRESS From;           /* the person it is from */
 extern char    *To;            /* the target person */
 extern int     HopCount;       /* hop count */