Article View: comp.bugs.4bsd
Article #5384.3bsd vacation program
From: cball
Date: Fri, 30 Jan 1987 15:06
Date: Fri, 30 Jan 1987 15:06
126 lines
3279 bytes
3279 bytes
Index: 4.3BSD /usr/ucb/vacation.c (getfrom)
Description:
Vacation depends on an initial "From <user>" line. It doesn't look for
rfc822-style "From:" header fields. This is a problem for some internet
mail or from Sendmail mailers configured not to send an initial From
line.
Repeat-by:
Send yourself mail. Save the mail to a file. Delete the inital "From "
line. Invoke vacation:
vacation -d <your login-id> < file
Fix:
--- vacation.c Fri Jan 30 09:31:55 1987
***************
*** 166,172
getfrom()
{
static char line[MAXLINE];
! register char *p;
extern char *index();
/* read the from line */
--- 166,172 -----
getfrom()
{
static char line[MAXLINE];
! register char *p, *lp;
extern char *index();
while(1) {
***************
*** 169,180
register char *p;
extern char *index();
! /* read the from line */
! if (fgets(line, sizeof line, stdin) == NULL ||
! strncmp(line, "From ", 5) != NULL)
! {
! usrerr("No initial From line");
! exit(EX_USAGE);
}
/* find the end of the sender address and terminate it */
--- 169,183 -----
register char *p, *lp;
extern char *index();
! while(1) {
! if (gets(line) == NULL || strlen(line) == 0) {
! usrerr("No initial From line");
! exit(EX_USAGE);
! }
! if (strncmp(line, "From", 4) == NULL) {
! printf("found %s\n", line);
! break;
! }
}
/* find the end of the sender address and terminate it */
***************
*** 178,185
}
/* find the end of the sender address and terminate it */
! p = index(&line[5], ' ');
! if (p == NULL)
{
usrerr("Funny From line '%s'", line);
exit(EX_USAGE);
--- 181,189 -----
}
/* find the end of the sender address and terminate it */
! lp = index(line, ' '); /* Skip "From[:]" */
! while (*lp == ' ') lp++;
! if (lp == NULL)
{
usrerr("Funny From line '%s'", line);
exit(EX_USAGE);
***************
*** 184,190
usrerr("Funny From line '%s'", line);
exit(EX_USAGE);
}
! *p = '\0';
/* return the sender address */
return (&line[5]);
--- 188,194 -----
usrerr("Funny From line '%s'", line);
exit(EX_USAGE);
}
! if((p=index(lp, ' '))!=NULL) *p = '\0';
/* return the sender address */
return (lp);
***************
*** 187,193
*p = '\0';
/* return the sender address */
! return (&line[5]);
}
/*
** JUNKMAIL -- read the header and tell us if this is junk/bulk mail.
--- 191,197 -----
if((p=index(lp, ' '))!=NULL) *p = '\0';
/* return the sender address */
! return (lp);
}
/*
** JUNKMAIL -- read the header and tell us if this is junk/bulk mail.
Technical Details
Message-ID:
<123000001@inmet>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!mit-eddie!husc6!necntc!adelie!mirror!gabriel!inmet!cballShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!mit-eddie!husc6!necntc!adelie!mirror!gabriel!inmet!cball From: cball@inmet.UUCP Newsgroups: comp.bugs.4bsd Subject: 4.3bsd vacation program Message-ID: <123000001@inmet> Date: Fri, 30-Jan-87 10:06:00 EST Article-I.D.: inmet.123000001 Posted: Fri Jan 30 10:06:00 1987 Date-Received: Sun, 1-Feb-87 16:37:46 EST Lines: 126 Nf-ID: #N:inmet:123000001:000:2644 Nf-From: inmet.UUCP!cball Jan 30 10:06:00 1987