Diff
Not logged in

Differences From Artifact [0b747a77c1]:

To Artifact [7a4d5d41eb]:


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
841
842
843
844
845
846
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
841
842

843
844
845
846
847

848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865







+
+
+
+
+
+
+
+








+
+
+

-
+




-
+


+
+
+
+
+
+
+
+







}
void fossil_error_reset(void){
  free(g.zErrMsg);
  g.zErrMsg = 0;
  g.iErrPriority = 0;
}

/* True if the last character standard output cursor is setting at
** the beginning of a blank link.  False if a \r has been to move the
** cursor to the beginning of the line or if not at the beginning of
** a line.
** was a \n
*/
static int stdoutAtBOL = 1;

/*
** Write to standard output or standard error.
**
** 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){
  int n = (int)strlen(z);
  if( n==0 ) return;
  if( toStdErr==0 ) stdoutAtBOL = (z[n-1]=='\n');
#if defined(_WIN32)
  if( fossil_utf8_to_console(z, strlen(z), toStdErr) >= 0 ){
  if( fossil_utf8_to_console(z, n, toStdErr) >= 0 ){
    return;
  }
#endif
  assert( toStdErr==0 || toStdErr==1 );
  fwrite(z, 1, strlen(z), toStdErr ? stderr : stdout);
  fwrite(z, 1, n, toStdErr ? stderr : stdout);
  fflush(toStdErr ? stderr : stdout);
}

/*
** Force the the standard output cursor to move to the beginning 
** of a line, if it is not there already.
*/
void fossil_force_newline(void){
  if( g.cgiOutput==0 && stdoutAtBOL==0 ) fossil_puts("\n", 0);
}

/*
** 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.
*/
void fossil_print(const char *zFormat, ...){