Browse Source

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.
wip/maildir-uid-dupes-test
Oswald Buddenhagen 12 years ago
parent
commit
7c815538ab
  1. 6
      src/socket.c
  2. 2
      src/sync.c
  3. 17
      src/util.c

6
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;

2
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] );
}
}

17
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;
}
}

Loading…
Cancel
Save