int uprf(char *, char *);
int vfgets(FILE *, char **);
char *write_charset_8bit(void);
-int get_returnpath(char *, int, char *, int);
int mh_strcasecmp(const char *s1, const char *s2);
int strncasecmp(const char *s1, const char *s2, size_t n);
return (state);
}
-static char fromline[BUFSIZ] = "";
void
thisisanmbox(FILE *iob)
}
ismbox = TRUE;
delimstr = "\nFrom ";
- cp = fromline;
- while ((c = getc(iob)) != '\n' && cp - fromline < BUFSIZ - 1)
- *cp++ = c;
- *cp = '\0';
-
+ while ((c = getc(iob)) != '\n' && c >= 0) {
+ continue;
+ }
c = strlen(delimstr);
fdelim = (unsigned char *) mh_xmalloc((size_t) (c + 3));
*fdelim++ = '\0';
register long pos = 0L;
register int i;
char text[10];
- register char *cp;
pos = ftell(iob);
if ((i = fread(text, sizeof *text, edelimlen, iob)) != edelimlen ||
}
if (ismbox) {
- cp = fromline;
- while ((c = getc(iob)) != '\n' && c >= 0 && cp - fromline < BUFSIZ - 1)
- *cp++ = c;
- *cp = '\0';
+ while ((c = getc(iob)) != '\n' && c >= 0) {
+ continue;
+ }
}
return 1;
}
-/*
-** Return the Return-Path and Delivery-Date header information.
-**
-** Currently, I'm assuming that the "From " line takes the following form:
-** "From" sender@host date (sendmail delivery)
-*/
-int
-get_returnpath(char *rp, int rplen, char *dd, int ddlen)
-{
- char *cp;
-
- if (!(cp = strchr(fromline, ' '))) {
- return 0;
- }
- /* Extract the Return-Path. */
- snprintf(rp, rplen, "%.*s\n", (int)(cp - fromline), fromline);
- /* Advance over the whitespace. */
- while (*cp == ' ' || *cp == '\t') {
- cp++;
- }
- /* Extract the Delivery-Date. */
- snprintf(dd, ddlen, "%.*s\n", 24, cp);
- *fromline = '\0';
- return 1;
-}
-
-
static unsigned char *
matchc(int patln, char *pat, int strln, char *str)
{
char *scnmsg = NULL;
FILE *scnout = NULL;
char name[NAMESZ];
- char returnpath[BUFSIZ];
- char deliverydate[BUFSIZ];
int incing = (outnum != SCN_MBOX && outnum != SCN_FOLD);
int scanfolder = (outnum == SCN_FOLD);
long fpos;
return SCNNUM;
if (!(scnout = fopen(scnmsg, "w")))
adios(scnmsg, "unable to write");
- /*
- ** 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);
- }
}
/* scan - main loop */
if (first) {
first = 0;
if (strncmp(buffer, "From ", i)==0) {
- char *fp, *cp;
/*
** get copy of envelope information
** ("From " line)
*/
envelope = getcpy(buffer);
- /*
- ** Now create a "Return-Path:" line
- ** from the "From " line.
- */
- cp = strchr(fp = envelope + i, ' ');
- 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;
- }
/* Put the delivery date in message */
fputs(ddate, ffp);
if (ferror(ffp)) {