]> xenbits.xensource.com Git - xen.git/commitdiff
figlet: Fix handling of full final line of octal output.
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 23 Apr 2008 08:02:15 +0000 (09:02 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 23 Apr 2008 08:02:15 +0000 (09:02 +0100)
It should not be terminated with a backslash.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/tools/figlet/figlet.c

index 5d02ad51fdb1a4e8b7951f9c1738bd867ba369aa..4232a91a72b5de22cd12e337bcc3d561db3a1a68 100644 (file)
@@ -1488,7 +1488,16 @@ static void myputchar(unsigned char c)
 
     putc(c, stderr);
 
-    if ( nr_chars == 0 )
+    if ( nr_chars == 18 ) 
+    {
+        nr_chars = 0;
+        putchar('"');
+        putchar(' ');
+        putchar('\\');
+        putchar('\n');
+    }
+
+    if ( nr_chars++ == 0 )
         putchar('"');
 
     putchar('\\');
@@ -1498,15 +1507,6 @@ static void myputchar(unsigned char c)
 
     if ( c == '\n' )
         startline = 1;
-
-    if ( ++nr_chars == 18 ) 
-    {
-        nr_chars = 0;
-        putchar('"');
-        putchar(' ');
-        putchar('\\');
-        putchar('\n');
-    }
 }
 
 void putstring(string)