From a8833aa01d94f8a87d396f38a0ee535aa37343d9 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Wed, 8 Jul 2009 03:17:48 +0000 Subject: [PATCH] * b2m.c (main): Ensure that each message ends in two newlines. --- lib-src/ChangeLog | 4 ++++ lib-src/b2m.c | 17 ++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index f30b92d5486..548d5dbb5d4 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,7 @@ +2009-07-08 E. Jay Berkenbilt (tiny change) + + * b2m.c (main): Ensure that each message ends in two newlines. + 2009-07-03 Eli Zaretskii * makefile.w32-in (WINNT_SUPPORT): Add term/common-win.elc, like diff --git a/lib-src/b2m.c b/lib-src/b2m.c index a3ab9a5bb9a..7de48e6a522 100644 --- a/lib-src/b2m.c +++ b/lib-src/b2m.c @@ -94,7 +94,7 @@ main (argc, argv) int argc; char **argv; { - logical labels_saved, printing, header; + logical labels_saved, printing, header, first, last_was_blank_line; time_t ltoday; struct tm *tm; char *labels, *p, *today; @@ -139,7 +139,8 @@ main (argc, argv) exit (EXIT_SUCCESS); } - labels_saved = printing = header = FALSE; + labels_saved = printing = header = last_was_blank_line = FALSE; + first = TRUE; ltoday = time (0); /* Convert to a string, checking for out-of-range time stamps. Don't use 'ctime', as that might dump core if the hardware clock @@ -170,6 +171,10 @@ main (argc, argv) continue; else if (data.buffer[1] == '\f') { + if (first) + first = FALSE; + else if (! last_was_blank_line) + puts(""); /* Save labels. */ readline (&data, stdin); p = strtok (data.buffer, " ,\r\n\t"); @@ -195,7 +200,13 @@ main (argc, argv) } if (printing) - puts (data.buffer); + { + puts (data.buffer); + if (data.buffer[0] == '\0') + last_was_blank_line = TRUE; + else + last_was_blank_line = FALSE; + } } return EXIT_SUCCESS; -- 2.39.2