From 897262d76eaeb37c8976b5c92a4ad5594b6f01a0 Mon Sep 17 00:00:00 2001
From: Koen Holtman <koen.holtman@ieee.org>
Date: Mon, 12 Nov 2012 23:04:49 +0100
Subject: [PATCH 5/5] fix -o -0 -vv formatting bug

---
 HISTORY |  3 +++
 afio.c  | 16 +++++++---------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/HISTORY b/HISTORY
index 92b3c2d..78d5476 100644
--- a/HISTORY
+++ b/HISTORY
@@ -992,3 +992,6 @@ Fixed two compiler errors (as reported by recent gcc) due to
 discrepancies between function declarations in afio.h and afio.c.
 Problem reported by Jari Aalto.  Added some more size_t and ssize_t.
 
+Fixed formatting bug to restore output behavior of afio -o -0 -vv like
+it was in afio 2.5.  Based on bug report by Corey Mann.  Closes Debian
+bug #420654.
diff --git a/afio.c b/afio.c
index c9092ba..2875348 100644
--- a/afio.c
+++ b/afio.c
@@ -4684,15 +4684,13 @@ tocentry (name, asb)
     else
       namedot = 0;
 
-    if (ISCONTROL(asb))
-	res = printf("//--%s",name);
+    if (ISCONTROL(asb))	res = printf("//--");
+
+    if ((!useoutmodetoc) && flag0)
+      res = printf ("%s%c", name, 0);
     else
-     {
-	if (flag0)
-		res = printf ("%s%c", name, 0);
-	else
-		res = printf ("%s", name);
-     }
+      res = printf ("%s", name);
+    
     /* to find out about broken pipe as early as possible */
     if(res > 0) res = fflush(stdout);
     /* check for broken pipe on stdout, this ends the listing */
@@ -4752,7 +4750,7 @@ tocentry (name, asb)
 #endif /* S_IFLNK */
     }
 
-  if (!flag0)
+  if ((!flag0)||useoutmodetoc)
     putchar ('\n');
 }
 
-- 
2.3.4

