]> Pileus Git - ~andy/fetchmail/commitdiff
Added the wildcard option.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 27 Nov 1996 17:34:00 +0000 (17:34 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 27 Nov 1996 17:34:00 +0000 (17:34 -0000)
svn path=/trunk/; revision=575

NEWS
driver.c
fetchmail.c
fetchmail.h
fetchmail.man
rcfile_l.l
rcfile_y.y

diff --git a/NEWS b/NEWS
index 9d1a2d316b6bb97d75a2af1de4a8f95d2208d867..f8009874bb9a5614bb2d2f074dbb3952eb1b444d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,9 +7,10 @@ pl 2.0.1 ():
   of run, so DNS does less work.  During a run, cache host matches on the
   aka list so no potential alias has to be DNS-checked more than once.
 * Try to use envelope From.  If that fails, fall back on calling-user.
-* Added FAQ file
 * Added `logfile' keyword to rc syntax.
 * We now use X-Envelope-To headers.
+* Added `*' as a wildcard option for multidrop to ... here
+* Added FAQ file
 
 fetchmail-2.0 (Mon Nov 18 00:32:17 EST 1996):
 
index 0dcdf8fc34c92a39befca2d44a5aed455013aeec..bb810a2f60055980caece500531068d8096a1188 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -226,6 +226,9 @@ struct idlist **xmit_names; /* list of recipient names parsed out */
                }
 
                lname = idpair_find(&ctl->localnames, cp);
+               if (!lname && ctl->wildcard)
+                   lname = cp;
+
                if (lname != (char *)NULL)
                {
                    if (outlevel == O_VERBOSE)
index 0a464906a8851d159b560f6ae336289fbccdc061..a8fe30c2eea8541f9106f9f9f5315b56361bed2a 100644 (file)
@@ -771,11 +771,15 @@ void dump_params (struct query *ctl)
               count,
               (count == 1 && !strcmp(ctl->localnames->id, user)) ? " (by default)" : "");
        if (outlevel == O_VERBOSE)
+       {
            for (idp = ctl->localnames; idp; idp = idp->next)
                if (idp->val.id2)
                    fprintf(stderr, "\t%s -> %s\n", idp->id, idp->val.id2);
                else
                    fprintf(stderr, "\t%s\n", idp->id);
+           if (ctl->wildcard)
+               fputs("*\n", stderr);
+       }
     }
 
     if (ctl->protocol > P_POP2)
index 451b3234affcc091367fd41b372d3124d01a1438..194b472cdfd99bee2cb48c9cdf07e08388364c55 100644 (file)
@@ -63,6 +63,7 @@ struct query
     /* per-host data */
     char servername [HOSTLEN+1];
     struct idlist *localnames;
+    int wildcard;      /* true if unmatched names should be passed through */
     int protocol;
     int port;
     int authenticate;
@@ -105,7 +106,8 @@ struct query
 #endif /* HAVE_GETHOSTBYNAME */
 };
 
-#define MULTIDROP(ctl) ((ctl)->localnames && (ctl)->localnames->next)
+#define MULTIDROP(ctl) (ctl->wildcard || \
+                               ((ctl)->localnames && (ctl)->localnames->next))
 
 struct method
 {
index ba259fcae67175150d048d87755883cab6809db2..42f070fa1462e4705f7170e2064da1f8635abee9 100644 (file)
@@ -464,7 +464,8 @@ save it from having to do DNS lookups.
 .PP
 The `is' or `to' keywords associate the following local (client)
 name(s) (or server-name to client-name mappings separated by =) with
-the mailserver user name in the entry.
+the mailserver user name in the entry.  If an is/to list has `*' as
+its last name, unrecognized names are simply passed through.
 .PP
 A single local name can be used to support redirecting your mail when
 your username on the client machine is different from your name on the
index 0f6d43d4d3fb56b500fa0e6b4f84803e01d28eeb..74921b3d404454685d00b3a37c6f6c9b482bc660 100644 (file)
@@ -43,6 +43,7 @@ here          { return HERE; }
 there          { return THERE; }
 to             { return TO; }
 =              { return MAP; }
+"*"            { return WILDCARD; }
 
 keep           { yylval.flag = FLAG_TRUE;  return KEEP; }
 flush          { yylval.flag = FLAG_TRUE;  return FLUSH; }
index 010568b27cbf99297acdca13a92c2f17c018de8b..40065639df5d22e6362db6ac2e83e9966c7d37fa 100644 (file)
@@ -42,7 +42,8 @@ static void prc_reset();
 }
 
 %token DEFAULTS POLL SKIP AKA PROTOCOL AUTHENTICATE TIMEOUT KPOP KERBEROS
-%token USERNAME PASSWORD FOLDER SMTPHOST MDA IS HERE THERE TO MAP LIMIT
+%token USERNAME PASSWORD FOLDER SMTPHOST MDA LIMIT
+%token IS HERE THERE TO MAP WILDCARD
 %token SET BATCHLIMIT LOGFILE
 %token <proto> PROTO
 %token <sval>  STRING
@@ -65,7 +66,7 @@ statement_list        : statement
 
 /* future global options should also have the form SET <name> <value> */
 statement      : SET BATCHLIMIT MAP NUMBER     {batchlimit = $4;}
-               | SET LOGFILE STRING            {logfile = xstrdup($3);}
+               | SET LOGFILE MAP STRING        {logfile = xstrdup($4);}
 
 /* 
  * The way the next two productions are written depends on the fact that
@@ -134,6 +135,11 @@ user1opts  : user_option
                | user1opts user_option
                ;
 
+localnames     : WILDCARD              {current.wildcard =  TRUE;}
+               | mapping_list          {current.wildcard =  FALSE;}
+               | mapping_list WILDCARD {current.wildcard =  TRUE;}
+               ;
+
 mapping_list   : mapping               
                | mapping_list mapping
                ;
@@ -144,10 +150,10 @@ mapping           : STRING
                                {save_id_pair(&current.localnames, $1, $3);}
                ;
 
-user_option    : TO mapping_list HERE
-               | TO mapping_list
-               | IS mapping_list HERE
-               | IS mapping_list
+user_option    : TO localnames HERE
+               | TO localnames
+               | IS localnames HERE
+               | IS localnames
 
                | IS STRING THERE       {strcpy(current.remotename, $2);}
                | PASSWORD STRING       {strcpy(current.password, $2);}