flush stdout more

to make sure it is timely written and not interleaved with stderr even
when when redirected.
This commit is contained in:
Oswald Buddenhagen 2012-09-22 17:48:09 +02:00
parent d7eae525bd
commit 8dbb3fe7a9
3 changed files with 9 additions and 2 deletions

View File

@ -250,6 +250,7 @@ send_imap_cmd( imap_store_t *ctx, struct imap_cmd *cmd )
printf( ">>> %s", buf ); printf( ">>> %s", buf );
else else
printf( ">>> %d LOGIN <user> <pass>\n", cmd->tag ); printf( ">>> %d LOGIN <user> <pass>\n", cmd->tag );
fflush( stdout );
} }
if (socket_write( &ctx->conn, buf, bufl, KeepOwn ) < 0) if (socket_write( &ctx->conn, buf, bufl, KeepOwn ) < 0)
goto bail; goto bail;
@ -573,6 +574,7 @@ parse_imap_list( imap_store_t *ctx, char **sp, parse_list_state_t *sts )
puts( "=========" ); puts( "=========" );
fwrite( cur->val, cur->len, 1, stdout ); fwrite( cur->val, cur->len, 1, stdout );
puts( "=========" ); puts( "=========" );
fflush( stdout );
} }
getline: getline:
@ -1185,8 +1187,10 @@ do_cram_auth( imap_store_t *ctx, struct imap_cmd *cmdp, const char *prompt )
cram( prompt, srvc->user, srvc->pass, &resp, &l ); cram( prompt, srvc->user, srvc->pass, &resp, &l );
if (DFlags & VERBOSE) if (DFlags & VERBOSE) {
printf( ">+> %s\n", resp ); printf( ">+> %s\n", resp );
fflush( stdout );
}
return socket_write( &ctx->conn, resp, l, GiveOwn ); return socket_write( &ctx->conn, resp, l, GiveOwn );
} }
#endif #endif

View File

@ -539,8 +539,10 @@ socket_read_line( conn_t *b )
if (p != s && p[-1] == '\r') if (p != s && p[-1] == '\r')
p--; p--;
*p = 0; *p = 0;
if (DFlags & VERBOSE) if (DFlags & VERBOSE) {
puts( s ); puts( s );
fflush( stdout );
}
return s; return s;
} }

View File

@ -37,6 +37,7 @@ flushn( void )
{ {
if (need_nl) { if (need_nl) {
putchar( '\n' ); putchar( '\n' );
fflush( stdout );
need_nl = 0; need_nl = 0;
} }
} }