From 6938a097fb6c1cda197b18f868808c860e832bb9 Mon Sep 17 00:00:00 2001
From: Jonathan McDowell <noodles@earth.li>
Date: Mon, 31 May 2004 23:48:09 +0000
Subject: [PATCH 1/1] cscvs to tla changeset 113 Author: noodles Date:
 2003/11/01 19:23:38 Fix extra LF when the last line of the key is a full
 line.

---
 armor.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/armor.c b/armor.c
index f2e97fc..e24787e 100644
--- a/armor.c
+++ b/armor.c
@@ -5,7 +5,7 @@
  *
  * Copyright 2002 Project Purple
  *
- * $Id: armor.c,v 1.7 2003/09/30 20:40:10 noodles Exp $
+ * $Id: armor.c,v 1.8 2003/11/01 19:23:38 noodles Exp $
  */
 
 #include <assert.h>
@@ -102,16 +102,28 @@ static void armor_finish(struct armor_context *state)
 		state->putchar_func(state->ctx, 1, &c);
 		state->putchar_func(state->ctx, 1, (unsigned char *) "=");
 		state->putchar_func(state->ctx, 1, (unsigned char *) "=");
+		state->count += 3;
+		if ((state->count % ARMOR_WIDTH) == 0) {
+			state->putchar_func(state->ctx, 1,
+				 (unsigned char *) "\n");
+		}
 		break;
 	case 2:
 		c = encode64((state->lastoctet & 0xF) << 2);
 		state->putchar_func(state->ctx, 1, &c);
 		state->putchar_func(state->ctx, 1, (unsigned char *) "=");
+		state->count += 2;
+		if ((state->count % ARMOR_WIDTH) == 0) {
+			state->putchar_func(state->ctx, 1,
+				 (unsigned char *) "\n");
+		}
 		break;
 	}
 
 	state->crc24 &= 0xffffffL;
-	state->putchar_func(state->ctx, 1, (unsigned char *) "\n");
+	if ((state->count % ARMOR_WIDTH) != 0) {
+		state->putchar_func(state->ctx, 1, (unsigned char *) "\n");
+	}
 	state->putchar_func(state->ctx, 1, (unsigned char *) "=");
 	c = encode64(state->crc24 >> 18);
 	state->putchar_func(state->ctx, 1, &c);
-- 
2.39.5