Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ames!ucbcad!ucbvax!hplabs!hplabsc!daemon From: taylor@hpldat.UUCP (Dave Taylor) Newsgroups: comp.mail.elm Subject: Elm Patch 8 of 8 Message-ID: <1706@hplabsc.HP.COM> Date: Sun, 3-May-87 13:54:46 EDT Article-I.D.: hplabsc.1706 Posted: Sun May 3 13:54:46 1987 Date-Received: Sun, 3-May-87 21:49:36 EDT Sender: daemon@hplabsc.HP.COM Reply-To: taylor@hpldat (Dave Taylor) Organization: Hewlett-Packard Laboratories, Interface Technologies Group Lines: 1174 Approved: taylor@hplabs (with 'postmail') This is Elm Patch Kit #8 of 8, the final of the set, and contains patches for: utils/Makefile.mstr utils/listalias.c test/test.mail filter/filter.c filter/rules.c filter/actions.c filter/parse.c filter/utils2.c Overview Instructions Configure.sh Makefile.mstr NOTICE Please feed this directly to 'patch'. Index: utils/Makefile.mstr *************** *** 29,31 ! ../bin/from: from.c ../src/opt_utils.o ../src/string2.o ${CC} ${CFLAGS} ${DEFINE} from.c ../src/opt_utils.o \ --- 29,31 ----- ! ../bin/from: from.c ../src/opt_utils.o ../src/string2.o ../src/getopt.o ${CC} ${CFLAGS} ${DEFINE} from.c ../src/opt_utils.o \ *************** *** 31,33 ${CC} ${CFLAGS} ${DEFINE} from.c ../src/opt_utils.o \ ! ../src/string2.o -o ../bin/from --- 31,33 ----- ${CC} ${CFLAGS} ${DEFINE} from.c ../src/opt_utils.o \ ! ../src/string2.o ../src/getopt.o -o ../bin/from Index: utils/listalias.c *************** *** 57,59 if ((datafile = fopen(fd_data, "r")) == NULL) { ! fprintf("Opened %s hash file, but couldn't open data file!\n", count? "system" : "user"); --- 57,59 ----- if ((datafile = fopen(fd_data, "r")) == NULL) { ! printf("Opened %s hash file, but couldn't open data file!\n", count? "system" : "user"); Index: test/test.mail *************** *** 40,42 ! I believe your introduction referred to the uucp network. usenet is the networXk news software mechanism and isn't a "network". --- 40,42 ----- ! I believe your introduction referred to the uucp network. usenet is the network news software mechanism and isn't a "network". *************** *** 64,66 backing up directories: ! ./users/fh ./users/rmd ./users/vince ./users/roberts ./users/row ./users/dt ./Xlost+found ./users/lost+found ./users/scb ./users/kevin ./users/du --- 64,66 ----- backing up directories: ! ./users/fh ./users/rmd ./users/vince ./users/roberts ./users/row ./users/dt ./lost+found ./users/lost+found ./users/scb ./users/kevin ./users/du *************** *** 77,79 backing up directories: ! ./users/fh ./users/rmd ./users/vince ./users/roberts ./users/row ./users/dt ./Xlost+found ./users/lost+found ./users/scb ./users/kevin ./users/du --- 77,79 ----- backing up directories: ! ./users/fh ./users/rmd ./users/vince ./users/roberts ./users/row ./users/dt ./lost+found ./users/lost+found ./users/scb ./users/kevin ./users/du *************** *** 83,85 backing up directories: ! ./users/sbh ./users/ges ./users/cpb ./users/amy ./net ./users/root ./users/balXza ./dev ./users/remple ./users/jr ./users/mwr ./users/larryf --- 83,85 ----- backing up directories: ! ./users/sbh ./users/ges ./users/cpb ./users/amy ./net ./users/root ./users/balza ./dev ./users/remple ./users/jr ./users/mwr ./users/larryf *************** *** 120,122 Received: by HP-VENUS via CSNET; 7 Aug 1985 09:11:37-PDT (Wed) ! Received: from sumex-aim.arpa by csnet-relay.arpa id a015812; 6 Aug 85 12:14 EDXT To: hpcnof!veeger!hpcnou!dat%hplabs.csnet@CSNET-RELAY --- 120,122 ----- Received: by HP-VENUS via CSNET; 7 Aug 1985 09:11:37-PDT (Wed) ! Received: from sumex-aim.arpa by csnet-relay.arpa id a015812; 6 Aug 85 12:14 EDT To: hpcnof!veeger!hpcnou!dat%hplabs.csnet@CSNET-RELAY *************** *** 197,199 >From root Mon Oct 21 10:28:58 1985 remote from hpcnof ! >From DLS.MDC%office-X.arpa@CSNET-RELAY Mon Oct 21 01:57:05 1985 remote from hXplabs Received: by HP-VENUS id AA17376; Mon, 21 Oct 85 01:57:05 pdt --- 197,199 ----- >From root Mon Oct 21 10:28:58 1985 remote from hpcnof ! >From DLS.MDC%office-X.arpa@CSNET-RELAY Mon Oct 21 01:57:05 1985 remote from hplabs Received: by HP-VENUS id AA17376; Mon, 21 Oct 85 01:57:05 pdt *************** *** 200,202 Date: 21 Oct 85 01:02 EDT ! From: Duane Stone / McDonnell Douglas / CSC-ASD Received: by HP-VENUS via CSNET; 21 Oct 1985 01:57:01-PDT (Mon) --- 200,202 ----- Date: 21 Oct 85 01:02 EDT ! From: Duane Stone / McDonnell Douglas / CSC-ASD Received: by HP-VENUS via CSNET; 21 Oct 1985 01:57:01-PDT (Mon) *************** *** 202,204 Received: by HP-VENUS via CSNET; 21 Oct 1985 01:57:01-PDT (Mon) ! Received: from office-1.arpa by CSNET-RELAY.ARPA id a019220; 21 Oct 85 1:18 EDTX To: Dave Taylor --- 202,204 ----- Received: by HP-VENUS via CSNET; 21 Oct 1985 01:57:01-PDT (Mon) ! Received: from office-1.arpa by CSNET-RELAY.ARPA id a019220; 21 Oct 85 1:18 EDT To: Dave Taylor *************** *** 207,209 Message-Id: ! Comment: Dave -- this is the body of the message I previously 'sent' to you viaX --- 207,209 ----- Message-Id: ! Comment: Dave -- this is the body of the message I previously 'sent' to you via *************** *** 211,213 ! I might suggest re-wording the para on Author -- my associates might object to X 'strange' -- something like: --- 211,213 ----- ! I might suggest re-wording the para on Author -- my associates might object to 'strange' -- something like: *************** *** 219,221 ! Length: This is computed when the message is sent and gives the recipients X an estimate of the number of pages in the document. --- 219,221 ----- ! Length: This is computed when the message is sent and gives the recipients an estimate of the number of pages in the document. *************** *** 228,230 ! Used to declare whether a Journal item should be Public or Private (to thoseX that are on the distribution list or Extended Access list) --- 228,230 ----- ! Used to declare whether a Journal item should be Public or Private (to those that are on the distribution list or Extended Access list) *************** *** 299,301 Used to submit the message to the Journal. The adressees receive a short ! citation with other header fields and a "Location:" field pointing to a fileX in an electronic library. --- 299,301 ----- Used to submit the message to the Journal. The adressees receive a short ! citation with other header fields and a "Location:" field pointing to a file in an electronic library. *************** *** 317,319 Used to send a message "in-turn" to addressees in the "To:" field -- as ! opposed to the broadcast method of delivery where everyone gets the message X "simultaneously". Any addresses in the "Cc:" field receive a copy of the --- 317,319 ----- Used to send a message "in-turn" to addressees in the "To:" field -- as ! opposed to the broadcast method of delivery where everyone gets the message "simultaneously". Any addresses in the "Cc:" field receive a copy of the *************** *** 328,331 ! Created when the user employs the Sign command; used to electronically sign X ! a message. It affixes a signature-block to a message. A "Verify Signature"X command is available to recipients that lets them find out if anyone has --- 328,331 ----- ! Created when the user employs the Sign command; used to electronically sign ! a message. It affixes a signature-block to a message. A "Verify Signature" command is available to recipients that lets them find out if anyone has Index: filter/filter.c *************** *** 19,20 (C) Copyright 1986, Dave Taylor --- 19,23 ----- + Rev 2.0: knows about From: and Reply-To: + Fix: knows that mail lines are approx. ~5K or greater... + (C) Copyright 1986, Dave Taylor *************** *** 22,24 - #include --- 25,26 ----- #include *************** *** 26,32 #include ! #ifdef BSD ! # include ! #else ! # include ! #endif #include --- 28,30 ----- #include ! #include #include *************** *** 46,48 char filename[SLEN], /* name of the temp file */ ! buffer[LONG_SLEN]; /* input buffer space */ int in_header = TRUE, /* for header parsing */ --- 44,46 ----- char filename[SLEN], /* name of the temp file */ ! buffer[MAX_LINE_LEN]; /* input buffer space */ int in_header = TRUE, /* for header parsing */ *************** *** 58,59 strcpy(username, passwd_entry->pw_name); --- 56,58 ----- strcpy(username, passwd_entry->pw_name); + to[0] = '\0'; /* nothing read in yet, right? */ *************** *** 68,70 case 'l' : log_actions_only = TRUE; break; ! case 'r' : if (get_filter_rules() == -1) fprintf(stderr,"Couldn't get rules!\n"); --- 67,70 ----- case 'l' : log_actions_only = TRUE; break; ! case 'r' : printing_rules = TRUE; ! if (get_filter_rules() == -1) fprintf(stderr,"Couldn't get rules!\n"); *************** *** 96,98 ! while (gets(buffer) != NULL) { if (in_header) { --- 96,101 ----- ! while (fgets(buffer, MAX_LINE_LEN, stdin) != NULL) { ! ! remove_return(buffer); ! if (in_header) { *************** *** 106,108 save_subject(buffer); ! else if (the_same(buffer, "To:")) { in_to++; --- 109,111 ----- save_subject(buffer); ! else if (the_same(buffer, "To:") || the_same(buffer, "Cc:")) { in_to++; *************** *** 112,113 already_been_forwarded++; /* could be a loop here! */ else if (strlen(buffer) < 2) --- 115,122 ----- already_been_forwarded++; /* could be a loop here! */ + #ifdef USE_EMBEDDED_ADDRESSES + else if (the_same(buffer, "From:")) + save_embedded_address(buffer, "From:"); + else if (the_same(buffer, "Reply-To:")) + save_embedded_address(buffer, "Reply-To:"); + #endif else if (strlen(buffer) < 2) *************** *** 196,198 { ! /** save all but the word "To:" for the to list **/ --- 205,207 ----- { ! /** save all but the word "To:" or "Cc:" for the to list **/ *************** *** 198,200 ! register int skip = 3; /* skip "To:" initially */ --- 207,209 ----- ! register int skip = 3; /* skip "To:" or "Cc:" initially */ *************** *** 202,204 ! strcpy(to, (char *) buffer + skip); } --- 211,213 ----- ! strcat(to, (char *) buffer + skip); } *************** *** 204,204 } --- 213,262 ----- } + + #ifdef USE_EMBEDDED_ADDRESSES + + save_embedded_address(buffer, fieldname) + char *buffer, *fieldname; + { + /** this will replace the 'from' address with the one given, + unless the address is from a 'reply-to' field (which overrides + the From: field). The buffer given to this routine can have one + of three forms: + fieldname: username
+ fieldname: address (username) + fieldname: address + **/ + + static int processed_a_reply_to = 0; + char address[SLEN]; + register int i, j = 0; + + /** first let's extract the address from this line.. **/ + + if (buffer[strlen(buffer)-1] == '>') { /* case #1 */ + for (i=strlen(buffer)-1; buffer[i] != '<' && i > 0; i--) + /* nothing - just move backwards .. */ ; + i++; /* skip the leading '<' symbol */ + while (buffer[i] != '>') + address[j++] = buffer[i++]; + address[j] = '\0'; + } + else { /* get past "from:" and copy until white space or paren hit */ + for (i=strlen(fieldname); whitespace(buffer[i]); i++) + /* skip past that... */ ; + while (buffer[i] != '(' && ! whitespace(buffer[i])) + address[j++] = buffer[i++]; + address[j] = '\0'; + } + + /** now let's see if we should overwrite the existing from address + with this one or not.. **/ + + if (processed_a_reply_to) + return; /* forget it! */ + + strcpy(from, address); /* replaced!! */ + + if (strcmp(fieldname, "Reply-To:") == 0) + processed_a_reply_to++; + } + #endif Index: filter/rules.c *************** *** 11,17 #include ! #ifdef BSD ! # include ! #else ! # include ! #endif #include --- 11,13 ----- #include ! #include #include *************** *** 21,22 int --- 17,20 ----- + char *listrule(); + int *************** *** 50,53 "%sfilter (%s): Error: rules based on 'contains' are not implemented!\n", ! BEEP, username); ! exit(0); } --- 48,53 ----- "%sfilter (%s): Error: rules based on 'contains' are not implemented!\n", ! BEEP, username); ! exit(0); ! ! case ALWAYS: not = FALSE; x = TRUE; break; } *************** *** 77,79 ! expand_macros(word, buffer, line) char *word, *buffer; --- 77,79 ----- ! expand_macros(word, buffer, line, display) char *word, *buffer; *************** *** 79,81 char *word, *buffer; ! int line; { --- 79,81 ----- char *word, *buffer; ! int line, display; { *************** *** 91,93 %y = year ! or simply copies word into buffer. **/ --- 91,94 ----- %y = year ! or simply copies word into buffer. If "display" is set then ! instead it puts "" etc. etc. in the output. **/ *************** *** 104,106 case 'r' : buffer[j] = '\0'; ! strcat(buffer, from); j = strlen(buffer); --- 105,110 ----- case 'r' : buffer[j] = '\0'; ! if (display) ! strcat(buffer, ""); ! else ! strcat(buffer, from); j = strlen(buffer); *************** *** 109,111 case 's' : buffer[j] = '\0'; ! strcat(buffer, subject); j = strlen(buffer); --- 113,121 ----- case 's' : buffer[j] = '\0'; ! if (display) ! strcat(buffer, ""); ! else { ! strcat(buffer, "\""); ! strcat(buffer, subject); ! strcat(buffer, "\""); ! } j = strlen(buffer); *************** *** 114,116 case 'S' : buffer[j] = '\0'; ! if (! the_same(subject, "Re:")) strcat(buffer, subject); --- 124,130 ----- case 'S' : buffer[j] = '\0'; ! if (display) ! strcat(buffer, ""); ! else { ! if (! the_same(subject, "Re:")) ! strcat(buffer, "\"Re: "); strcat(buffer, subject); *************** *** 116,118 strcat(buffer, subject); ! strcat(buffer, subject); j = strlen(buffer); --- 130,133 ----- strcat(buffer, subject); ! strcat(buffer, "\""); ! } j = strlen(buffer); *************** *** 121,123 case 'd' : get_the_time(); buffer[j] = '\0'; ! strcat(buffer, itoa(timerec->tm_mday,FALSE)); j = strlen(buffer); --- 136,141 ----- case 'd' : get_the_time(); buffer[j] = '\0'; ! if (display) ! strcat(buffer, ""); ! else ! strcat(buffer, itoa(timerec->tm_mday,FALSE)); j = strlen(buffer); *************** *** 126,128 case 'D' : get_the_time(); buffer[j] = '\0'; ! strcat(buffer, itoa(timerec->tm_wday,FALSE)); j = strlen(buffer); --- 144,149 ----- case 'D' : get_the_time(); buffer[j] = '\0'; ! if (display) ! strcat(buffer, ""); ! else ! strcat(buffer, itoa(timerec->tm_wday,FALSE)); j = strlen(buffer); *************** *** 131,133 case 'm' : get_the_time(); buffer[j] = '\0'; ! strcat(buffer, itoa(timerec->tm_mon,FALSE)); j = strlen(buffer); --- 152,157 ----- case 'm' : get_the_time(); buffer[j] = '\0'; ! if (display) ! strcat(buffer, ""); ! else ! strcat(buffer, itoa(timerec->tm_mon,FALSE)); j = strlen(buffer); *************** *** 136,138 case 'y' : get_the_time(); buffer[j] = '\0'; ! strcat(buffer, itoa(timerec->tm_year,FALSE)); j = strlen(buffer); --- 160,165 ----- case 'y' : get_the_time(); buffer[j] = '\0'; ! if (display) ! strcat(buffer, ""); ! else ! strcat(buffer, itoa(timerec->tm_year,FALSE)); j = strlen(buffer); *************** *** 141,143 case 'h' : get_the_time(); buffer[j] = '\0'; ! strcat(buffer, itoa(timerec->tm_hour,FALSE)); j = strlen(buffer); --- 168,173 ----- case 'h' : get_the_time(); buffer[j] = '\0'; ! if (display) ! strcat(buffer, ""); ! else ! strcat(buffer, itoa(timerec->tm_hour,FALSE)); j = strlen(buffer); *************** *** 146,150 case 't' : get_the_time(); buffer[j] = '\0'; ! strcat(buffer, itoa(timerec->tm_hour,FALSE)); ! strcat(buffer, ":"); ! strcat(buffer, itoa(timerec->tm_min,TRUE)); j = strlen(buffer); --- 176,184 ----- case 't' : get_the_time(); buffer[j] = '\0'; ! if (display) ! strcat(buffer, "