merge forwarding with :include:ing
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Fri, 21 Aug 1981 05:47:26 +0000 (21:47 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Fri, 21 Aug 1981 05:47:26 +0000 (21:47 -0800)
SCCS-vsn: usr.sbin/sendmail/src/alias.c 3.15
SCCS-vsn: usr.sbin/sendmail/src/recipient.c 3.2
SCCS-vsn: usr.sbin/sendmail/src/alias.c 3.15

usr/src/usr.sbin/sendmail/src/alias.c
usr/src/usr.sbin/sendmail/src/recipient.c

index 7cdca7a..4466f33 100644 (file)
@@ -4,9 +4,9 @@
 # include "sendmail.h"
 
 # ifdef DBM
 # include "sendmail.h"
 
 # ifdef DBM
-static char SccsId[] = "@(#)alias.c    3.14    %G%     (with DBM)";
+static char SccsId[] = "@(#)alias.c    3.15    %G%     (with DBM)";
 # else DBM
 # else DBM
-static char SccsId[] = "@(#)alias.c    3.14    %G%     (without DBM)";
+static char SccsId[] = "@(#)alias.c    3.15    %G%     (without DBM)";
 # endif DBM
 
 /*
 # endif DBM
 
 /*
@@ -347,22 +347,10 @@ forward(user)
        /* good address -- look for .forward file in home */
        define('z', user->q_home);
        (void) expand("$z/.forward", buf, &buf[sizeof buf - 1]);
        /* good address -- look for .forward file in home */
        define('z', user->q_home);
        (void) expand("$z/.forward", buf, &buf[sizeof buf - 1]);
-       fp = fopen(buf, "r");
-       if (fp == NULL)
+       if (access(buf, 4) < 0)
                return;
 
        /* we do have an address to forward to -- do it */
        user->q_flags |= QDONTSEND;
                return;
 
        /* we do have an address to forward to -- do it */
        user->q_flags |= QDONTSEND;
-       (void) fgets(buf, sizeof buf, fp);
-       if ((p = index(buf, '\n')) != NULL)
-               *p = '\0';
-       (void) fclose(fp);
-       if (buf[0] == '\0')
-               return;
-       if (Verbose)
-               message(Arpa_Info, "forwarded to %s", buf);
-       AliasLevel++;
-       sendto(buf, 1);
-       AliasLevel--;
-       return;
+       include(buf, "forwarding");
 }
 }
index 932a3e4..b7c1560 100644 (file)
@@ -8,7 +8,7 @@
 # include <syslog.h>
 # endif LOG
 
 # include <syslog.h>
 # endif LOG
 
-static char SccsId[] = "@(#)recipient.c        3.1     %G%";
+static char SccsId[] = "@(#)recipient.c        3.2     %G%";
 
 /*
 **  SENDTO -- Designate a send list.
 
 /*
 **  SENDTO -- Designate a send list.
@@ -157,7 +157,9 @@ recipient(a)
                if (strncmp(a->q_user, ":include:", 9) == 0)
                {
                        a->q_flags |= QDONTSEND;
                if (strncmp(a->q_user, ":include:", 9) == 0)
                {
                        a->q_flags |= QDONTSEND;
-                       include(&a->q_user[9]);
+                       if (Verbose)
+                               message(Arpa_Info, "including file %s", &a->q_user[9]);
+                       include(&a->q_user[9], " sending");
                }
                else
                        alias(a);
                }
                else
                        alias(a);
@@ -211,6 +213,7 @@ recipient(a)
 **
 **     Parameters:
 **             fname -- filename to include.
 **
 **     Parameters:
 **             fname -- filename to include.
+**             msg -- message to print in verbose mode.
 **
 **     Returns:
 **             none.
 **
 **     Returns:
 **             none.
@@ -220,14 +223,13 @@ recipient(a)
 **             listed in that file.
 */
 
 **             listed in that file.
 */
 
-include(fname)
+include(fname, msg)
        char *fname;
        char *fname;
+       char *msg;
 {
        char buf[MAXLINE];
        register FILE *fp;
 
 {
        char buf[MAXLINE];
        register FILE *fp;
 
-       if (Verbose)
-               message(Arpa_Info, "Including file %s", fname);
        fp = fopen(fname, "r");
        if (fp == NULL)
        {
        fp = fopen(fname, "r");
        if (fp == NULL)
        {
@@ -246,8 +248,10 @@ include(fname)
                        continue;
                To = fname;
                if (Verbose)
                        continue;
                To = fname;
                if (Verbose)
-                       message(Arpa_Info, " >> %s", buf);
+                       message(Arpa_Info, "%s to %s", msg, buf);
+               AliasLevel++;
                sendto(buf, 1);
                sendto(buf, 1);
+               AliasLevel--;
        }
 
        fclose(fp);
        }
 
        fclose(fp);