summaryrefslogtreecommitdiff
path: root/lib-src/fakemail.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1989-01-25 06:54:36 +0000
committerRichard M. Stallman <rms@gnu.org>1989-01-25 06:54:36 +0000
commita492a5b96c24174b191ee72467fb63e64971aecc (patch)
tree7fb2f67d8dafd44e7b322c3747fd71f58f8954d9 /lib-src/fakemail.c
parent497d1817d9f8fc369c8227835764dc50484e4c36 (diff)
downloademacs-a492a5b96c24174b191ee72467fb63e64971aecc.tar.gz
*** empty log message ***
Diffstat (limited to 'lib-src/fakemail.c')
-rw-r--r--lib-src/fakemail.c40
1 files changed, 37 insertions, 3 deletions
diff --git a/lib-src/fakemail.c b/lib-src/fakemail.c
index d055c7f38e7..19b053abaa3 100644
--- a/lib-src/fakemail.c
+++ b/lib-src/fakemail.c
@@ -401,15 +401,49 @@ put_string (s)
}
void
-put_line (s)
- char *s;
+put_line (string)
+ char *string;
{
register stream_list rem;
for (rem = the_streams;
rem != ((stream_list) NULL);
rem = rem->rest_streams)
{
- fputs (s, rem->handle);
+ char *s = string;
+ int column = 0;
+
+ /* Divide STRING into lines. */
+ while (*s != 0)
+ {
+ char *breakpos;
+
+ /* Find the last char that fits. */
+ for (breakpos = s; *breakpos && column < 78; ++breakpos)
+ {
+ if (*breakpos == '\t')
+ column += 8;
+ else
+ column++;
+ }
+ /* Back up to just after the last comma that fits. */
+ while (breakpos != s && breakpos[-1] != ',') --breakpos;
+ if (breakpos == s)
+ {
+ /* If no comma fits, move past the first address anyway. */
+ while (*breakpos != 0 && *breakpos != ',') ++breakpos;
+ if (*breakpos != 0)
+ /* Include the comma after it. */
+ ++breakpos;
+ }
+ /* Output that much, then break the line. */
+ fwrite (s, 1, breakpos - s, rem->handle);
+ fputs ("\n\t", rem->handle);
+ column = 8;
+
+ /* Skip whitespace and prepare to print more addresses. */
+ s = breakpos;
+ while (*s == ' ' || *s == '\t') ++s;
+ }
putc ('\n', rem->handle);
}
return;