home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.misc
- From: Stephen R. van den Berg <berg@messua.informatik.rwth-aachen.de>
- Subject: v21i001: procmail2.10 - mail processing program v2.10, Patch01
- Message-ID: <1991Jul19.072410.17897@sparky.IMD.Sterling.COM>
- X-Md4-Signature: 884bedcb4a550a15c14c94626403f46e
- Date: Fri, 19 Jul 1991 07:24:10 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: Stephen R. van den Berg <berg@messua.informatik.rwth-aachen.de>
- Posting-number: Volume 21, Issue 1
- Archive-name: procmail2.10/patch01
- Patch-To: procmail2.10: Volume 20, Issue 89-91
- Environment: UNIX, sendmail, smail, MMDF
-
- This patch will:
- - enhance the new MMDF support (which was a bit sparse, I admit).
- - fix 2 bugs (a minor annoying one, and a major one), the last ones,
- I hope.
- - increment the version count to v2.11 (the last digit will represent
- the patch count).
-
- To apply the patch:
-
- cd procmail; patch <the_file_with_the_patches ; rm *.orig
- ls *.rej # should not list any files
-
- --
- Sincerely, berg@messua.informatik.rwth-aachen.de
- Stephen R. van den Berg. berg@physik.tu-muenchen.de
-
- ----------------------------------cut here------------------------------------
- diff -rc ../old/HISTORY ./HISTORY
- *** ../old/HISTORY Wed Jul 10 20:08:12 1991
- --- ./HISTORY Wed Jul 17 16:59:54 1991
- ***************
- *** 159,161 ****
- --- 159,167 ----
- A better example for splitting up digests
- Extended the 'advanced' examples by an elaborate ':A' option
- example
- + 1991/07/12: v2.11
- + Enhanced MMDF support
- + Ignoring SIGPIPE now, how could I ever have left it out?
- + This should take care of any, previously inexplicable,
- + mysterious failures of formail or procmail
- + Blanks are really ignored now on action lines
- diff -rc ../old/README ./README
- *** ../old/README Wed Jul 10 20:08:01 1991
- --- ./README Wed Jul 17 16:59:57 1991
- ***************
- *** 24,30 ****
-
- ------------------------------ DESCRIPTION -----------------------------------
-
- ! The procmail mail processing program. (v2.10 1991/07/08)
-
- Can be used to create mail-servers, mailing lists, sort your incoming mail
- into separate folders/files (real convenient when subscribing to one or more
- --- 24,30 ----
-
- ------------------------------ DESCRIPTION -----------------------------------
-
- ! The procmail mail processing program. (v2.11 1991/07/17)
-
- Can be used to create mail-servers, mailing lists, sort your incoming mail
- into separate folders/files (real convenient when subscribing to one or more
- diff -rc ../old/common.c ./common.c
- *** ../old/common.c Wed Jul 10 20:08:02 1991
- --- ./common.c Wed Jul 17 16:59:59 1991
- ***************
- *** 9,15 ****
- * *
- ************************************************************************/
- #ifdef RCS
- ! static char rcsid[]="$Id: common.c,v 2.1 1991/06/19 17:41:41 berg Rel $";
- #endif
- #include "includes.h"
-
- --- 9,15 ----
- * *
- ************************************************************************/
- #ifdef RCS
- ! static char rcsid[]="$Id: common.c,v 2.2 1991/07/17 14:58:38 berg Rel $";
- #endif
- #include "includes.h"
-
- ***************
- *** 43,49 ****
- #include "shell.h"
-
- shexec(argv)const char*const*argv;{int i;const char**newargv,**p;
- ! execvp(*argv,argv); /* if this one fails, we retry it as a shell script */
- for(p=(const char**)argv,i=1;i++,*p++;); /* count the arguments */
- newargv=malloc(i*sizeof*p);
- for(*(p=newargv)=binsh;*++p= *++argv;);
- --- 43,52 ----
- #include "shell.h"
-
- shexec(argv)const char*const*argv;{int i;const char**newargv,**p;
- ! #ifdef SIGXCPU
- ! signal(SIGXCPU,SIG_DFL);signal(SIGXFSZ,SIG_DFL);
- ! #endif
- ! signal(SIGPIPE,SIG_DFL);execvp(*argv,argv); /* -- or is it a shell script ? */
- for(p=(const char**)argv,i=1;i++,*p++;); /* count the arguments */
- newargv=malloc(i*sizeof*p);
- for(*(p=newargv)=binsh;*++p= *++argv;);
- diff -rc ../old/formail.c ./formail.c
- *** ../old/formail.c Wed Jul 10 20:08:11 1991
- --- ./formail.c Wed Jul 17 17:00:08 1991
- ***************
- *** 11,23 ****
- * *
- ************************************************************************/
- #ifdef RCS
- ! static char rcsid[]="$Id: formail.c,v 2.7 1991/07/03 18:49:25 berg Rel $";
- #endif
- ! static char rcsdate[]="$Date: 1991/07/03 18:49:25 $";
- #include "config.h" /* overkill, only need BinSh & MAILBOX_SEPARATOR */
- #include "includes.h"
-
- ! #define BSIZE 4096
-
- #define FROM "From "
- #define UNKNOWN "foo@bar"
- --- 11,23 ----
- * *
- ************************************************************************/
- #ifdef RCS
- ! static char rcsid[]="$Id: formail.c,v 2.8 1991/07/17 14:35:09 berg Rel $";
- #endif
- ! static char rcsdate[]="$Date: 1991/07/17 14:35:09 $";
- #include "config.h" /* overkill, only need BinSh & MAILBOX_SEPARATOR */
- #include "includes.h"
-
- ! #define BSIZE 4096
-
- #define FROM "From "
- #define UNKNOWN "foo@bar"
- ***************
- *** 48,54 ****
- --- 48,64 ----
- {Fromm,STRLEN(Fromm)},{Date,STRLEN(Date)},{subject,STRLEN(subject)},
- {article,STRLEN(article)},{Path,STRLEN(Path)},{Received,STRLEN(Received)}};
- #define mxl(a,b) mx(STRLEN(a),STRLEN(b))
- + #ifndef MAILBOX_SEPARATOR
- #define dig_HDR_LEN mx(mxl(From,Fromm),mxl(Date,subject))
- + #define mboxseparator From
- + #define flushseparator(i,p)
- + #else
- + static const char mboxseparator[]=MAILBOX_SEPARATOR;
- + #define flushseparator(i,p) \
- + do{i=p;p=0;do{int x;Nextchar(x);}while(--i);}while(0)
- + #define dig_HDR_LEN \
- + mx(mx(mxl(From,Fromm),mxl(Date,subject)),STRLEN(mboxseparator))
- + #endif
- static errout,oldstdout;
- static pid_t child= -1;
- static FILE*mystdout;
- ***************
- *** 114,136 ****
- case '\0':;}
- break;}}
- parsedoptions:
- ! #ifndef MAILBOX_SEPARATOR
- ! #define mboxseparator From
- ! #define flushseparator()
- ! #else
- ! #define mboxseparator MAILBOX_SEPARATOR
- ! #define flushseparator() (p=0)
- if(split){
- bogus=0;every=1;}
- #endif
- ! mystdout=stdout;
- if(split){
- oldstdout=dup(STDOUT);fclose(stdout);startprog(argv);}
- while('\n'==(i=getchar()));
- buf=malloc(buflen=BSIZE);t=time((time_t*)0);
- for(;;){ /* start parsing the header */
- if((buf[p++]=i)=='\n'){
- ! chp=buf+lnl;i=maxindex(rex);
- while(strnicmp(rex[i].headr,chp,rex[i].lenr)&&i--);
- if(i>=0) /* found anything already? */
- rex[i].offset=lnl+rex[i].lenr;
- --- 124,153 ----
- case '\0':;}
- break;}}
- parsedoptions:
- ! #ifdef MAILBOX_SEPARATOR
- if(split){
- bogus=0;every=1;}
- #endif
- ! mystdout=stdout;signal(SIGPIPE,SIG_IGN);
- if(split){
- oldstdout=dup(STDOUT);fclose(stdout);startprog(argv);}
- + else if(every)
- + goto usg;
- while('\n'==(i=getchar()));
- buf=malloc(buflen=BSIZE);t=time((time_t*)0);
- for(;;){ /* start parsing the header */
- if((buf[p++]=i)=='\n'){
- ! chp=buf+lnl;
- ! #ifdef MAILBOX_SEPARATOR
- ! if(!strncmp(mboxseparator,chp,STRLEN(mboxseparator))){
- ! if(!lnl){
- ! if(split){
- ! p=0;goto redigest;}
- ! force=1;} /* separator up front, don't add a 'From ' line */
- ! else if(bogus)
- ! *chp=' ';}
- ! #endif
- ! i=maxindex(rex);
- while(strnicmp(rex[i].headr,chp,rex[i].lenr)&&i--);
- if(i>=0) /* found anything already? */
- rex[i].offset=lnl+rex[i].lenr;
- ***************
- *** 139,146 ****
- if(!areply)
- goto endofheader;
- nowm=trust?1:3/*wreply*/;ll=lnl+STRLEN(From);goto foundfrom;}
- if(bogus){
- ! tmemmove(chp+1,chp,p++-lnl);*chp='>';}} /* disarm */
- else{
- i=maxindex(sest);
- do
- --- 156,166 ----
- if(!areply)
- goto endofheader;
- nowm=trust?1:3/*wreply*/;ll=lnl+STRLEN(From);goto foundfrom;}
- + #ifndef MAILBOX_SEPARATOR
- if(bogus){
- ! tmemmove(chp+1,chp,p++-lnl);*chp='>';} /* disarm */
- ! #endif
- ! }
- else{
- i=maxindex(sest);
- do
- ***************
- *** 200,211 ****
- Nextchar(i=buf[p]);
- if(++p==STRLEN(mboxseparator))
- if(!strncmp(mboxseparator,buf,STRLEN(mboxseparator))){
- ! if(bogus&&!lnl){
- ! putcs('>');break;} /* disarm */
- ! else if(every){
- ! flushseparator();goto splitit;} /* optionally flush */
- else if(split&&lnl)
- ! lnl=2;} /* mark line as possible postmark */
- if(lnl==1&&digest){
- thelen=maxindex(cdigest);
- do /* check for new digest header */
- --- 220,235 ----
- Nextchar(i=buf[p]);
- if(++p==STRLEN(mboxseparator))
- if(!strncmp(mboxseparator,buf,STRLEN(mboxseparator))){
- ! if(every){
- ! flushseparator(i,p);goto splitit;} /* optionally flush */
- else if(split&&lnl)
- ! lnl=2; /* mark line as possible postmark */
- ! else if(bogus){ /* disarm */
- ! #ifndef MAILBOX_SEPARATOR
- ! putcs('>');break;}}
- ! #else
- ! Nextchar(i);*buf=' ';putssn(buf,p);*buf=i;p=1;continue;}}
- ! #endif
- if(lnl==1&&digest){
- thelen=maxindex(cdigest);
- do /* check for new digest header */
- diff -rc ../old/nonint.c ./nonint.c
- *** ../old/nonint.c Wed Jul 10 20:08:06 1991
- --- ./nonint.c Wed Jul 17 17:00:14 1991
- ***************
- *** 9,15 ****
- * *
- ************************************************************************/
- #ifdef RCS
- ! static char rcsid[]="$Id: nonint.c,v 2.3 1991/07/08 10:47:56 berg Rel $";
- #endif
- #include "config.h"
- #include "procmail.h"
- --- 9,15 ----
- * *
- ************************************************************************/
- #ifdef RCS
- ! static char rcsid[]="$Id: nonint.c,v 2.4 1991/07/11 11:22:56 berg Rel $";
- #endif
- #include "config.h"
- #include "procmail.h"
- ***************
- *** 106,112 ****
-
- long dump(s,source,len)const int s;const char*source;long len;{int i;
- if(s>=0){
- ! lastdump=len;
- while(i=rwrite(s,source,BLKSIZ<len?BLKSIZ:(int)len)){
- if(i<0){
- i=0;goto writefin;}
- --- 106,112 ----
-
- long dump(s,source,len)const int s;const char*source;long len;{int i;
- if(s>=0){
- ! lastdump=len;mboxseparator(s); /* prepend optional custom separator */
- while(i=rwrite(s,source,BLKSIZ<len?BLKSIZ:(int)len)){
- if(i<0){
- i=0;goto writefin;}
- diff -rc ../old/procmail.c ./procmail.c
- *** ../old/procmail.c Wed Jul 10 20:08:05 1991
- --- ./procmail.c Wed Jul 17 17:00:14 1991
- ***************
- *** 11,17 ****
- * *
- ************************************************************************/
- #ifdef RCS
- ! static char rcsid[]="$Id: procmail.c,v 2.9 1991/07/08 13:03:07 berg Rel $";
- #endif
- #include "config.h"
- #define MAIN
- --- 11,17 ----
- * *
- ************************************************************************/
- #ifdef RCS
- ! static char rcsid[]="$Id: procmail.c,v 2.10 1991/07/17 14:58:38 berg Rel $";
- #endif
- #include "config.h"
- #define MAIN
- ***************
- *** 18,24 ****
- #include "procmail.h"
- #include "shell.h"
-
- ! #define VERSION "procmail v2.10 1991/07/08 written by Stephen R.van den Berg\n\
- \t\t\t\tberg@messua.informatik.rwth-aachen.de\n\
- \t\t\t\tberg@physik.tu-muenchen.de\n"
-
- --- 18,24 ----
- #include "procmail.h"
- #include "shell.h"
-
- ! #define VERSION "procmail v2.11 1991/07/17 written by Stephen R.van den Berg\n\
- \t\t\t\tberg@messua.informatik.rwth-aachen.de\n\
- \t\t\t\tberg@physik.tu-muenchen.de\n"
-
- ***************
- *** 39,45 ****
- {"NORESRETRY",DEFnoresretry},{"TIMEOUT",DEFtimeout}};
- long lastdump;
- int retval=EX_CANTCREAT,sh,pwait,lcking,locknext,verbose,linebuf=DEFlinebuf,
- ! rc= -1;
- volatile int flaggerd=2,nextexit;
- volatile time_t alrmtime;
- pid_t thepid;
- --- 39,45 ----
- {"NORESRETRY",DEFnoresretry},{"TIMEOUT",DEFtimeout}};
- long lastdump;
- int retval=EX_CANTCREAT,sh,pwait,lcking,locknext,verbose,linebuf=DEFlinebuf,
- ! rc= -1,tofolder;
- volatile int flaggerd=2,nextexit;
- volatile time_t alrmtime;
- pid_t thepid;
- ***************
- *** 73,79 ****
- setdef(orgmail,DEForgmail);setdef(grep,DEFgrep);setdef(sendmail,DEFsendmail);
- setdef(lockext,DEFlockext);setdef(msgprefix,DEFmsgprefix);
- chdir(getenv(maildir));nextrcfile();thebody=themail=malloc(1);filled=0;
- ! signal(SIGTERM,sterminate);signal(SIGINT,sterminate);
- signal(SIGHUP,sterminate);signal(SIGQUIT,flagger);signal(SIGALRM,ftimeout);
- changedmail:
- themail=readdyn(themail,&filled); /* read in the mail */
- --- 73,82 ----
- setdef(orgmail,DEForgmail);setdef(grep,DEFgrep);setdef(sendmail,DEFsendmail);
- setdef(lockext,DEFlockext);setdef(msgprefix,DEFmsgprefix);
- chdir(getenv(maildir));nextrcfile();thebody=themail=malloc(1);filled=0;
- ! #ifdef SIGXCPU
- ! signal(SIGXCPU,SIG_IGN);signal(SIGXFSZ,SIG_IGN);
- ! #endif
- ! signal(SIGPIPE,SIG_IGN);signal(SIGTERM,sterminate);signal(SIGINT,sterminate);
- signal(SIGHUP,sterminate);signal(SIGQUIT,flagger);signal(SIGALRM,ftimeout);
- changedmail:
- themail=readdyn(themail,&filled); /* read in the mail */
- ***************
- *** 158,164 ****
- else if(strchr(flags,'b'))
- tobesent-=(startchar=thebody)-themail;
- chp=strchr(strcpy(buf,tgetenv(sendmail)),'\0');sh=0;
- ! pwait=!!strchr(flags,'w');
- if(testb('!')){ /* forward the mail */
- readparse(chp+1,getb,0);
- if(i)
- --- 161,167 ----
- else if(strchr(flags,'b'))
- tobesent-=(startchar=thebody)-themail;
- chp=strchr(strcpy(buf,tgetenv(sendmail)),'\0');sh=0;
- ! pwait=!!strchr(flags,'w');skipspace();
- if(testb('!')){ /* forward the mail */
- readparse(chp+1,getb,0);
- if(i)
- ***************
- *** 206,212 ****
- if(dump(deliver(buf2),startchar,tobesent))
- writeerr(buf);
- else if(!strchr(flags,'c'))
- ! goto mailed;}}}
- else if(testb('#')) /* no comment :-) */
- getbl(buf);
- else{ /* then it must be an assignment */
- --- 209,216 ----
- if(dump(deliver(buf2),startchar,tobesent))
- writeerr(buf);
- else if(!strchr(flags,'c'))
- ! goto mailed;
- ! tofolder=0;}}}
- else if(testb('#')) /* no comment :-) */
- getbl(buf);
- else{ /* then it must be an assignment */
- diff -rc ../old/procmail.h ./procmail.h
- *** ../old/procmail.h Wed Jul 10 20:08:12 1991
- --- ./procmail.h Wed Jul 17 17:14:19 1991
- ***************
- *** 1,4 ****
- ! /*$Id: procmail.h,v 2.2 1991/07/08 14:29:31 berg Rel $*/
-
- #include "includes.h"
-
- --- 1,4 ----
- ! /*$Id: procmail.h,v 2.3 1991/07/11 11:22:56 berg Rel $*/
-
- #include "includes.h"
-
- ***************
- *** 9,16 ****
- #endif
-
- #ifdef MAILBOX_SEPARATOR
- ! #define mboxseparator(fd) rwrite(fd,MAILBOX_SEPARATOR,\
- ! STRLEN(MAILBOX_SEPARATOR))
- #else
- #define mboxseparator(fd)
- #endif
- --- 9,16 ----
- #endif
-
- #ifdef MAILBOX_SEPARATOR
- ! #define mboxseparator(fd) \
- ! (tofolder?rwrite(fd,MAILBOX_SEPARATOR,STRLEN(MAILBOX_SEPARATOR)):0)
- #else
- #define mboxseparator(fd)
- #endif
- ***************
- *** 43,49 ****
- devnull[],executing[],oquote[],cquote[],whilstwfor[];
- extern struct varval strenvvar[];
- extern long lastdump;
- ! extern sh,pwait,retval,lcking,locknext,verbose,linebuf,rc;
- extern volatile flaggerd,nextexit;
- extern volatile time_t alrmtime;
- extern pid_t thepid;
- --- 43,49 ----
- devnull[],executing[],oquote[],cquote[],whilstwfor[];
- extern struct varval strenvvar[];
- extern long lastdump;
- ! extern sh,pwait,retval,lcking,locknext,verbose,linebuf,rc,tofolder;
- extern volatile flaggerd,nextexit;
- extern volatile time_t alrmtime;
- extern pid_t thepid;
- diff -rc ../old/retint.c ./retint.c
- *** ../old/retint.c Wed Jul 10 20:08:07 1991
- --- ./retint.c Wed Jul 17 17:00:16 1991
- ***************
- *** 9,15 ****
- * *
- ************************************************************************/
- #ifdef RCS
- ! static char rcsid[]="$Id: retint.c,v 2.6 1991/07/04 12:57:36 berg Rel $";
- #endif
- #include "config.h"
- #include "procmail.h"
- --- 9,15 ----
- * *
- ************************************************************************/
- #ifdef RCS
- ! static char rcsid[]="$Id: retint.c,v 2.7 1991/07/11 11:22:56 berg Rel $";
- #endif
- #include "config.h"
- #include "procmail.h"
- ***************
- *** 268,274 ****
- /* open file or new file in directory */
- deliver(boxname)char*const boxname;{struct stat stbuf;
- strcpy(buf,boxname); /* boxname can be found back in buf */
- ! return stat(buf,&stbuf)||!S_ISDIR(stbuf.st_mode)?opena(buf):dirmail();}
-
- #include "exopen.h"
- /* an NFS secure exclusive file open */
- --- 268,275 ----
- /* open file or new file in directory */
- deliver(boxname)char*const boxname;{struct stat stbuf;
- strcpy(buf,boxname); /* boxname can be found back in buf */
- ! return stat(buf,&stbuf)||!S_ISDIR(stbuf.st_mode)?
- ! (tofolder=1,opena(buf)):dirmail();}
-
- #include "exopen.h"
- /* an NFS secure exclusive file open */
- ----------------------------------cut here------------------------------------
-
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-