Fossil SCM

Infrastructure changes that will allow the client-side sync to be run from a web interface - the status messages now go to CGI output if the sync is run from a web page. This is a partial implementation of the "SyncNow" button. The button itself has not yet been added.

drh 2010-04-22 15:48 trunk
Commit c56af61e5e40db613bd649b676ce72810367435d
+2 -2
--- src/db.c
+++ src/db.c
@@ -76,12 +76,12 @@
7676
if( g.xferPanic ){
7777
cgi_reset_content();
7878
@ error Database\serror:\s%F(z)
7979
cgi_reply();
8080
}
81
- if( g.cgiPanic ){
82
- g.cgiPanic = 0;
81
+ if( g.cgiOutput ){
82
+ g.cgiOutput = 0;
8383
cgi_printf("<h1>Database Error</h1>\n"
8484
"<pre>%h</pre><p>%s</p>", z, zRebuildMsg);
8585
cgi_reply();
8686
}else{
8787
fprintf(stderr, "%s: %s\n\n%s", g.argv[0], z, zRebuildMsg);
8888
--- src/db.c
+++ src/db.c
@@ -76,12 +76,12 @@
76 if( g.xferPanic ){
77 cgi_reset_content();
78 @ error Database\serror:\s%F(z)
79 cgi_reply();
80 }
81 if( g.cgiPanic ){
82 g.cgiPanic = 0;
83 cgi_printf("<h1>Database Error</h1>\n"
84 "<pre>%h</pre><p>%s</p>", z, zRebuildMsg);
85 cgi_reply();
86 }else{
87 fprintf(stderr, "%s: %s\n\n%s", g.argv[0], z, zRebuildMsg);
88
--- src/db.c
+++ src/db.c
@@ -76,12 +76,12 @@
76 if( g.xferPanic ){
77 cgi_reset_content();
78 @ error Database\serror:\s%F(z)
79 cgi_reply();
80 }
81 if( g.cgiOutput ){
82 g.cgiOutput = 0;
83 cgi_printf("<h1>Database Error</h1>\n"
84 "<pre>%h</pre><p>%s</p>", z, zRebuildMsg);
85 cgi_reply();
86 }else{
87 fprintf(stderr, "%s: %s\n\n%s", g.argv[0], z, zRebuildMsg);
88
+6 -1
--- src/http.c
+++ src/http.c
@@ -55,11 +55,16 @@
5555
sha1sum_blob(pPayload, &nonce);
5656
blob_copy(&pw, &nonce);
5757
zLogin = g.urlUser;
5858
if( g.urlPasswd ){
5959
zPw = g.urlPasswd;
60
+ }else if( g.cgiOutput ){
61
+ /* Password failure while doing a sync from the web interface */
62
+ cgi_printf("*** incorrect or missing password for user %h\n", zLogin);
63
+ zPw = 0;
6064
}else{
65
+ /* Password failure while doing a sync from the command-line interface */
6166
url_prompt_for_password();
6267
zPw = g.urlPasswd;
6368
if( !g.dontKeepUrl ) db_set("last-sync-pw", zPw, 0);
6469
}
6570
@@ -223,11 +228,11 @@
223228
int i, j;
224229
for(i=9; zLine[i] && zLine[i]==' '; i++){}
225230
if( zLine[i]==0 ) fossil_fatal("malformed redirect: %s", zLine);
226231
j = strlen(zLine) - 1;
227232
if( j>4 && strcmp(&zLine[j-4],"/xfer")==0 ) zLine[j-4] = 0;
228
- printf("redirect to %s\n", &zLine[i]);
233
+ fossil_print("redirect to %s\n", &zLine[i]);
229234
url_parse(&zLine[i]);
230235
transport_close();
231236
http_exchange(pSend, pReply, useLogin);
232237
return;
233238
}
234239
--- src/http.c
+++ src/http.c
@@ -55,11 +55,16 @@
55 sha1sum_blob(pPayload, &nonce);
56 blob_copy(&pw, &nonce);
57 zLogin = g.urlUser;
58 if( g.urlPasswd ){
59 zPw = g.urlPasswd;
 
 
 
 
60 }else{
 
61 url_prompt_for_password();
62 zPw = g.urlPasswd;
63 if( !g.dontKeepUrl ) db_set("last-sync-pw", zPw, 0);
64 }
65
@@ -223,11 +228,11 @@
223 int i, j;
224 for(i=9; zLine[i] && zLine[i]==' '; i++){}
225 if( zLine[i]==0 ) fossil_fatal("malformed redirect: %s", zLine);
226 j = strlen(zLine) - 1;
227 if( j>4 && strcmp(&zLine[j-4],"/xfer")==0 ) zLine[j-4] = 0;
228 printf("redirect to %s\n", &zLine[i]);
229 url_parse(&zLine[i]);
230 transport_close();
231 http_exchange(pSend, pReply, useLogin);
232 return;
233 }
234
--- src/http.c
+++ src/http.c
@@ -55,11 +55,16 @@
55 sha1sum_blob(pPayload, &nonce);
56 blob_copy(&pw, &nonce);
57 zLogin = g.urlUser;
58 if( g.urlPasswd ){
59 zPw = g.urlPasswd;
60 }else if( g.cgiOutput ){
61 /* Password failure while doing a sync from the web interface */
62 cgi_printf("*** incorrect or missing password for user %h\n", zLogin);
63 zPw = 0;
64 }else{
65 /* Password failure while doing a sync from the command-line interface */
66 url_prompt_for_password();
67 zPw = g.urlPasswd;
68 if( !g.dontKeepUrl ) db_set("last-sync-pw", zPw, 0);
69 }
70
@@ -223,11 +228,11 @@
228 int i, j;
229 for(i=9; zLine[i] && zLine[i]==' '; i++){}
230 if( zLine[i]==0 ) fossil_fatal("malformed redirect: %s", zLine);
231 j = strlen(zLine) - 1;
232 if( j>4 && strcmp(&zLine[j-4],"/xfer")==0 ) zLine[j-4] = 0;
233 fossil_print("redirect to %s\n", &zLine[i]);
234 url_parse(&zLine[i]);
235 transport_close();
236 http_exchange(pSend, pReply, useLogin);
237 return;
238 }
239
+10 -10
--- src/main.c
+++ src/main.c
@@ -78,11 +78,11 @@
7878
char *zTop; /* Parent directory of zPath */
7979
const char *zContentType; /* The content type of the input HTTP request */
8080
int iErrPriority; /* Priority of current error message */
8181
char *zErrMsg; /* Text of an error message */
8282
Blob cgiIn; /* Input to an xfer www method */
83
- int cgiPanic; /* Write error messages to CGI */
83
+ int cgiOutput; /* Write error and status messages to CGI */
8484
int xferPanic; /* Write error messages in XFER protocol */
8585
int fullHttpReply; /* True for full HTTP reply. False for CGI reply */
8686
Th_Interp *interp; /* The TH1 interpreter */
8787
FILE *httpIn; /* Accept HTTP input from here */
8888
FILE *httpOut; /* Send HTTP output here */
@@ -278,11 +278,11 @@
278278
static int once = 1;
279279
mainInFatalError = 1;
280280
va_start(ap, zFormat);
281281
z = vmprintf(zFormat, ap);
282282
va_end(ap);
283
- if( g.cgiPanic && once ){
283
+ if( g.cgiOutput && once ){
284284
once = 0;
285285
cgi_printf("<p><font color=\"red\">%h</font></p>", z);
286286
cgi_reply();
287287
}else{
288288
fprintf(stderr, "%s: %s\n", g.argv[0], z);
@@ -295,12 +295,12 @@
295295
va_list ap;
296296
mainInFatalError = 1;
297297
va_start(ap, zFormat);
298298
z = vmprintf(zFormat, ap);
299299
va_end(ap);
300
- if( g.cgiPanic ){
301
- g.cgiPanic = 0;
300
+ if( g.cgiOutput ){
301
+ g.cgiOutput = 0;
302302
cgi_printf("<p><font color=\"red\">%h</font></p>", z);
303303
cgi_reply();
304304
}else{
305305
fprintf(stderr, "%s: %s\n", g.argv[0], z);
306306
}
@@ -323,12 +323,12 @@
323323
if( mainInFatalError ) return;
324324
mainInFatalError = 1;
325325
va_start(ap, zFormat);
326326
z = vmprintf(zFormat, ap);
327327
va_end(ap);
328
- if( g.cgiPanic ){
329
- g.cgiPanic = 0;
328
+ if( g.cgiOutput ){
329
+ g.cgiOutput = 0;
330330
cgi_printf("<p><font color=\"red\">%h</font></p>", z);
331331
cgi_reply();
332332
}else{
333333
fprintf(stderr, "%s: %s\n", g.argv[0], z);
334334
}
@@ -342,11 +342,11 @@
342342
char *z;
343343
va_list ap;
344344
va_start(ap, zFormat);
345345
z = vmprintf(zFormat, ap);
346346
va_end(ap);
347
- if( g.cgiPanic ){
347
+ if( g.cgiOutput ){
348348
cgi_printf("<p><font color=\"red\">%h</font></p>", z);
349349
}else{
350350
fprintf(stderr, "%s: %s\n", g.argv[0], z);
351351
}
352352
}
@@ -811,11 +811,11 @@
811811
#ifdef __EMX__
812812
/* Similar hack for OS/2 */
813813
setmode(fileno(g.httpOut), O_BINARY);
814814
setmode(fileno(g.httpIn), O_BINARY);
815815
#endif
816
- g.cgiPanic = 1;
816
+ g.cgiOutput = 1;
817817
blob_read_from_file(&config, zFile);
818818
while( blob_line(&config, &line) ){
819819
if( !blob_token(&line, &key) ) continue;
820820
if( blob_buffer(&key)[0]=='#' ) continue;
821821
if( blob_eq(&key, "debug:") && blob_token(&line, &value) ){
@@ -909,11 +909,11 @@
909909
const char *zNotFound;
910910
zNotFound = find_option("notfound", 0, 1);
911911
if( g.argc!=2 && g.argc!=3 && g.argc!=6 ){
912912
cgi_panic("no repository specified");
913913
}
914
- g.cgiPanic = 1;
914
+ g.cgiOutput = 1;
915915
g.fullHttpReply = 1;
916916
if( g.argc==6 ){
917917
g.httpIn = fopen(g.argv[3], "rb");
918918
g.httpOut = fopen(g.argv[4], "wb");
919919
zIpAddr = g.argv[5];
@@ -1039,11 +1039,11 @@
10391039
g.httpIn = stdin;
10401040
g.httpOut = stdout;
10411041
if( g.fHttpTrace || g.fSqlTrace ){
10421042
fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
10431043
}
1044
- g.cgiPanic = 1;
1044
+ g.cgiOutput = 1;
10451045
find_server_repository(isUiCmd);
10461046
g.zRepositoryName = enter_chroot_jail(g.zRepositoryName);
10471047
cgi_handle_http_request(0);
10481048
process_one_web_page(zNotFound);
10491049
#else
10501050
--- src/main.c
+++ src/main.c
@@ -78,11 +78,11 @@
78 char *zTop; /* Parent directory of zPath */
79 const char *zContentType; /* The content type of the input HTTP request */
80 int iErrPriority; /* Priority of current error message */
81 char *zErrMsg; /* Text of an error message */
82 Blob cgiIn; /* Input to an xfer www method */
83 int cgiPanic; /* Write error messages to CGI */
84 int xferPanic; /* Write error messages in XFER protocol */
85 int fullHttpReply; /* True for full HTTP reply. False for CGI reply */
86 Th_Interp *interp; /* The TH1 interpreter */
87 FILE *httpIn; /* Accept HTTP input from here */
88 FILE *httpOut; /* Send HTTP output here */
@@ -278,11 +278,11 @@
278 static int once = 1;
279 mainInFatalError = 1;
280 va_start(ap, zFormat);
281 z = vmprintf(zFormat, ap);
282 va_end(ap);
283 if( g.cgiPanic && once ){
284 once = 0;
285 cgi_printf("<p><font color=\"red\">%h</font></p>", z);
286 cgi_reply();
287 }else{
288 fprintf(stderr, "%s: %s\n", g.argv[0], z);
@@ -295,12 +295,12 @@
295 va_list ap;
296 mainInFatalError = 1;
297 va_start(ap, zFormat);
298 z = vmprintf(zFormat, ap);
299 va_end(ap);
300 if( g.cgiPanic ){
301 g.cgiPanic = 0;
302 cgi_printf("<p><font color=\"red\">%h</font></p>", z);
303 cgi_reply();
304 }else{
305 fprintf(stderr, "%s: %s\n", g.argv[0], z);
306 }
@@ -323,12 +323,12 @@
323 if( mainInFatalError ) return;
324 mainInFatalError = 1;
325 va_start(ap, zFormat);
326 z = vmprintf(zFormat, ap);
327 va_end(ap);
328 if( g.cgiPanic ){
329 g.cgiPanic = 0;
330 cgi_printf("<p><font color=\"red\">%h</font></p>", z);
331 cgi_reply();
332 }else{
333 fprintf(stderr, "%s: %s\n", g.argv[0], z);
334 }
@@ -342,11 +342,11 @@
342 char *z;
343 va_list ap;
344 va_start(ap, zFormat);
345 z = vmprintf(zFormat, ap);
346 va_end(ap);
347 if( g.cgiPanic ){
348 cgi_printf("<p><font color=\"red\">%h</font></p>", z);
349 }else{
350 fprintf(stderr, "%s: %s\n", g.argv[0], z);
351 }
352 }
@@ -811,11 +811,11 @@
811 #ifdef __EMX__
812 /* Similar hack for OS/2 */
813 setmode(fileno(g.httpOut), O_BINARY);
814 setmode(fileno(g.httpIn), O_BINARY);
815 #endif
816 g.cgiPanic = 1;
817 blob_read_from_file(&config, zFile);
818 while( blob_line(&config, &line) ){
819 if( !blob_token(&line, &key) ) continue;
820 if( blob_buffer(&key)[0]=='#' ) continue;
821 if( blob_eq(&key, "debug:") && blob_token(&line, &value) ){
@@ -909,11 +909,11 @@
909 const char *zNotFound;
910 zNotFound = find_option("notfound", 0, 1);
911 if( g.argc!=2 && g.argc!=3 && g.argc!=6 ){
912 cgi_panic("no repository specified");
913 }
914 g.cgiPanic = 1;
915 g.fullHttpReply = 1;
916 if( g.argc==6 ){
917 g.httpIn = fopen(g.argv[3], "rb");
918 g.httpOut = fopen(g.argv[4], "wb");
919 zIpAddr = g.argv[5];
@@ -1039,11 +1039,11 @@
1039 g.httpIn = stdin;
1040 g.httpOut = stdout;
1041 if( g.fHttpTrace || g.fSqlTrace ){
1042 fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
1043 }
1044 g.cgiPanic = 1;
1045 find_server_repository(isUiCmd);
1046 g.zRepositoryName = enter_chroot_jail(g.zRepositoryName);
1047 cgi_handle_http_request(0);
1048 process_one_web_page(zNotFound);
1049 #else
1050
--- src/main.c
+++ src/main.c
@@ -78,11 +78,11 @@
78 char *zTop; /* Parent directory of zPath */
79 const char *zContentType; /* The content type of the input HTTP request */
80 int iErrPriority; /* Priority of current error message */
81 char *zErrMsg; /* Text of an error message */
82 Blob cgiIn; /* Input to an xfer www method */
83 int cgiOutput; /* Write error and status messages to CGI */
84 int xferPanic; /* Write error messages in XFER protocol */
85 int fullHttpReply; /* True for full HTTP reply. False for CGI reply */
86 Th_Interp *interp; /* The TH1 interpreter */
87 FILE *httpIn; /* Accept HTTP input from here */
88 FILE *httpOut; /* Send HTTP output here */
@@ -278,11 +278,11 @@
278 static int once = 1;
279 mainInFatalError = 1;
280 va_start(ap, zFormat);
281 z = vmprintf(zFormat, ap);
282 va_end(ap);
283 if( g.cgiOutput && once ){
284 once = 0;
285 cgi_printf("<p><font color=\"red\">%h</font></p>", z);
286 cgi_reply();
287 }else{
288 fprintf(stderr, "%s: %s\n", g.argv[0], z);
@@ -295,12 +295,12 @@
295 va_list ap;
296 mainInFatalError = 1;
297 va_start(ap, zFormat);
298 z = vmprintf(zFormat, ap);
299 va_end(ap);
300 if( g.cgiOutput ){
301 g.cgiOutput = 0;
302 cgi_printf("<p><font color=\"red\">%h</font></p>", z);
303 cgi_reply();
304 }else{
305 fprintf(stderr, "%s: %s\n", g.argv[0], z);
306 }
@@ -323,12 +323,12 @@
323 if( mainInFatalError ) return;
324 mainInFatalError = 1;
325 va_start(ap, zFormat);
326 z = vmprintf(zFormat, ap);
327 va_end(ap);
328 if( g.cgiOutput ){
329 g.cgiOutput = 0;
330 cgi_printf("<p><font color=\"red\">%h</font></p>", z);
331 cgi_reply();
332 }else{
333 fprintf(stderr, "%s: %s\n", g.argv[0], z);
334 }
@@ -342,11 +342,11 @@
342 char *z;
343 va_list ap;
344 va_start(ap, zFormat);
345 z = vmprintf(zFormat, ap);
346 va_end(ap);
347 if( g.cgiOutput ){
348 cgi_printf("<p><font color=\"red\">%h</font></p>", z);
349 }else{
350 fprintf(stderr, "%s: %s\n", g.argv[0], z);
351 }
352 }
@@ -811,11 +811,11 @@
811 #ifdef __EMX__
812 /* Similar hack for OS/2 */
813 setmode(fileno(g.httpOut), O_BINARY);
814 setmode(fileno(g.httpIn), O_BINARY);
815 #endif
816 g.cgiOutput = 1;
817 blob_read_from_file(&config, zFile);
818 while( blob_line(&config, &line) ){
819 if( !blob_token(&line, &key) ) continue;
820 if( blob_buffer(&key)[0]=='#' ) continue;
821 if( blob_eq(&key, "debug:") && blob_token(&line, &value) ){
@@ -909,11 +909,11 @@
909 const char *zNotFound;
910 zNotFound = find_option("notfound", 0, 1);
911 if( g.argc!=2 && g.argc!=3 && g.argc!=6 ){
912 cgi_panic("no repository specified");
913 }
914 g.cgiOutput = 1;
915 g.fullHttpReply = 1;
916 if( g.argc==6 ){
917 g.httpIn = fopen(g.argv[3], "rb");
918 g.httpOut = fopen(g.argv[4], "wb");
919 zIpAddr = g.argv[5];
@@ -1039,11 +1039,11 @@
1039 g.httpIn = stdin;
1040 g.httpOut = stdout;
1041 if( g.fHttpTrace || g.fSqlTrace ){
1042 fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
1043 }
1044 g.cgiOutput = 1;
1045 find_server_repository(isUiCmd);
1046 g.zRepositoryName = enter_chroot_jail(g.zRepositoryName);
1047 cgi_handle_http_request(0);
1048 process_one_web_page(zNotFound);
1049 #else
1050
+15
--- src/printf.c
+++ src/printf.c
@@ -804,5 +804,20 @@
804804
void fossil_error_reset(void){
805805
free(g.zErrMsg);
806806
g.zErrMsg = 0;
807807
g.iErrPriority = 0;
808808
}
809
+
810
+/*
811
+** Write output for user consumption. If g.cgiOutput is enabled, then
812
+** send the output as part of the CGI reply. If g.cgiOutput is false,
813
+** then write on standard output.
814
+*/
815
+void fossil_print(const char *zFormat, ...){
816
+ va_list ap;
817
+ va_start(ap, zFormat);
818
+ if( g.cgiOutput ){
819
+ cgi_vprintf(zFormat, ap);
820
+ }else{
821
+ vprintf(zFormat, ap);
822
+ }
823
+}
809824
--- src/printf.c
+++ src/printf.c
@@ -804,5 +804,20 @@
804 void fossil_error_reset(void){
805 free(g.zErrMsg);
806 g.zErrMsg = 0;
807 g.iErrPriority = 0;
808 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
809
--- src/printf.c
+++ src/printf.c
@@ -804,5 +804,20 @@
804 void fossil_error_reset(void){
805 free(g.zErrMsg);
806 g.zErrMsg = 0;
807 g.iErrPriority = 0;
808 }
809
810 /*
811 ** Write output for user consumption. If g.cgiOutput is enabled, then
812 ** send the output as part of the CGI reply. If g.cgiOutput is false,
813 ** then write on standard output.
814 */
815 void fossil_print(const char *zFormat, ...){
816 va_list ap;
817 va_start(ap, zFormat);
818 if( g.cgiOutput ){
819 cgi_vprintf(zFormat, ap);
820 }else{
821 vprintf(zFormat, ap);
822 }
823 }
824
+1 -1
--- src/style.c
+++ src/style.c
@@ -110,11 +110,11 @@
110110
if( g.thTrace ) Th_Trace("BEGIN_HEADER_SCRIPT<br />\n", -1);
111111
Th_Render(zHeader);
112112
if( g.thTrace ) Th_Trace("END_HEADER<br />\n", -1);
113113
Th_Unstore("title"); /* Avoid collisions with ticket field names */
114114
cgi_destination(CGI_BODY);
115
- g.cgiPanic = 1;
115
+ g.cgiOutput = 1;
116116
headerHasBeenGenerated = 1;
117117
}
118118
119119
/*
120120
** Draw the footer at the bottom of the page.
121121
--- src/style.c
+++ src/style.c
@@ -110,11 +110,11 @@
110 if( g.thTrace ) Th_Trace("BEGIN_HEADER_SCRIPT<br />\n", -1);
111 Th_Render(zHeader);
112 if( g.thTrace ) Th_Trace("END_HEADER<br />\n", -1);
113 Th_Unstore("title"); /* Avoid collisions with ticket field names */
114 cgi_destination(CGI_BODY);
115 g.cgiPanic = 1;
116 headerHasBeenGenerated = 1;
117 }
118
119 /*
120 ** Draw the footer at the bottom of the page.
121
--- src/style.c
+++ src/style.c
@@ -110,11 +110,11 @@
110 if( g.thTrace ) Th_Trace("BEGIN_HEADER_SCRIPT<br />\n", -1);
111 Th_Render(zHeader);
112 if( g.thTrace ) Th_Trace("END_HEADER<br />\n", -1);
113 Th_Unstore("title"); /* Avoid collisions with ticket field names */
114 cgi_destination(CGI_BODY);
115 g.cgiOutput = 1;
116 headerHasBeenGenerated = 1;
117 }
118
119 /*
120 ** Draw the footer at the bottom of the page.
121
+1 -1
--- src/th_main.c
+++ src/th_main.c
@@ -95,11 +95,11 @@
9595
if( n<0 ) n = strlen(z);
9696
if( encode ){
9797
z = htmlize(z, n);
9898
n = strlen(z);
9999
}
100
- if( g.cgiPanic ){
100
+ if( g.cgiOutput ){
101101
cgi_append_content(z, n);
102102
}else{
103103
fwrite(z, 1, n, stdout);
104104
}
105105
if( encode ) free((char*)z);
106106
--- src/th_main.c
+++ src/th_main.c
@@ -95,11 +95,11 @@
95 if( n<0 ) n = strlen(z);
96 if( encode ){
97 z = htmlize(z, n);
98 n = strlen(z);
99 }
100 if( g.cgiPanic ){
101 cgi_append_content(z, n);
102 }else{
103 fwrite(z, 1, n, stdout);
104 }
105 if( encode ) free((char*)z);
106
--- src/th_main.c
+++ src/th_main.c
@@ -95,11 +95,11 @@
95 if( n<0 ) n = strlen(z);
96 if( encode ){
97 z = htmlize(z, n);
98 n = strlen(z);
99 }
100 if( g.cgiOutput ){
101 cgi_append_content(z, n);
102 }else{
103 fwrite(z, 1, n, stdout);
104 }
105 if( encode ) free((char*)z);
106
+11 -11
--- src/xfer.c
+++ src/xfer.c
@@ -992,11 +992,11 @@
992992
if( pushFlag ){
993993
blob_appendf(&send, "push %s %s\n", zSCode, zPCode);
994994
nCardSent++;
995995
}
996996
manifest_crosslink_begin();
997
- printf(zLabelFormat, "", "Bytes", "Cards", "Artifacts", "Deltas");
997
+ fossil_print(zLabelFormat, "", "Bytes", "Cards", "Artifacts", "Deltas");
998998
999999
while( go ){
10001000
int newPhantom = 0;
10011001
char *zRandomness;
10021002
@@ -1058,13 +1058,13 @@
10581058
blob_appendf(&send, "# %s\n", zRandomness);
10591059
free(zRandomness);
10601060
10611061
/* Exchange messages with the server */
10621062
nFileSend = xfer.nFileSent + xfer.nDeltaSent;
1063
- printf(zValueFormat, "Send:",
1064
- blob_size(&send), nCardSent+xfer.nGimmeSent+xfer.nIGotSent,
1065
- xfer.nFileSent, xfer.nDeltaSent);
1063
+ fossil_print(zValueFormat, "Send:",
1064
+ blob_size(&send), nCardSent+xfer.nGimmeSent+xfer.nIGotSent,
1065
+ xfer.nFileSent, xfer.nDeltaSent);
10661066
nCardSent = 0;
10671067
nCardRcvd = 0;
10681068
xfer.nFileSent = 0;
10691069
xfer.nDeltaSent = 0;
10701070
xfer.nGimmeSent = 0;
@@ -1091,11 +1091,11 @@
10911091
if( blob_buffer(&xfer.line)[0]=='#' ){
10921092
continue;
10931093
}
10941094
xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
10951095
nCardRcvd++;
1096
- if (!g.fQuiet) {
1096
+ if( !g.cgiOutput && !g.fQuiet ){
10971097
printf("\r%d", nCardRcvd);
10981098
fflush(stdout);
10991099
}
11001100
11011101
/* file UUID SIZE \n CONTENT
@@ -1232,11 +1232,11 @@
12321232
** to the next cycle.
12331233
*/
12341234
if( blob_eq(&xfer.aToken[0],"message") && xfer.nToken==2 ){
12351235
char *zMsg = blob_terminate(&xfer.aToken[1]);
12361236
defossilize(zMsg);
1237
- if( zMsg ) printf("\rServer says: %s\n", zMsg);
1237
+ if( zMsg ) fossil_print("\rServer says: %s\n", zMsg);
12381238
}else
12391239
12401240
/* error MESSAGE
12411241
**
12421242
** Report an error and abandon the sync session.
@@ -1284,13 +1284,13 @@
12841284
if( origConfigRcvMask & (CONFIGSET_TKT|CONFIGSET_USER) ){
12851285
configure_finalize_receive();
12861286
}
12871287
origConfigRcvMask = 0;
12881288
if( nCardRcvd>0 ){
1289
- printf(zValueFormat, "Received:",
1290
- blob_size(&recv), nCardRcvd,
1291
- xfer.nFileRcvd, xfer.nDeltaRcvd + xfer.nDanglingFile);
1289
+ fossil_print(zValueFormat, "Received:",
1290
+ blob_size(&recv), nCardRcvd,
1291
+ xfer.nFileRcvd, xfer.nDeltaRcvd + xfer.nDanglingFile);
12921292
}
12931293
blob_reset(&recv);
12941294
nCycle++;
12951295
12961296
/* If we received one or more files on the previous exchange but
@@ -1316,13 +1316,13 @@
13161316
13171317
/* If this is a clone, the go at least two rounds */
13181318
if( cloneFlag && nCycle==1 ) go = 1;
13191319
};
13201320
transport_stats(&nSent, &nRcvd, 1);
1321
- printf("Total network traffic: %d bytes sent, %d bytes received\n",
1322
- nSent, nRcvd);
1321
+ fossil_print("Total network traffic: %d bytes sent, %d bytes received\n",
1322
+ nSent, nRcvd);
13231323
transport_close();
13241324
transport_global_shutdown();
13251325
db_multi_exec("DROP TABLE onremote");
13261326
manifest_crosslink_end();
13271327
db_end_transaction(0);
13281328
}
13291329
--- src/xfer.c
+++ src/xfer.c
@@ -992,11 +992,11 @@
992 if( pushFlag ){
993 blob_appendf(&send, "push %s %s\n", zSCode, zPCode);
994 nCardSent++;
995 }
996 manifest_crosslink_begin();
997 printf(zLabelFormat, "", "Bytes", "Cards", "Artifacts", "Deltas");
998
999 while( go ){
1000 int newPhantom = 0;
1001 char *zRandomness;
1002
@@ -1058,13 +1058,13 @@
1058 blob_appendf(&send, "# %s\n", zRandomness);
1059 free(zRandomness);
1060
1061 /* Exchange messages with the server */
1062 nFileSend = xfer.nFileSent + xfer.nDeltaSent;
1063 printf(zValueFormat, "Send:",
1064 blob_size(&send), nCardSent+xfer.nGimmeSent+xfer.nIGotSent,
1065 xfer.nFileSent, xfer.nDeltaSent);
1066 nCardSent = 0;
1067 nCardRcvd = 0;
1068 xfer.nFileSent = 0;
1069 xfer.nDeltaSent = 0;
1070 xfer.nGimmeSent = 0;
@@ -1091,11 +1091,11 @@
1091 if( blob_buffer(&xfer.line)[0]=='#' ){
1092 continue;
1093 }
1094 xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
1095 nCardRcvd++;
1096 if (!g.fQuiet) {
1097 printf("\r%d", nCardRcvd);
1098 fflush(stdout);
1099 }
1100
1101 /* file UUID SIZE \n CONTENT
@@ -1232,11 +1232,11 @@
1232 ** to the next cycle.
1233 */
1234 if( blob_eq(&xfer.aToken[0],"message") && xfer.nToken==2 ){
1235 char *zMsg = blob_terminate(&xfer.aToken[1]);
1236 defossilize(zMsg);
1237 if( zMsg ) printf("\rServer says: %s\n", zMsg);
1238 }else
1239
1240 /* error MESSAGE
1241 **
1242 ** Report an error and abandon the sync session.
@@ -1284,13 +1284,13 @@
1284 if( origConfigRcvMask & (CONFIGSET_TKT|CONFIGSET_USER) ){
1285 configure_finalize_receive();
1286 }
1287 origConfigRcvMask = 0;
1288 if( nCardRcvd>0 ){
1289 printf(zValueFormat, "Received:",
1290 blob_size(&recv), nCardRcvd,
1291 xfer.nFileRcvd, xfer.nDeltaRcvd + xfer.nDanglingFile);
1292 }
1293 blob_reset(&recv);
1294 nCycle++;
1295
1296 /* If we received one or more files on the previous exchange but
@@ -1316,13 +1316,13 @@
1316
1317 /* If this is a clone, the go at least two rounds */
1318 if( cloneFlag && nCycle==1 ) go = 1;
1319 };
1320 transport_stats(&nSent, &nRcvd, 1);
1321 printf("Total network traffic: %d bytes sent, %d bytes received\n",
1322 nSent, nRcvd);
1323 transport_close();
1324 transport_global_shutdown();
1325 db_multi_exec("DROP TABLE onremote");
1326 manifest_crosslink_end();
1327 db_end_transaction(0);
1328 }
1329
--- src/xfer.c
+++ src/xfer.c
@@ -992,11 +992,11 @@
992 if( pushFlag ){
993 blob_appendf(&send, "push %s %s\n", zSCode, zPCode);
994 nCardSent++;
995 }
996 manifest_crosslink_begin();
997 fossil_print(zLabelFormat, "", "Bytes", "Cards", "Artifacts", "Deltas");
998
999 while( go ){
1000 int newPhantom = 0;
1001 char *zRandomness;
1002
@@ -1058,13 +1058,13 @@
1058 blob_appendf(&send, "# %s\n", zRandomness);
1059 free(zRandomness);
1060
1061 /* Exchange messages with the server */
1062 nFileSend = xfer.nFileSent + xfer.nDeltaSent;
1063 fossil_print(zValueFormat, "Send:",
1064 blob_size(&send), nCardSent+xfer.nGimmeSent+xfer.nIGotSent,
1065 xfer.nFileSent, xfer.nDeltaSent);
1066 nCardSent = 0;
1067 nCardRcvd = 0;
1068 xfer.nFileSent = 0;
1069 xfer.nDeltaSent = 0;
1070 xfer.nGimmeSent = 0;
@@ -1091,11 +1091,11 @@
1091 if( blob_buffer(&xfer.line)[0]=='#' ){
1092 continue;
1093 }
1094 xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
1095 nCardRcvd++;
1096 if( !g.cgiOutput && !g.fQuiet ){
1097 printf("\r%d", nCardRcvd);
1098 fflush(stdout);
1099 }
1100
1101 /* file UUID SIZE \n CONTENT
@@ -1232,11 +1232,11 @@
1232 ** to the next cycle.
1233 */
1234 if( blob_eq(&xfer.aToken[0],"message") && xfer.nToken==2 ){
1235 char *zMsg = blob_terminate(&xfer.aToken[1]);
1236 defossilize(zMsg);
1237 if( zMsg ) fossil_print("\rServer says: %s\n", zMsg);
1238 }else
1239
1240 /* error MESSAGE
1241 **
1242 ** Report an error and abandon the sync session.
@@ -1284,13 +1284,13 @@
1284 if( origConfigRcvMask & (CONFIGSET_TKT|CONFIGSET_USER) ){
1285 configure_finalize_receive();
1286 }
1287 origConfigRcvMask = 0;
1288 if( nCardRcvd>0 ){
1289 fossil_print(zValueFormat, "Received:",
1290 blob_size(&recv), nCardRcvd,
1291 xfer.nFileRcvd, xfer.nDeltaRcvd + xfer.nDanglingFile);
1292 }
1293 blob_reset(&recv);
1294 nCycle++;
1295
1296 /* If we received one or more files on the previous exchange but
@@ -1316,13 +1316,13 @@
1316
1317 /* If this is a clone, the go at least two rounds */
1318 if( cloneFlag && nCycle==1 ) go = 1;
1319 };
1320 transport_stats(&nSent, &nRcvd, 1);
1321 fossil_print("Total network traffic: %d bytes sent, %d bytes received\n",
1322 nSent, nRcvd);
1323 transport_close();
1324 transport_global_shutdown();
1325 db_multi_exec("DROP TABLE onremote");
1326 manifest_crosslink_end();
1327 db_end_transaction(0);
1328 }
1329

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button