Fossil SCM

Minor changes to option handling for the `ui' command: (A) Abort early with an error message if the specified port number is invalid (instead of later with an assertion failure); (B) Add short form -p for --page; (C) Add short form -B for --nobrowser.

florian 2022-09-25 07:18 trunk
Commit 1431ebae3d3397488986b919a4776e3a2b4a1bf48230d90f941f4e44cb3b5eee
1 file changed +5 -4
+5 -4
--- src/main.c
+++ src/main.c
@@ -3048,19 +3048,19 @@
30483048
** result in fewer HTTP requests than the separate mode.
30493049
** --mainmenu FILE Override the mainmenu config setting with the contents
30503050
** of the given file.
30513051
** --max-latency N Do not let any single HTTP request run for more than N
30523052
** seconds (only works on unix)
3053
-** --nobrowser Do not automatically launch a web-browser for the
3053
+** -B|--nobrowser Do not automatically launch a web-browser for the
30543054
** "fossil ui" command.
30553055
** --nocompress Do not compress HTTP replies
30563056
** --nojail Drop root privileges but do not enter the chroot jail
30573057
** --nossl do not force redirects to SSL even if the repository
30583058
** setting "redirect-to-https" requests it. This is set
30593059
** by default for the "ui" command.
30603060
** --notfound URL Redirect to URL if a page is not found.
3061
-** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci"
3061
+** -p|--page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci"
30623062
** --pkey FILE Read the private key used for TLS from FILE.
30633063
** -P|--port TCPPORT listen to request on port TCPPORT
30643064
** --repolist If REPOSITORY is dir, URL "/" lists repos.
30653065
** --scgi Accept SCGI rather than HTTP
30663066
** --skin LABEL Use override skin LABEL
@@ -3124,11 +3124,11 @@
31243124
g.useLocalauth = find_option("localauth", 0, 0)!=0;
31253125
Th_InitTraceLog();
31263126
zPort = find_option("port", "P", 1);
31273127
isUiCmd = g.argv[1][0]=='u';
31283128
if( isUiCmd ){
3129
- zInitPage = find_option("page", 0, 1);
3129
+ zInitPage = find_option("page", "p", 1);
31303130
if( zInitPage && zInitPage[0]=='/' ) zInitPage++;
31313131
zFossilCmd = find_option("fossilcmd", 0, 1);
31323132
}
31333133
zNotFound = find_option("notfound", 0, 1);
31343134
allowRepoList = find_option("repolist",0,0)!=0;
@@ -3138,11 +3138,11 @@
31383138
if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI;
31393139
if( zAltBase ){
31403140
set_base_url(zAltBase);
31413141
}
31423142
g.sslNotAvailable = find_option("nossl", 0, 0)!=0 || isUiCmd;
3143
- fNoBrowser = find_option("nobrowser", 0, 0)!=0;
3143
+ fNoBrowser = find_option("nobrowser", "B", 0)!=0;
31443144
decode_ssl_options();
31453145
if( find_option("https",0,0)!=0 || g.httpUseSSL ){
31463146
cgi_replace_parameter("HTTPS","on");
31473147
}
31483148
if( find_option("localhost", 0, 0)!=0 ){
@@ -3230,10 +3230,11 @@
32303230
}
32313231
zPort += i+1;
32323232
}
32333233
}
32343234
iPort = mxPort = atoi(zPort);
3235
+ if( iPort<=0 ) fossil_fatal("port number must be greater than zero");
32353236
}else{
32363237
iPort = db_get_int("http-port", 8080);
32373238
mxPort = iPort+100;
32383239
}
32393240
if( isUiCmd && !fNoBrowser ){
32403241
--- src/main.c
+++ src/main.c
@@ -3048,19 +3048,19 @@
3048 ** result in fewer HTTP requests than the separate mode.
3049 ** --mainmenu FILE Override the mainmenu config setting with the contents
3050 ** of the given file.
3051 ** --max-latency N Do not let any single HTTP request run for more than N
3052 ** seconds (only works on unix)
3053 ** --nobrowser Do not automatically launch a web-browser for the
3054 ** "fossil ui" command.
3055 ** --nocompress Do not compress HTTP replies
3056 ** --nojail Drop root privileges but do not enter the chroot jail
3057 ** --nossl do not force redirects to SSL even if the repository
3058 ** setting "redirect-to-https" requests it. This is set
3059 ** by default for the "ui" command.
3060 ** --notfound URL Redirect to URL if a page is not found.
3061 ** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci"
3062 ** --pkey FILE Read the private key used for TLS from FILE.
3063 ** -P|--port TCPPORT listen to request on port TCPPORT
3064 ** --repolist If REPOSITORY is dir, URL "/" lists repos.
3065 ** --scgi Accept SCGI rather than HTTP
3066 ** --skin LABEL Use override skin LABEL
@@ -3124,11 +3124,11 @@
3124 g.useLocalauth = find_option("localauth", 0, 0)!=0;
3125 Th_InitTraceLog();
3126 zPort = find_option("port", "P", 1);
3127 isUiCmd = g.argv[1][0]=='u';
3128 if( isUiCmd ){
3129 zInitPage = find_option("page", 0, 1);
3130 if( zInitPage && zInitPage[0]=='/' ) zInitPage++;
3131 zFossilCmd = find_option("fossilcmd", 0, 1);
3132 }
3133 zNotFound = find_option("notfound", 0, 1);
3134 allowRepoList = find_option("repolist",0,0)!=0;
@@ -3138,11 +3138,11 @@
3138 if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI;
3139 if( zAltBase ){
3140 set_base_url(zAltBase);
3141 }
3142 g.sslNotAvailable = find_option("nossl", 0, 0)!=0 || isUiCmd;
3143 fNoBrowser = find_option("nobrowser", 0, 0)!=0;
3144 decode_ssl_options();
3145 if( find_option("https",0,0)!=0 || g.httpUseSSL ){
3146 cgi_replace_parameter("HTTPS","on");
3147 }
3148 if( find_option("localhost", 0, 0)!=0 ){
@@ -3230,10 +3230,11 @@
3230 }
3231 zPort += i+1;
3232 }
3233 }
3234 iPort = mxPort = atoi(zPort);
 
3235 }else{
3236 iPort = db_get_int("http-port", 8080);
3237 mxPort = iPort+100;
3238 }
3239 if( isUiCmd && !fNoBrowser ){
3240
--- src/main.c
+++ src/main.c
@@ -3048,19 +3048,19 @@
3048 ** result in fewer HTTP requests than the separate mode.
3049 ** --mainmenu FILE Override the mainmenu config setting with the contents
3050 ** of the given file.
3051 ** --max-latency N Do not let any single HTTP request run for more than N
3052 ** seconds (only works on unix)
3053 ** -B|--nobrowser Do not automatically launch a web-browser for the
3054 ** "fossil ui" command.
3055 ** --nocompress Do not compress HTTP replies
3056 ** --nojail Drop root privileges but do not enter the chroot jail
3057 ** --nossl do not force redirects to SSL even if the repository
3058 ** setting "redirect-to-https" requests it. This is set
3059 ** by default for the "ui" command.
3060 ** --notfound URL Redirect to URL if a page is not found.
3061 ** -p|--page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci"
3062 ** --pkey FILE Read the private key used for TLS from FILE.
3063 ** -P|--port TCPPORT listen to request on port TCPPORT
3064 ** --repolist If REPOSITORY is dir, URL "/" lists repos.
3065 ** --scgi Accept SCGI rather than HTTP
3066 ** --skin LABEL Use override skin LABEL
@@ -3124,11 +3124,11 @@
3124 g.useLocalauth = find_option("localauth", 0, 0)!=0;
3125 Th_InitTraceLog();
3126 zPort = find_option("port", "P", 1);
3127 isUiCmd = g.argv[1][0]=='u';
3128 if( isUiCmd ){
3129 zInitPage = find_option("page", "p", 1);
3130 if( zInitPage && zInitPage[0]=='/' ) zInitPage++;
3131 zFossilCmd = find_option("fossilcmd", 0, 1);
3132 }
3133 zNotFound = find_option("notfound", 0, 1);
3134 allowRepoList = find_option("repolist",0,0)!=0;
@@ -3138,11 +3138,11 @@
3138 if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI;
3139 if( zAltBase ){
3140 set_base_url(zAltBase);
3141 }
3142 g.sslNotAvailable = find_option("nossl", 0, 0)!=0 || isUiCmd;
3143 fNoBrowser = find_option("nobrowser", "B", 0)!=0;
3144 decode_ssl_options();
3145 if( find_option("https",0,0)!=0 || g.httpUseSSL ){
3146 cgi_replace_parameter("HTTPS","on");
3147 }
3148 if( find_option("localhost", 0, 0)!=0 ){
@@ -3230,10 +3230,11 @@
3230 }
3231 zPort += i+1;
3232 }
3233 }
3234 iPort = mxPort = atoi(zPort);
3235 if( iPort<=0 ) fossil_fatal("port number must be greater than zero");
3236 }else{
3237 iPort = db_get_int("http-port", 8080);
3238 mxPort = iPort+100;
3239 }
3240 if( isUiCmd && !fNoBrowser ){
3241

Keyboard Shortcuts

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