Add "-t" option to read To:, Cc:, and Bcc: lines to get recipients
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Tue, 25 Aug 1981 05:06:17 +0000 (21:06 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Tue, 25 Aug 1981 05:06:17 +0000 (21:06 -0800)
SCCS-vsn: usr.sbin/sendmail/src/conf.c 3.23
SCCS-vsn: usr.sbin/sendmail/src/sendmail.h 3.32
SCCS-vsn: usr.sbin/sendmail/src/version.c 3.13
SCCS-vsn: usr.sbin/sendmail/src/main.c 3.27
SCCS-vsn: usr.sbin/sendmail/src/headers.c 3.5

usr/src/usr.sbin/sendmail/src/conf.c
usr/src/usr.sbin/sendmail/src/headers.c
usr/src/usr.sbin/sendmail/src/main.c
usr/src/usr.sbin/sendmail/src/sendmail.h
usr/src/usr.sbin/sendmail/src/version.c

index d9327fa..b42263f 100644 (file)
@@ -32,7 +32,7 @@
 
 
 
 
 
 
-static char SccsId[] = "@(#)conf.c     3.22    %G%";
+static char SccsId[] = "@(#)conf.c     3.23    %G%";
 
 
 # include <whoami.h>           /* definitions of machine id's at berkeley */
 
 
 # include <whoami.h>           /* definitions of machine id's at berkeley */
@@ -55,9 +55,9 @@ struct hdrinfo        HdrInfo[] =
        "original-from",        H_DELETE,               0,              /* internal */
        "sender",               0,                      0,
        "full-name",            H_ACHECK,               M_FULLNAME,
        "original-from",        H_DELETE,               0,              /* internal */
        "sender",               0,                      0,
        "full-name",            H_ACHECK,               M_FULLNAME,
-       "to",                   0,                      0,
-       "cc",                   0,                      0,
-       "bcc",                  0,                      0,
+       "to",                   H_ADDR|H_FORCE,         0,
+       "cc",                   H_ADDR|H_FORCE,         0,
+       "bcc",                  H_ADDR|H_DELETE|H_FORCE,0,
        "message-id",           H_CHECK,                M_MSGID,
        "message",              H_EOH,                  0,
        "text",                 H_EOH,                  0,
        "message-id",           H_CHECK,                M_MSGID,
        "message",              H_EOH,                  0,
        "text",                 H_EOH,                  0,
index 066cc52..469dd54 100644 (file)
@@ -1,7 +1,7 @@
 # include <errno.h>
 # include "sendmail.h"
 
 # include <errno.h>
 # include "sendmail.h"
 
-static char    SccsId[] = "@(#)headers.c       3.4     %G%";
+static char    SccsId[] = "@(#)headers.c       3.5     %G%";
 
 /*
 **  CHOMPHEADER -- process and save a header line.
 
 /*
 **  CHOMPHEADER -- process and save a header line.
@@ -90,6 +90,8 @@ chompheader(line, def)
        if (h->h_value != NULL)
                free(h->h_value);
        h->h_value = newstr(fvalue);
        if (h->h_value != NULL)
                free(h->h_value);
        h->h_value = newstr(fvalue);
+       if (!def && GrabTo && bitset(H_ADDR, h->h_flags))
+               sendto(h->h_value, 0);
 
        return (h->h_flags);
 }
 
        return (h->h_flags);
 }
index 073e237..f95ad19 100644 (file)
@@ -5,7 +5,7 @@
 # include <syslog.h>
 # endif LOG
 
 # include <syslog.h>
 # endif LOG
 
-static char    SccsId[] = "@(#)main.c  3.26    %G%";
+static char    SccsId[] = "@(#)main.c  3.27    %G%";
 
 /*
 **  SENDMAIL -- Post mail to a set of destinations.
 
 /*
 **  SENDMAIL -- Post mail to a set of destinations.
@@ -72,6 +72,8 @@ static char   SccsId[] = "@(#)main.c  3.26    %G%";
 **                             front of messages.
 **             -v              Give blow-by-blow description of
 **                             everything that happens.
 **                             front of messages.
 **             -v              Give blow-by-blow description of
 **                             everything that happens.
+**             -t              Read "to" addresses from message.
+**                             Looks at To:, Cc:, and Bcc: lines.
 **             -Cfilename      Use alternate configuration file.
 **             -Afilename      Use alternate alias file.
 **             -DXvalue        Define macro X to have value.
 **             -Cfilename      Use alternate configuration file.
 **             -Afilename      Use alternate alias file.
 **             -DXvalue        Define macro X to have value.
@@ -121,6 +123,7 @@ bool        SaveFrom;       /* save From lines on the front of messages */
 bool   IgnrDot;        /* if set, ignore dot when collecting mail */
 bool   SuprErrs;       /* supress errors if set */
 bool   Verbose;        /* set if blow-by-blow desired */
 bool   IgnrDot;        /* if set, ignore dot when collecting mail */
 bool   SuprErrs;       /* supress errors if set */
 bool   Verbose;        /* set if blow-by-blow desired */
+bool   GrabTo;         /* if set, read recipient addresses from msg */
 int    Debug;          /* debug level */
 int    Errors;         /* count of errors */
 int    AliasLevel;     /* current depth of aliasing */
 int    Debug;          /* debug level */
 int    Errors;         /* count of errors */
 int    AliasLevel;     /* current depth of aliasing */
@@ -388,6 +391,10 @@ main(argc, argv)
                        Verbose++;
                        break;
 
                        Verbose++;
                        break;
 
+                 case 't':     /* read recipients from message */
+                       GrabTo = TRUE;
+                       break;
+
                  default:
                        /* at Eric Schmidt's suggestion, this will not be an error....
                        syserr("Unknown flag %s", p);
                  default:
                        /* at Eric Schmidt's suggestion, this will not be an error....
                        syserr("Unknown flag %s", p);
@@ -497,7 +504,7 @@ main(argc, argv)
 
        setfrom(from, realname);
 
 
        setfrom(from, realname);
 
-       if (argc <= 0)
+       if (argc <= 0 && !GrabTo)
                usrerr("Usage: /etc/sendmail [flags] addr...");
 
        /*
                usrerr("Usage: /etc/sendmail [flags] addr...");
 
        /*
@@ -545,7 +552,8 @@ main(argc, argv)
        /* if we have had errors sofar, drop out now */
        if (Errors > 0 && ExitStat == EX_OK)
                ExitStat = EX_USAGE;
        /* if we have had errors sofar, drop out now */
        if (Errors > 0 && ExitStat == EX_OK)
                ExitStat = EX_USAGE;
-       if ((ArpaMode > ARPA_OLD && ExitStat != EX_OK) || verifyonly)
+       if ((ArpaMode > ARPA_OLD && ExitStat != EX_OK) ||
+           (verifyonly && !GrabTo))
                finis();
 
        /* no errors, tell arpanet to go ahead */
                finis();
 
        /* no errors, tell arpanet to go ahead */
@@ -569,6 +577,9 @@ main(argc, argv)
                printf("From person = \"%s\"\n", From.q_paddr);
 # endif DEBUG
 
                printf("From person = \"%s\"\n", From.q_paddr);
 # endif DEBUG
 
+       if (verifyonly && GrabTo)
+               finis();
+
        /*
        **  Arrange that the person who is sending the mail
        **  will not be expanded (unless explicitly requested).
        /*
        **  Arrange that the person who is sending the mail
        **  will not be expanded (unless explicitly requested).
index b8d55c5..8bcbf1f 100644 (file)
@@ -1,7 +1,7 @@
 /*
 **  SENDMAIL.H -- Global definitions for sendmail.
 **
 /*
 **  SENDMAIL.H -- Global definitions for sendmail.
 **
-**     @(#)sendmail.h  3.31    %G%
+**     @(#)sendmail.h  3.32    %G%
 */
 
 
 */
 
 
@@ -164,6 +164,7 @@ extern struct hdrinfo       HdrInfo[];
 # define H_CHECK       00020   /* check h_mflags against m_flags */
 # define H_ACHECK      00040   /* ditto, but always (not just default) */
 # define H_FORCE       00100   /* force this field, even if default */
 # define H_CHECK       00020   /* check h_mflags against m_flags */
 # define H_ACHECK      00040   /* ditto, but always (not just default) */
 # define H_FORCE       00100   /* force this field, even if default */
+# define H_ADDR                00200   /* this field contains addresses */
 
 
 /*
 
 
 /*
@@ -245,6 +246,7 @@ extern bool MeToo;          /* send to the sender also */
 extern bool    IgnrDot;        /* don't let dot end messages */
 extern bool    SaveFrom;       /* save leading "From" lines */
 extern bool    Verbose;        /* set if blow-by-blow desired */
 extern bool    IgnrDot;        /* don't let dot end messages */
 extern bool    SaveFrom;       /* save leading "From" lines */
 extern bool    Verbose;        /* set if blow-by-blow desired */
+extern bool    GrabTo;         /* if set, get recipients from msg */
 extern int     Debug;          /* debugging level */
 extern int     Errors;         /* set if errors */
 extern int     ExitStat;       /* exit status code */
 extern int     Debug;          /* debugging level */
 extern int     Errors;         /* set if errors */
 extern int     ExitStat;       /* exit status code */
index b050729..de45699 100644 (file)
@@ -1,3 +1,3 @@
-static char    SccsId[] = "@(#)SendMail version 3.12 of %G%";
+static char    SccsId[] = "@(#)SendMail version 3.13 of %G%";
 
 
-char   Version[] = "3.12 [%G%]";
+char   Version[] = "3.13 [%G%]";