812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
|
**
** On windows, transform the output into the current terminal encoding
** if the output is going to the screen. If output is redirected into
** a file, no translation occurs. No translation ever occurs on unix.
*/
void fossil_puts(const char *z, int toStdErr){
#if defined(_WIN32)
static int once = 1;
static int istty[2];
char *zToFree = 0;
if( once ){
istty[0] = _isatty(fileno(stdout));
istty[1] = _isatty(fileno(stderr));
once = 0;
}
assert( toStdErr==0 || toStdErr==1 );
if( istty[toStdErr] ) z = zToFree = fossil_utf8_to_console(z);
fwrite(z, 1, strlen(z), toStdErr ? stderr : stdout);
free(zToFree);
#else
fwrite(z, 1, strlen(z), toStdErr ? stderr : stdout);
#endif
fflush(toStdErr ? stderr : stdout);
}
/*
** Write output for user consumption. If g.cgiOutput is enabled, then
** send the output as part of the CGI reply. If g.cgiOutput is false,
** then write on standard output.
|
<
<
<
|
<
<
|
>
<
<
<
<
<
|
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
|
**
** On windows, transform the output into the current terminal encoding
** if the output is going to the screen. If output is redirected into
** a file, no translation occurs. No translation ever occurs on unix.
*/
void fossil_puts(const char *z, int toStdErr){
#if defined(_WIN32)
if( fossil_utf8_to_console(z, strlen(z), toStdErr) >= 0 ){
return;
}
#endif
assert( toStdErr==0 || toStdErr==1 );
fwrite(z, 1, strlen(z), toStdErr ? stderr : stdout);
fflush(toStdErr ? stderr : stdout);
}
/*
** Write output for user consumption. If g.cgiOutput is enabled, then
** send the output as part of the CGI reply. If g.cgiOutput is false,
** then write on standard output.
|