Path: utzoo!attcan!uunet!mcvax!rivm!ccea3 From: ccea3@rivm.UUCP (Adri Verhoef) Newsgroups: news.software.b Subject: system V.3 /bin/mail causes misbehaviour inside mail messages + fix-s Keywords: mail -s Message-ID: <827@rivm05.UUCP> Date: 17 May 88 18:06:51 GMT Organization: RIVM, Bilthoven, The Netherlands Lines: 196 Ever since the news software got installed on my system V.3 machines, we have a slight problem involving mail, especially when mail gets sent by (some) news programs. Some of the news programs will send mail automatically (e.g. when a control message arrives), and some of the programs are invoked by the user when reading news: when one Replies via (electronic) mail, the mail problem will show up here, too. The problem is that the header gets split when /bin/mail is invoked without the new system V.3 `-s' option. There are some occurrences in the news sources of a call to a mailer, of which "/bin/mail" is used by system V. "/bin/mail" should on V.3 be invoked with the `-s' option. Without `-s', headers get split: immediately after the From line a newline is inserted, so that the recipients of the mail, when reading their mail, don't see the "Subject:" line, because it isn't there where it should be. When reading the mail that got processed by the news programs, "mailx" will generate a Status: line after the From line but before the inserted blank line, and other mail programs will not see the Subject: line either. An example of a received message produced when mail lacks option `-s': From news Tue May 17 10:10 MET 1988 Date: 17 May 88 09:09:57 GMT To: news Subject: Newsgroup comp.os.os9 changed from moderated to unmoderated Responding-System: rivm05.UUCP comp.os.os9 has been changed from moderated to unmoderated as requested by news *With* the `-s' option, the blank line after the From line will disappear! Did anyone ever fix this for her/his system V.3 machine(s)? The fix follows. NOTICE: if you are running System V.3, then you should #define SYSV3 in defs.h (with the help of localize.sh, which will copy defs.dist to defs.h). The fixes to the software according to me should be: *** ../old/control.c --- control.c ************** *** 873,879 #endif /* MMDF */ execl("/usr/bin/mail", "mail", sendto, (char *)NULL); execl("/usr/ucb/mail", "mail", sendto, (char *)NULL); execl("/bin/mail", "mail", sendto, (char *)NULL); execl("/usr/bin/mailx", "mail", sendto, (char *)NULL); _exit(1); } --- 873,883 ----- #endif /* MMDF */ execl("/usr/bin/mail", "mail", sendto, (char *)NULL); execl("/usr/ucb/mail", "mail", sendto, (char *)NULL); + #ifdef SYSV3 + execl("/bin/mail", "mail", "-s", sendto, (char *)NULL); + #else /* !SYSV3 */ execl("/bin/mail", "mail", sendto, (char *)NULL); + #endif /* !SYSV3 */ execl("/usr/bin/mailx", "mail", sendto, (char *)NULL); _exit(1); } *** ../old/defs.h --- defs.h ************** *** 67,72 /* #define MULTICAST /* If you want to be able to multicast news */ /* #define BSD4_2 /* If you are running 4.2 or 4.3 BSD */ /* #define BSD2_10 /* If you are running 2.10 BSD */ #define LOCKF /* If you have the lockf() sys call */ /* #define LOCKING /* If you have the locking() sys call */ /* #define DOGETUSER /* Always do 'getuser' so can't fake name */ --- 67,73 ----- /* #define MULTICAST /* If you want to be able to multicast news */ /* #define BSD4_2 /* If you are running 4.2 or 4.3 BSD */ /* #define BSD2_10 /* If you are running 2.10 BSD */ + /* #define SYSV3 /* If you are running system V.3: mail -s user */ #define LOCKF /* If you have the lockf() sys call */ /* #define LOCKING /* If you have the locking() sys call */ /* #define DOGETUSER /* Always do 'getuser' so can't fake name */ *** ../old/readnews.c --- readnews.c ************** *** 93,99 } if (!(MAILER = getenv("MAILER"))) MAILER = "mail"; /* was /bin/mail */ #ifdef PAGE if (myrc = getenv("PAGER")) --- 93,103 ----- } if (!(MAILER = getenv("MAILER"))) + #ifdef SYSV3 + MAILER = "/bin/mail -s"; /* was /bin/mail */ + #else /* !SYSV3 */ MAILER = "mail"; /* was /bin/mail */ + #endif /* !SYSV3 */ #ifdef PAGE if (myrc = getenv("PAGER")) *** ../old/recmail.c --- recmail.c ************** *** 27,33 #ifndef MAILER #define MAILER "/bin/mail" #endif char mailer[] = MAILER; #define MAXRECIPS 100 --- 27,39 ----- #ifndef MAILER #define MAILER "/bin/mail" + #ifdef SYSV3 + #define MAIL_S "-s", + #endif /* SYSV3 */ #endif + #ifndef MAIL_S + #define MAIL_S + #endif char mailer[] = MAILER; #define MAXRECIPS 100 ************** *** 217,223 (void) close(2); (void) dup(1); } ! execlp(mailer, mailer, recip, (char *)0); perror(mailer); exit(1); } --- 223,229 ----- (void) close(2); (void) dup(1); } ! execlp(mailer, mailer, MAIL_S recip, (char *)0); perror(mailer); exit(1); } *** ../old/sendnews.c --- sendnews.c ************** *** 48,54 #ifdef M_XENIX (void) sprintf(buffer, "/usr/bin/mail %s", *argv); #else /* XENIX is not quite Unix.... */ (void) sprintf(buffer, "/bin/mail %s", *argv); #endif /* !M_XENIX */ #endif /* !SENDMAIL */ #endif --- 48,58 ----- #ifdef M_XENIX (void) sprintf(buffer, "/usr/bin/mail %s", *argv); #else /* XENIX is not quite Unix.... */ + #ifdef SYSV3 + (void) sprintf(buffer, "/bin/mail -s %s", *argv); + #else (void) sprintf(buffer, "/bin/mail %s", *argv); + #endif /* !SYSV3 */ #endif /* !M_XENIX */ #endif /* !SENDMAIL */ #endif *** ../old/visual.c --- visual.c ************** *** 1091,1097 } *q++ = '\0'; if ((MAILER = getenv("MAILER")) == NULL) MAILER = "mail"; sprintf(rcbuf, MAILER, hptr->title); sprintf(bfr, "%s %s", rcbuf, address); arg[2] = bfr; --- 1091,1101 ----- } *q++ = '\0'; if ((MAILER = getenv("MAILER")) == NULL) + #ifdef SYSV3 + MAILER = "/bin/mail -s"; + #else /* !SYSV3 */ MAILER = "mail"; + #endif /* !SYSV3 */ sprintf(rcbuf, MAILER, hptr->title); sprintf(bfr, "%s %s", rcbuf, address); arg[2] = bfr;