4.3bsd vacation program
cball at inmet.UUCP
cball at inmet.UUCP
Sat Jan 31 01:06:00 AEST 1987
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.
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list