Arpanetish messages
SCCS-vsn: usr.bin/mail/send.c 1.4
#ifdef VMUNIX
#include <wait.h>
#endif
#ifdef VMUNIX
#include <wait.h>
#endif
/*
* Mail -- a mail program
/*
* Mail -- a mail program
-static char *SccsId = "@(#)send.c 1.3 %G%";
+static char *SccsId = "@(#)send.c 1.4 %G%";
/*
* Send message described by the passed pointer to the
/*
* Send message described by the passed pointer to the
unsigned int c;
FILE *ibuf;
char line[LINESIZE];
unsigned int c;
FILE *ibuf;
char line[LINESIZE];
+ int lc, ishead, infld, fline;
mp = mailp;
ibuf = setinput(mp);
c = msize(mp);
ishead = (mailp->m_flag & MSTATUS) != 0;
mp = mailp;
ibuf = setinput(mp);
c = msize(mp);
ishead = (mailp->m_flag & MSTATUS) != 0;
+ infld = 0;
+ fline = 1;
lc = 0;
while (c > 0) {
fgets(line, LINESIZE, ibuf);
c -= strlen(line);
lc++;
if (ishead) {
lc = 0;
while (c > 0) {
fgets(line, LINESIZE, ibuf);
c -= strlen(line);
lc++;
if (ishead) {
+ if (fline) {
+ fline = 0;
+ goto writeit;
+ }
if (line[0] == '\n') {
statusput(mailp, obuf);
ishead = 0;
goto writeit;
}
if (line[0] == '\n') {
statusput(mailp, obuf);
ishead = 0;
goto writeit;
}
- if (index(line, ':') == 0)
+ if (isspace(line[0]) && infld)
+ goto writeit;
+ infld = 0;
+ if (!headerp(line)) {
+ statusput(mailp, obuf);
+ putc('\n', obuf);
+ ishead = 0;
if (icisname(line, "status", 6)) {
statusput(mailp, obuf);
ishead = 0;
if (icisname(line, "status", 6)) {
statusput(mailp, obuf);
ishead = 0;
+/*
+ * Test if the passed line is a header line, RFC 733 style.
+ */
+headerp(line)
+ register char *line;
+{
+ register char *cp = line;
+
+ while (*cp && !isspace(*cp) && *cp != ':')
+ cp++;
+ while (*cp && isspace(*cp))
+ cp++;
+ return(*cp == ':');
+}
+
/*
* Output a reasonable looking status field.
*/
/*
* Output a reasonable looking status field.
*/