arrange to give the correct "from" person on error messages.
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Sat, 3 Oct 1981 03:05:25 +0000 (19:05 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Sat, 3 Oct 1981 03:05:25 +0000 (19:05 -0800)
SCCS-vsn: usr.sbin/sendmail/src/savemail.c 3.19
SCCS-vsn: usr.sbin/sendmail/src/version.c 3.45
SCCS-vsn: usr.sbin/sendmail/src/macro.c 3.5

usr/src/usr.sbin/sendmail/src/macro.c
usr/src/usr.sbin/sendmail/src/savemail.c
usr/src/usr.sbin/sendmail/src/version.c

index 350da0d..5f82465 100644 (file)
@@ -1,7 +1,7 @@
 # include "useful.h"
 # include "conf.h"
 
 # include "useful.h"
 # include "conf.h"
 
-static char SccsId[] = "@(#)macro.c    3.4.1.1 %G%";
+static char SccsId[] = "@(#)macro.c    3.5     %G%";
 
 char   *Macro[128];
 extern int     Debug;
 
 char   *Macro[128];
 extern int     Debug;
@@ -157,3 +157,22 @@ define(n, v)
 # endif DEBUG
        Macro[n & 0177] = v;
 }
 # endif DEBUG
        Macro[n & 0177] = v;
 }
+\f/*
+**  MACVALUE -- return uninterpreted value of a macro.
+**
+**     Parameters:
+**             n -- the name of the macro.
+**
+**     Returns:
+**             The value of n.
+**
+**     Side Effects:
+**             none.
+*/
+
+char *
+macvalue(n)
+       char n;
+{
+       return (Macro[n & 0177]);
+}
index 98fc380..52675c4 100644 (file)
@@ -1,7 +1,7 @@
 # include <pwd.h>
 # include "sendmail.h"
 
 # include <pwd.h>
 # include "sendmail.h"
 
-static char    SccsId[] = "@(#)savemail.c      3.18    %G%";
+static char    SccsId[] = "@(#)savemail.c      3.19    %G%";
 
 /*
 **  SAVEMAIL -- Save mail on error
 
 /*
 **  SAVEMAIL -- Save mail on error
@@ -209,12 +209,30 @@ errhdr(fp, m)
 {
        char buf[MAXLINE];
        register FILE *xfile;
 {
        char buf[MAXLINE];
        register FILE *xfile;
+       extern char *macvalue();
+       char *oldfmac;
+       char *oldgmac;
+
+       oldfmac = macvalue('f');
+       define('f', "$n");
+       oldgmac = macvalue('g');
+       define('g', m->m_from);
 
        (void) fflush(stdout);
        if ((xfile = fopen(Transcript, "r")) == NULL)
                syserr("Cannot open %s", Transcript);
        errno = 0;
 
 
        (void) fflush(stdout);
        if ((xfile = fopen(Transcript, "r")) == NULL)
                syserr("Cannot open %s", Transcript);
        errno = 0;
 
+       /*
+       **  Output "From" line unless supressed
+       */
+
+       if (!bitset(M_NHDR, m->m_flags))
+       {
+               (void) expand("$l", buf, &buf[sizeof buf - 1]);
+               fprintf(fp, "%s\n", buf);
+       }
+
        /*
        **  Output header of error message.
        */
        /*
        **  Output header of error message.
        */
@@ -232,6 +250,13 @@ errhdr(fp, m)
        fprintf(fp, "To: %s\n", To);
        fprintf(fp, "Subject: Unable to deliver mail\n");
 
        fprintf(fp, "To: %s\n", To);
        fprintf(fp, "Subject: Unable to deliver mail\n");
 
+       /*
+       **  End of error message header
+       */
+
+       define('f', oldfmac);
+       define('g', oldgmac);
+
        /*
        **  Output transcript of errors
        */
        /*
        **  Output transcript of errors
        */
index 7806996..fd70e2a 100644 (file)
@@ -1,3 +1,3 @@
-static char    SccsId[] = "@(#)SendMail version 3.44 of %G%";
+static char    SccsId[] = "@(#)SendMail version 3.45 of %G%";
 
 
-char   Version[] = "3.44 [%G%]";
+char   Version[] = "3.45 [%G%]";