Fossil SCM
Hack in Windows so that it shows the correct launch command in the log-menu.
Commit
f38866e7497b22af59d86882310636be1fc5fe1f13482de1b277e6a1d1339082
Parent
bd0d4422598dfef…
3 files changed
+13
+1
-1
+7
-4
+13
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -2920,10 +2920,23 @@ | ||
| 2920 | 2920 | #if defined(_WIN32) |
| 2921 | 2921 | _setmode(_fileno(stdout), _O_BINARY); |
| 2922 | 2922 | #endif |
| 2923 | 2923 | } |
| 2924 | 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 | |
| 2925 | 2938 | useSCGI = find_option("scgi", 0, 0)!=0; |
| 2926 | 2939 | if( useSCGI ) g.zReqType = "SCGI"; |
| 2927 | 2940 | zAltBase = find_option("baseurl", 0, 1); |
| 2928 | 2941 | if( find_option("nodelay",0,0)!=0 ) backoffice_no_delay(); |
| 2929 | 2942 | if( zAltBase ) set_base_url(zAltBase); |
| 2930 | 2943 |
| --- 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 @@ | ||
| 251 | 251 | P("SCRIPT_FILENAME") |
| 252 | 252 | ); |
| 253 | 253 | }else{ |
| 254 | 254 | blob_appendf(&desc, |
| 255 | 255 | " 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.", | |
| 257 | 257 | g.argv[0], g.zCmdName |
| 258 | 258 | ); |
| 259 | 259 | } |
| 260 | 260 | bErrLog = 0; |
| 261 | 261 | }else{ |
| 262 | 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 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 @@ | ||
| 416 | 416 | ** with the local Fossil server started via the "ui" command. |
| 417 | 417 | */ |
| 418 | 418 | zIp = SocketAddr_toString(&p->addr); |
| 419 | 419 | if( (p->flags & HTTP_SERVER_HAD_CHECKOUT)==0 ){ |
| 420 | 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 | |
| 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 | |
| 423 | 425 | ); |
| 424 | 426 | }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 | |
| 427 | 430 | ); |
| 428 | 431 | } |
| 429 | 432 | fossil_free(zIp); |
| 430 | 433 | aux = fossil_fopen(zCmdFName, "wb"); |
| 431 | 434 | if( aux==0 ) goto end_request; |
| 432 | 435 |
| --- 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 |