changeset 5959:e4337a7bbe32

(put_line): Don't break the line if it all fits.
author Richard M. Stallman <rms@gnu.org>
date Wed, 16 Feb 1994 20:53:00 +0000
parents 64fa4e0f3fce
children ce4b18e394a2
files lib-src/fakemail.c
diffstat 1 files changed, 14 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/fakemail.c	Wed Feb 16 18:23:16 1994 +0000
+++ b/lib-src/fakemail.c	Wed Feb 16 20:53:00 1994 +0000
@@ -421,7 +421,7 @@
 	{
 	  char *breakpos;
 
-	  /* Find the last char that fits. */
+	  /* Find the last char that fits.  */
 	  for (breakpos = s; *breakpos && column < 78; ++breakpos)
 	    {
 	      if (*breakpos == '\t')
@@ -429,15 +429,20 @@
 	      else
 		column++;
 	    }
-	  /* Back up to just after the last comma that fits.  */
-	  while (breakpos != s && breakpos[-1] != ',') --breakpos;
-	  if (breakpos == s)
+	  /* If we didn't reach end of line, break the line.  */
+	  if (*breakpos)
 	    {
-	      /* If no comma fits, move past the first address anyway.  */
-	      while (*breakpos != 0 && *breakpos != ',') ++breakpos;
-	      if (*breakpos != 0)
-		/* Include the comma after it.  */
-		++breakpos;
+	      /* 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);