]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/src/engine/output.cpp
2 Copyright 2007 Rene Rivera
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
14 #define bjam_out (stdout)
15 #define bjam_err (stderr)
17 static void out_( char const * data
, FILE * const io
)
21 size_t const len
= strcspn( data
, "\r" );
22 data
+= fwrite( data
, 1, len
, io
);
23 if ( *data
== '\r' ) ++data
;
31 if ( globs
.out
) fflush( globs
.out
);
36 if ( globs
.out
) fflush( globs
.out
);
38 void out_puts(char const * const s
)
41 if ( globs
.out
) fputs( s
, globs
.out
);
43 void err_puts(char const * const s
)
46 if ( globs
.out
) fputs( s
, globs
.out
);
48 void out_putc(const char c
)
51 if ( globs
.out
) fputc( c
, globs
.out
);
53 void err_putc(const char c
)
56 if ( globs
.out
) fputc( c
, globs
.out
);
58 void out_data(char const * const s
)
61 if ( globs
.out
) out_( s
, globs
.out
);
63 void err_data(char const * const s
)
66 if ( globs
.out
) out_( s
, globs
.out
);
68 void out_printf(char const * const f
, ...)
73 vfprintf( bjam_out
, f
, args
);
80 vfprintf( globs
.out
, f
, args
);
84 void err_printf(char const * const f
, ...)
89 vfprintf( bjam_err
, f
, args
);
96 vfprintf( globs
.out
, f
, args
);
104 char const * const action
,
105 char const * const target
,
106 char const * const command
,
107 char const * const out_d
,
108 char const * const err_d
,
109 int const exit_reason
112 /* Print out the action + target line, if the action is quiet the action
116 out_printf( "%s %s\n", action
, target
);
118 /* Print out the command executed if given -d+2. */
125 /* Print out the command output, if requested, or if the program failed, but
126 * only output for non-quiet actions.
128 if ( action
|| exit_reason
!= EXIT_OK
)
131 ( ( globs
.pipe_action
& 1 /* STDOUT_FILENO */ ) ||
132 ( globs
.pipe_action
== 0 ) ) )
134 if ( err_d
&& ( globs
.pipe_action
& 2 /* STDERR_FILENO */ ) )
140 OBJECT
* outf_int( int const value
)
143 sprintf( buffer
, "%i", value
);
144 return object_new( buffer
);
148 OBJECT
* outf_double( double const value
)
151 sprintf( buffer
, "%f", value
);
152 return object_new( buffer
);
156 OBJECT
* outf_time( timestamp
const * const time
)
158 return object_new( timestamp_str( time
) );