System V.3 /bin/mail causes misbehaviour inside mail messages + fix-s
Adri Verhoef
ccea3 at rivm.UUCP
Fri Jun 3 02:58:07 AEST 1988
Ever since I installed the news software on our UNIX System V.3 machines,
we had a slight problem involving /bin/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 problem is that the mail 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<user><date>-line a newline
is inserted, so that the recipients of the mail, when reading their mail,
don't see the "Subject:" line, because this line is separated from the
From-line.
(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; 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 fixes to the news software follow.
NOTICE: If you are running System V.3, then you should #define MAIL_S
in defs.h (- with the help of localize.sh you should copy defs.dist
to defs.h and modify defs.h according to your needs. The modification
to defs.dist that I included here adds "/* define MAIL_S ... */", so
it does not #define MAIL_S; if you want to #define MAIL_S, you should
take out the "/* ". This will clear the problems involving `mail -s'.)
Here are the fixes:
*** ../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,879 -----
#endif /* MMDF */
execl("/usr/bin/mail", "mail", sendto, (char *)NULL);
execl("/usr/ucb/mail", "mail", sendto, (char *)NULL);
! execl("/bin/mail", "mail", MAIL_S sendto, (char *)NULL);
execl("/usr/bin/mailx", "mail", sendto, (char *)NULL);
_exit(1);
}
*** ../old/defs.dist
--- defs.dist
**************
*** 39,44
#define HISTEXP 4*WEEKS /* default no. of seconds to forget in */
#define DFLTSUB "general,all.announce" /* default subscription list */
#define TMAIL "/usr/ucb/Mail" /* Mail program that understands -T */
#define ADMSUB "general,all.announce" /* Mandatory subscription list */
#define PAGE "/usr/ucb/more" /* Default pager */
#define NOTIFY "usenet" /* Tell him about certain ctl messages */
--- 39,45 -----
#define HISTEXP 4*WEEKS /* default no. of seconds to forget in */
#define DFLTSUB "general,all.announce" /* default subscription list */
#define TMAIL "/usr/ucb/Mail" /* Mail program that understands -T */
+ /* #define MAIL_S "-s", /* /bin/mail -s suppresses extra newline*/
#define ADMSUB "general,all.announce" /* Mandatory subscription list */
#define PAGE "/usr/ucb/more" /* Default pager */
#define NOTIFY "usenet" /* Tell him about certain ctl messages */
*** ../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 MAIL_S
+ MAILER = "/bin/mail -s"; /* was /bin/mail */
+ #else /* !MAIL_S */
MAILER = "mail"; /* was /bin/mail */
+ #endif /* !MAIL_S */
#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,36 -----
#ifndef MAILER
#define MAILER "/bin/mail"
#endif
+ #ifndef MAIL_S
+ #define MAIL_S /* empty */
+ #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);
}
--- 220,226 -----
(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 MAIL_S
+ (void) sprintf(buffer, "/bin/mail -s %s", *argv);
+ #else /* !MAIL_S */
(void) sprintf(buffer, "/bin/mail %s", *argv);
+ #endif /* !MAIL_S */
#endif /* !M_XENIX */
#endif /* !SENDMAIL */
#endif
More information about the Comp.sys.att
mailing list