1N/A * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved. 1N/A * Copyright (c) 1983, 1984, 1986, 1986, 1987, 1988, 1989 AT&T 1N/A * All Rights Reserved 1N/A * Copyright (c) 1983 Eric P. Allman 1N/A * Berkeley, California 1N/A * Copyright (c) 1983 Regents of the University of California. 1N/A * All rights reserved. The Berkeley software License Agreement 1N/A * specifies the terms and conditions for redistribution. 1N/A * MAILCOMPAT -- Deliver mail to a user's mailbox with the "From's" stuffed. 1N/Achar *
myname;
/* person who is to have their mail filtered */ 1N/A /* process arguments */ 1N/A case 'd':
/* debug */ 1N/A /* verify recipient argument */ 1N/A usrerr(
"Usage: mailcompat username (or) mailcompat -r");
1N/A /* find user's home directory */ 1N/A /* read message from standard input (just from line) */ 1N/A** sendmessage -- read message from standard input do the from stuffing 1N/A** and forward to /bin/mail, Being sure to delete any 1N/A** content-length headers (/bin/mail recalculates them). 1N/A** Reads first line from standard input. 1N/A if (
line[0] == (
char)
'\n')
/* end of mail headers */ 1N/A /* read the from line */ 1N/A /* find the end of the sender address and terminate it */ 1N/A * Strip all but the rightmost UUCP host 1N/A * to prevent loops due to forwarding. 1N/A * Start searching leftward from the leftmost '@'. 1N/A * a!b!c!d yields a short name of c!d 1N/A * a!b!c!d@e yields a short name of c!d@e 1N/A * e@a!b!c yields the same short name 1N/A at = p;
/* if none, use end of addr */ 1N/A /* return the sender address */ 1N/A** USRERR -- print user error 1N/A** NEWSTR -- copy a string 1N/A** s -- the string to copy. 1N/A** A copy of the string. 1N/A * When invoked with no arguments, we fall into an automatic installation 1N/A * mode, stepping the user through a default installation. 1N/A printf(
"This program can be used to store your mail in a format\n");
1N/A printf(
"that you can read with SunOS 4.X based mail readers\n");
1N/A printf(
"You have a .forward file in your home directory");
1N/A if (!
ask(
"Would you like to remove it and disable the mailcompat feature"))
1N/A printf(
"Back to normal reception of mail.\n");
1N/A printf(
"To enable the mailcompat feature a \".forward\" ");
1N/A if (!
ask(
"Would you like to enable the mailcompat feature")) {
1N/A printf(
"OK, mailcompat feature NOT enabled.\n");
1N/A printf(
"Run mailcompat with no arguments to remove it\n");
1N/A * Ask the user a question until we get a reasonable answer 1N/A printf(
"Please reply \"yes\" or \"no\" (\'y\' or \'n\')\n");