Send fixed to supress continuation lines in ignored fields.
[unix-history] / usr / src / usr.bin / mail / send.c
index b87b841..1864888 100644 (file)
@@ -12,7 +12,7 @@
  * Mail to others.
  */
 
  * Mail to others.
  */
 
-static char *SccsId = "@(#)send.c      2.4 %G%";
+static char *SccsId = "@(#)send.c      2.7 %G%";
 
 /*
  * Send message described by the passed pointer to the
 
 /*
  * Send message described by the passed pointer to the
@@ -26,7 +26,7 @@ send(mailp, obuf, doign)
 {
        register struct message *mp;
        register int t;
 {
        register struct message *mp;
        register int t;
-       unsigned int c;
+       long c;
        FILE *ibuf;
        char line[LINESIZE], field[BUFSIZ];
        int lc, ishead, infld, fline, dostat;
        FILE *ibuf;
        char line[LINESIZE], field[BUFSIZ];
        int lc, ishead, infld, fline, dostat;
@@ -34,15 +34,15 @@ send(mailp, obuf, doign)
 
        mp = mailp;
        ibuf = setinput(mp);
 
        mp = mailp;
        ibuf = setinput(mp);
-       c = msize(mp);
+       c = mp->m_size;
        ishead = 1;
        dostat = 1;
        infld = 0;
        fline = 1;
        lc = 0;
        ishead = 1;
        dostat = 1;
        infld = 0;
        fline = 1;
        lc = 0;
-       while (c > 0) {
+       while (c > 0L) {
                fgets(line, LINESIZE, ibuf);
                fgets(line, LINESIZE, ibuf);
-               c -= strlen(line);
+               c -= (long) strlen(line);
                lc++;
                if (ishead) {
                        /* 
                lc++;
                if (ishead) {
                        /* 
@@ -68,11 +68,14 @@ send(mailp, obuf, doign)
                                goto writeit;
                        }
                        /*
                                goto writeit;
                        }
                        /*
-                        * If this line is a continuation
-                        * of a previous header field, just echo it.
+                        * If this line is a continuation (via space or tab)
+                        * of a previous header field, just echo it
+                        * (unless the field should be ignored).
                         */
                         */
-                       if (isspace(line[0]) && infld)
+                       if (infld && (isspace(line[0]) || line[0] == '\t')) {
+                               if (doign && isign(field)) continue;
                                goto writeit;
                                goto writeit;
+                       }
                        infld = 0;
                        /*
                         * If we are no longer looking at real
                        infld = 0;
                        /*
                         * If we are no longer looking at real
@@ -334,7 +337,12 @@ topdog:
         */
 
 #ifdef VMUNIX
         */
 
 #ifdef VMUNIX
+#ifdef pdp11
+       while (wait2(&s, WNOHANG) > 0)
+#endif
+#ifdef vax
        while (wait3(&s, WNOHANG, 0) > 0)
        while (wait3(&s, WNOHANG, 0) > 0)
+#endif
                ;
 #else
        wait(&s);
                ;
 #else
        wait(&s);