Fossil SCM

Hack in Windows so that it shows the correct launch command in the log-menu.

drh 2025-02-14 17:04 trunk
Commit f38866e7497b22af59d86882310636be1fc5fe1f13482de1b277e6a1d1339082
+13
--- src/main.c
+++ src/main.c
@@ -2920,10 +2920,23 @@
29202920
#if defined(_WIN32)
29212921
_setmode(_fileno(stdout), _O_BINARY);
29222922
#endif
29232923
}
29242924
zIpAddr = find_option("ipaddr",0,1);
2925
+#if defined(_WIN32)
2926
+ /* The undocumented option "--as NAME" causes NAME to become
2927
+ ** the fake command name. This only happens on Windows and only
2928
+ ** if preceded by --in, --out, and --ipaddr. It is a work-around
2929
+ ** to get the original command-name down into the "http" command that
2930
+ ** is run in a subprocess to manage HTTP requests on Windows for
2931
+ ** commands like "fossil ui" and "fossil server".
2932
+ */
2933
+ if( zInFile && zOutFile && zIpAddr ){
2934
+ const char *z = find_option("as",0,1);
2935
+ if( z ) g.zCmdName = z;
2936
+ }
2937
+#endif
29252938
useSCGI = find_option("scgi", 0, 0)!=0;
29262939
if( useSCGI ) g.zReqType = "SCGI";
29272940
zAltBase = find_option("baseurl", 0, 1);
29282941
if( find_option("nodelay",0,0)!=0 ) backoffice_no_delay();
29292942
if( zAltBase ) set_base_url(zAltBase);
29302943
--- src/main.c
+++ src/main.c
@@ -2920,10 +2920,23 @@
2920 #if defined(_WIN32)
2921 _setmode(_fileno(stdout), _O_BINARY);
2922 #endif
2923 }
2924 zIpAddr = find_option("ipaddr",0,1);
 
 
 
 
 
 
 
 
 
 
 
 
 
2925 useSCGI = find_option("scgi", 0, 0)!=0;
2926 if( useSCGI ) g.zReqType = "SCGI";
2927 zAltBase = find_option("baseurl", 0, 1);
2928 if( find_option("nodelay",0,0)!=0 ) backoffice_no_delay();
2929 if( zAltBase ) set_base_url(zAltBase);
2930
--- src/main.c
+++ src/main.c
@@ -2920,10 +2920,23 @@
2920 #if defined(_WIN32)
2921 _setmode(_fileno(stdout), _O_BINARY);
2922 #endif
2923 }
2924 zIpAddr = find_option("ipaddr",0,1);
2925 #if defined(_WIN32)
2926 /* The undocumented option "--as NAME" causes NAME to become
2927 ** the fake command name. This only happens on Windows and only
2928 ** if preceded by --in, --out, and --ipaddr. It is a work-around
2929 ** to get the original command-name down into the "http" command that
2930 ** is run in a subprocess to manage HTTP requests on Windows for
2931 ** commands like "fossil ui" and "fossil server".
2932 */
2933 if( zInFile && zOutFile && zIpAddr ){
2934 const char *z = find_option("as",0,1);
2935 if( z ) g.zCmdName = z;
2936 }
2937 #endif
2938 useSCGI = find_option("scgi", 0, 0)!=0;
2939 if( useSCGI ) g.zReqType = "SCGI";
2940 zAltBase = find_option("baseurl", 0, 1);
2941 if( find_option("nodelay",0,0)!=0 ) backoffice_no_delay();
2942 if( zAltBase ) set_base_url(zAltBase);
2943
+1 -1
--- src/setup.c
+++ src/setup.c
@@ -251,11 +251,11 @@
251251
P("SCRIPT_FILENAME")
252252
);
253253
}else{
254254
blob_appendf(&desc,
255255
" add the \"--errorlog <i>FILENAME</i>\" option to the\n"
256
- "\"%h %h\" command that launched this server.",
256
+ "\"%h %h\" command that launched the server.",
257257
g.argv[0], g.zCmdName
258258
);
259259
}
260260
bErrLog = 0;
261261
}else{
262262
--- src/setup.c
+++ src/setup.c
@@ -251,11 +251,11 @@
251 P("SCRIPT_FILENAME")
252 );
253 }else{
254 blob_appendf(&desc,
255 " add the \"--errorlog <i>FILENAME</i>\" option to the\n"
256 "\"%h %h\" command that launched this server.",
257 g.argv[0], g.zCmdName
258 );
259 }
260 bErrLog = 0;
261 }else{
262
--- src/setup.c
+++ src/setup.c
@@ -251,11 +251,11 @@
251 P("SCRIPT_FILENAME")
252 );
253 }else{
254 blob_appendf(&desc,
255 " add the \"--errorlog <i>FILENAME</i>\" option to the\n"
256 "\"%h %h\" command that launched the server.",
257 g.argv[0], g.zCmdName
258 );
259 }
260 bErrLog = 0;
261 }else{
262
+7 -4
--- src/winhttp.c
+++ src/winhttp.c
@@ -416,16 +416,19 @@
416416
** with the local Fossil server started via the "ui" command.
417417
*/
418418
zIp = SocketAddr_toString(&p->addr);
419419
if( (p->flags & HTTP_SERVER_HAD_CHECKOUT)==0 ){
420420
assert( g.zRepositoryName && g.zRepositoryName[0] );
421
- sqlite3_snprintf(sizeof(zCmd), zCmd, "%s--in %s\n--out %s\n--ipaddr %s\n%s",
422
- get_utf8_bom(0), zRequestFName, zReplyFName, zIp, g.zRepositoryName
421
+ sqlite3_snprintf(sizeof(zCmd), zCmd,
422
+ "%s--in %s\n--out %s\n--ipaddr %s\n--as %s\n%s",
423
+ get_utf8_bom(0), zRequestFName, zReplyFName, zIp, g.zCmdName,
424
+ g.zRepositoryName
423425
);
424426
}else{
425
- sqlite3_snprintf(sizeof(zCmd), zCmd, "%s--in %s\n--out %s\n--ipaddr %s",
426
- get_utf8_bom(0), zRequestFName, zReplyFName, zIp
427
+ sqlite3_snprintf(sizeof(zCmd), zCmd,
428
+ "%s--in %s\n--out %s\n--ipaddr %s\n--as %s\n",
429
+ get_utf8_bom(0), zRequestFName, zReplyFName, zIp, g.zCmdName
427430
);
428431
}
429432
fossil_free(zIp);
430433
aux = fossil_fopen(zCmdFName, "wb");
431434
if( aux==0 ) goto end_request;
432435
--- src/winhttp.c
+++ src/winhttp.c
@@ -416,16 +416,19 @@
416 ** with the local Fossil server started via the "ui" command.
417 */
418 zIp = SocketAddr_toString(&p->addr);
419 if( (p->flags & HTTP_SERVER_HAD_CHECKOUT)==0 ){
420 assert( g.zRepositoryName && g.zRepositoryName[0] );
421 sqlite3_snprintf(sizeof(zCmd), zCmd, "%s--in %s\n--out %s\n--ipaddr %s\n%s",
422 get_utf8_bom(0), zRequestFName, zReplyFName, zIp, g.zRepositoryName
 
 
423 );
424 }else{
425 sqlite3_snprintf(sizeof(zCmd), zCmd, "%s--in %s\n--out %s\n--ipaddr %s",
426 get_utf8_bom(0), zRequestFName, zReplyFName, zIp
 
427 );
428 }
429 fossil_free(zIp);
430 aux = fossil_fopen(zCmdFName, "wb");
431 if( aux==0 ) goto end_request;
432
--- src/winhttp.c
+++ src/winhttp.c
@@ -416,16 +416,19 @@
416 ** with the local Fossil server started via the "ui" command.
417 */
418 zIp = SocketAddr_toString(&p->addr);
419 if( (p->flags & HTTP_SERVER_HAD_CHECKOUT)==0 ){
420 assert( g.zRepositoryName && g.zRepositoryName[0] );
421 sqlite3_snprintf(sizeof(zCmd), zCmd,
422 "%s--in %s\n--out %s\n--ipaddr %s\n--as %s\n%s",
423 get_utf8_bom(0), zRequestFName, zReplyFName, zIp, g.zCmdName,
424 g.zRepositoryName
425 );
426 }else{
427 sqlite3_snprintf(sizeof(zCmd), zCmd,
428 "%s--in %s\n--out %s\n--ipaddr %s\n--as %s\n",
429 get_utf8_bom(0), zRequestFName, zReplyFName, zIp, g.zCmdName
430 );
431 }
432 fossil_free(zIp);
433 aux = fossil_fopen(zCmdFName, "wb");
434 if( aux==0 ) goto end_request;
435

Keyboard Shortcuts

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