commit 827fdbdc5df38149edf11bdfc85ba555c0045af2
Author: Oswald Buddenhagen <o...@kde.org>
Date:   Sat Sep 1 17:21:32 2012 +0200

    fix line wrapping before info messages
    
    unless an info message is explictly marked as a continuation, it must
    terminate any pending line (typically the progress information) first.
    
    debug output is not affected, as it is mutually exclusive with info
    output, and no debug lines are left unterminated outside clear scopes.

 src/socket.c |    6 +++---
 src/sync.c   |    2 +-
 src/util.c   |   17 +++++++++++++----
 3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/socket.c b/src/socket.c
index ca44bb3..f9c8a05 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -374,7 +374,7 @@ socket_connect( conn_t *sock, void (*cb)( int ok, void *aux 
) )
                        error( "IMAP error: Cannot resolve server '%s'\n", 
conf->host );
                        goto bail;
                }
-               info( "ok\n" );
+               info( "\vok\n" );
 
                addr.sin_addr.s_addr = *((int *)he->h_addr_list[0]);
 
@@ -398,12 +398,12 @@ socket_connect( conn_t *sock, void (*cb)( int ok, void 
*aux ) )
                        }
                        conf_fd( s, 0, POLLOUT );
                        sock->state = SCK_CONNECTING;
-                       info( "\n" );
+                       info( "\v\n" );
                        return;
                }
 
        }
-       info( "ok\n" );
+       info( "\vok\n" );
        socket_connected2( sock );
        return;
 
diff --git a/src/sync.c b/src/sync.c
index d8c9af8..f951a7c 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -419,7 +419,7 @@ stats( sync_vars_t *svars )
                        if (l > cols)
                                buf[t][cols - 1] = '~';
                }
-               infon( "\rM: %.*s  S: %.*s", cols, buf[0], cols, buf[1] );
+               infon( "\v\rM: %.*s  S: %.*s", cols, buf[0], cols, buf[1] );
        }
 }
 
diff --git a/src/util.c b/src/util.c
index 83b7a76..d3f1638 100644
--- a/src/util.c
+++ b/src/util.c
@@ -43,6 +43,17 @@ flushn( void )
        }
 }
 
+static void
+printn( const char *msg, va_list va )
+{
+       if (*msg == '\v')
+               msg++;
+       else
+               flushn();
+       vprintf( msg, va );
+       fflush( stdout );
+}
+
 void
 debug( const char *msg, ... )
 {
@@ -78,9 +89,8 @@ info( const char *msg, ... )
 
        if (!(DFlags & QUIET)) {
                va_start( va, msg );
-               vprintf( msg, va );
+               printn( msg, va );
                va_end( va );
-               fflush( stdout );
                need_nl = 0;
        }
 }
@@ -92,9 +102,8 @@ infon( const char *msg, ... )
 
        if (!(DFlags & QUIET)) {
                va_start( va, msg );
-               vprintf( msg, va );
+               printn( msg, va );
                va_end( va );
-               fflush( stdout );
                need_nl = 1;
        }
 }

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to