From fd83882889b45c597fd051705147e8bc0ba0890d Mon Sep 17 00:00:00 2001 From: Ken Hornstein Date: Fri, 6 Jan 2012 10:35:16 -0500 Subject: [PATCH] Garbage-collect RPATHS support. --- acconfig.h | 8 ------ h/prototypes.h | 4 --- sbr/m_getfld.c | 82 -------------------------------------------------------- uip/scansbr.c | 18 ------------- uip/slocal.c | 30 --------------------- 5 files changed, 142 deletions(-) diff --git a/acconfig.h b/acconfig.h index 85b04d7..51bc739 100644 --- a/acconfig.h +++ b/acconfig.h @@ -26,14 +26,6 @@ /* #define REALLYDUMB 1 */ /* - * Directs inc/slocal to extract the envelope sender from "From " - * line. If inc/slocal is saving message to folder, then this - * sender information is then used to create a Return-Path - * header which is then added to the message. - */ -#define RPATHS 1 - -/* * If defined, slocal will use `mbox' format when saving to * your standard mail spool. If not defined, it will use * mmdf format. diff --git a/h/prototypes.h b/h/prototypes.h index 1c55136..fcc8f0c 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -125,10 +125,6 @@ int uprf (char *, char *); int vfgets (FILE *, char **); char *write_charset_8bit (void); -#ifdef RPATHS -int get_returnpath (char *, int, char *, int); -#endif - int mh_strcasecmp (const char *s1, const char *s2); int strncasecmp (const char *s1, const char *s2, size_t n); diff --git a/sbr/m_getfld.c b/sbr/m_getfld.c index be871c4..f31b9c4 100644 --- a/sbr/m_getfld.c +++ b/sbr/m_getfld.c @@ -582,10 +582,6 @@ finish: } -#ifdef RPATHS -static char unixbuf[BUFSIZ] = ""; -#endif /* RPATHS */ - void m_unknown(FILE *iob) { @@ -615,15 +611,8 @@ m_unknown(FILE *iob) && strncmp (text, "From ", 5) == 0) { msg_style = MS_MBOX; delimstr = "\nFrom "; -#ifndef RPATHS while ((c = getc (iob)) != '\n' && c >= 0) ; -#else /* RPATHS */ - cp = unixbuf; - while ((c = getc (iob)) != '\n' && cp - unixbuf < BUFSIZ - 1) - *cp++ = c; - *cp = 0; -#endif /* RPATHS */ } else { /* not a Unix style maildrop */ fseek (iob, pos, SEEK_SET); @@ -692,9 +681,6 @@ m_Eom (int c, FILE *iob) register long pos = 0L; register int i; char text[10]; -#ifdef RPATHS - register char *cp; -#endif /* RPATHS */ pos = ftell (iob); if ((i = fread (text, sizeof *text, edelimlen, iob)) != edelimlen @@ -715,83 +701,15 @@ m_Eom (int c, FILE *iob) } if (msg_style == MS_MBOX) { -#ifndef RPATHS while ((c = getc (iob)) != '\n') if (c < 0) break; -#else /* RPATHS */ - cp = unixbuf; - while ((c = getc (iob)) != '\n' && c >= 0 && cp - unixbuf < BUFSIZ - 1) - *cp++ = c; - *cp = 0; -#endif /* RPATHS */ } return 1; } -#ifdef RPATHS -/* - * Return the Return-Path and Delivery-Date - * header information. - * - * Currently, I'm assuming that the "From " line - * takes one of the following forms. - * - * From sender date remote from host (for UUCP delivery) - * From sender@host date (for sendmail delivery) - */ - -int -get_returnpath (char *rp, int rplen, char *dd, int ddlen) -{ - char *ap, *bp, *cp, *dp; - - ap = unixbuf; - if (!(bp = cp = strchr(ap, ' '))) - return 0; - - /* - * Check for "remote from" in envelope to see - * if this message uses UUCP style addressing - */ - while ((cp = strchr(++cp, 'r'))) { - if (strncmp (cp, "remote from", 11) == 0) { - cp = strrchr (cp, ' '); - break; - } - } - - /* - * Get the Return-Path information from - * the "From " envelope. - */ - if (cp) { - /* return path for UUCP style addressing */ - dp = strchr (++cp, '\n'); - snprintf (rp, rplen, "%.*s!%.*s\n", (int)(dp - cp), cp, (int)(bp - ap), ap); - } else { - /* return path for standard domain addressing */ - snprintf (rp, rplen, "%.*s\n", (int)(bp - ap), ap); - } - - /* - * advance over the spaces to get to - * delivery date on envelope - */ - while (*bp == ' ') - bp++; - - /* Now get delivery date from envelope */ - snprintf (dd, ddlen, "%.*s\n", 24, bp); - - unixbuf[0] = 0; - return 1; -} -#endif /* RPATHS */ - - static unsigned char * matchc(int patln, char *pat, int strln, char *str) { diff --git a/uip/scansbr.c b/uip/scansbr.c index 04dc215..0d12c34 100644 --- a/uip/scansbr.c +++ b/uip/scansbr.c @@ -87,11 +87,6 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, char name[NAMESZ]; static int rlwidth, slwidth; -#ifdef RPATHS - char returnpath[BUFSIZ]; - char deliverydate[BUFSIZ]; -#endif - /* first-time only initialization */ if (!scanl) { if (width == 0) { @@ -173,19 +168,6 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, } if ((scnout = fopen (scnmsg, "w")) == NULL) adios (scnmsg, "unable to write"); -#ifdef RPATHS - /* - * Add the Return-Path and Delivery-Date - * header fields to message. - */ - if (get_returnpath (returnpath, sizeof(returnpath), - deliverydate, sizeof(deliverydate))) { - FPUTS ("Return-Path: "); - FPUTS (returnpath); - FPUTS ("Delivery-Date: "); - FPUTS (deliverydate); - } -#endif /* RPATHS */ } /* scan - main loop */ diff --git a/uip/slocal.c b/uip/slocal.c index cf91737..22a21b1 100644 --- a/uip/slocal.c +++ b/uip/slocal.c @@ -1335,9 +1335,6 @@ you_lose: if (first) { first = 0; if (!strncmp (buffer, "From ", i)) { -#ifdef RPATHS - char *fp, *cp, *hp, *ep; -#endif /* get copy of envelope information ("From " line) */ envelope = getcpy (buffer); @@ -1348,33 +1345,6 @@ you_lose: goto fputs_error; #endif -#ifdef RPATHS - /* - * Now create a "Return-Path:" line - * from the "From " line. - */ - hp = cp = strchr(fp = envelope + i, ' '); - while ((hp = strchr(++hp, 'r'))) - if (uprf (hp, "remote from")) { - hp = strrchr(hp, ' '); - break; - } - if (hp) { - /* return path for UUCP style addressing */ - ep = strchr(++hp, '\n'); - snprintf (buffer, sizeof(buffer), "Return-Path: %.*s!%.*s\n", - (int)(ep - hp), hp, (int)(cp - fp), fp); - } else { - /* return path for standard domain addressing */ - snprintf (buffer, sizeof(buffer), "Return-Path: %.*s\n", - (int)(cp - fp), fp); - } - - /* Add Return-Path header to message */ - fputs (buffer, ffp); - if (ferror (ffp)) - goto fputs_error; -#endif /* Put the delivery date in message */ fputs (ddate, ffp); if (ferror (ffp)) -- 1.7.10.4