From: Rein Tollevik Date: Thu, 26 Mar 2009 22:50:54 +0000 (+0000) Subject: ITS#6038: Write slapadd progress meter to stdout. X-Git-Tag: ACLCHECK_0~653 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c8cf2fc47a96a288f5efe875bc9b2b6325093269;p=openldap ITS#6038: Write slapadd progress meter to stdout. --- diff --git a/libraries/liblutil/meter.c b/libraries/liblutil/meter.c index 0bbbdc0307..15e6832bb6 100644 --- a/libraries/liblutil/meter.c +++ b/libraries/liblutil/meter.c @@ -214,7 +214,7 @@ text_open (void ** display_datap) data->buffer_length = default_buffer_length; data->buffer = calloc( 1, default_buffer_length ); assert( data->buffer != NULL ); - data->output = stderr; + data->output = stdout; *display_datap = data; return 0; } @@ -314,6 +314,7 @@ text_update ( (void) fprintf( data->output, "\r%-79s", data->buffer ); + (void) fflush( data->output ); data->need_eol = 1; return 0; } diff --git a/servers/slapd/slapadd.c b/servers/slapd/slapadd.c index a6cf3a2e21..38d5b89253 100644 --- a/servers/slapd/slapadd.c +++ b/servers/slapd/slapadd.c @@ -76,7 +76,7 @@ slapadd( int argc, char **argv ) /* default "000" */ csnsid = 0; - if ( isatty (2) ) enable_meter = 1; + if ( isatty (1) ) enable_meter = 1; slap_tool_init( progname, SLAPADD, argc, argv ); memset( &opbuf, 0, sizeof(opbuf) ); @@ -506,7 +506,7 @@ slapadd( int argc, char **argv ) if ( !dryrun ) { if ( enable_meter ) { - fprintf( stderr, "Closing DB..." ); + fprintf( stdout, "Closing DB..." ); } if( be->be_entry_close( be ) ) { rc = EXIT_FAILURE; @@ -516,7 +516,7 @@ slapadd( int argc, char **argv ) be->be_sync( be ); } if ( enable_meter ) { - fprintf( stderr, "\n" ); + fprintf( stdout, "\n" ); } }