Fossil SCM

Enhance the mkindex utility to extract help text for each setting separately and automatically build the aSetting table.

drh 2017-08-30 17:08 UTC trunk
Commit 3d02004f6ea00c1f02838cb5de0e7f3d9e06eaa956d0a328d1f2aa347c1e9876
4 files changed +392 -330 +35 -13 +128 -32 +7 -4
+392 -330
--- src/db.c
+++ src/db.c
@@ -1804,15 +1804,17 @@
18041804
** settings.
18051805
*/
18061806
const char *db_setting_inop_rhs(){
18071807
Blob x;
18081808
int i;
1809
+ int nSetting;
1810
+ const Setting *aSetting = setting_info(&nSetting);
18091811
const char *zSep = "";
18101812
18111813
blob_zero(&x);
18121814
blob_append_sql(&x, "(");
1813
- for(i=0; aSetting[i].name; i++){
1815
+ for(i=0; i<nSetting; i++){
18141816
blob_append_sql(&x, "%s%Q", zSep/*safe-for-%s*/, aSetting[i].name);
18151817
zSep = ",";
18161818
}
18171819
blob_append_sql(&x, ")");
18181820
return blob_sql_text(&x);
@@ -2735,11 +2737,10 @@
27352737
}
27362738
}
27372739
db_finalize(&q);
27382740
}
27392741
2740
-
27412742
#if INTERFACE
27422743
/*
27432744
** Define all settings, which can be controlled via the set/unset
27442745
** command.
27452746
**
@@ -2760,100 +2761,399 @@
27602761
int forceTextArea; /* Force using a text area for display? */
27612762
const char *def; /* Default value */
27622763
};
27632764
#endif /* INTERFACE */
27642765
2765
-const Setting aSetting[] = {
2766
- { "access-log", 0, 0, 0, 0, "off" },
2767
- { "admin-log", 0, 0, 0, 0, "off" },
2766
+/*
2767
+** SETTING: access-log boolean default=off
2768
+**
2769
+** When the access-log setting is enabled, all login attempts (successful
2770
+** and unsuccessful) on the web interface are recorded in the "access" table
2771
+** of the repository.
2772
+*/
2773
+/*
2774
+** SETTING: admin-log boolean default=off
2775
+**
2776
+** When the admin-log setting is enabled, configuration changes are recorded
2777
+** in the "admin_log" table of the repository.
2778
+*/
27682779
#if defined(_WIN32)
2769
- { "allow-symlinks", 0, 0, 1, 0, "off" },
2770
-#else
2771
- { "allow-symlinks", 0, 0, 1, 0, "on" },
2772
-#endif
2773
- { "auto-captcha", "autocaptcha", 0, 0, 0, "on" },
2774
- { "auto-hyperlink", 0, 0, 0, 0, "on", },
2775
- { "auto-shun", 0, 0, 0, 0, "on" },
2776
- { "autosync", 0, 0, 0, 0, "on" },
2777
- { "autosync-tries", 0, 16, 0, 0, "1" },
2778
- { "binary-glob", 0, 40, 1, 0, "" },
2779
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(__DARWIN__) || \
2780
- defined(__APPLE__)
2781
- { "case-sensitive", 0, 0, 0, 0, "off" },
2782
-#else
2783
- { "case-sensitive", 0, 0, 0, 0, "on" },
2784
-#endif
2785
- { "clean-glob", 0, 40, 1, 0, "" },
2786
- { "clearsign", 0, 0, 0, 0, "off" },
2787
- { "crlf-glob", 0, 40, 1, 0, "" },
2788
- { "crnl-glob", 0, 40, 1, 0, "" },
2789
- { "default-perms", 0, 16, 0, 0, "u" },
2790
- { "diff-binary", 0, 0, 0, 0, "on" },
2791
- { "diff-command", 0, 40, 0, 0, "" },
2792
- { "dont-push", 0, 0, 0, 0, "off" },
2793
- { "dotfiles", 0, 0, 1, 0, "off" },
2794
- { "editor", 0, 32, 0, 0, "" },
2795
- { "empty-dirs", 0, 40, 1, 0, "" },
2796
- { "encoding-glob", 0, 40, 1, 0, "" },
2780
+/*
2781
+** SETTING: allow-symlinks boolean default=off versionable
2782
+** Allows symbolic links in the repository when enabled.
2783
+*/
2784
+#endif
2785
+#if !defined(_WIN32)
2786
+/*
2787
+** SETTING: allow-symlinks boolean default=on versionable
2788
+** Allows symbolic links in the repository when enabled.
2789
+*/
2790
+#endif
2791
+/*
2792
+** SETTING: auto-captcha boolean default=on variable=autocaptcha
2793
+** If enabled, the /login page provides a button that will automatically
2794
+** fill in the captcha password. This makes things easier for human users,
2795
+** at the expense of also making logins easier for malecious robots.
2796
+*/
2797
+/*
2798
+** SETTING: auto-hyperlink boolean default=on
2799
+** Use javascript to enable hyperlinks on web pages
2800
+** for all users (regardless of the "h" privilege) if the
2801
+** User-Agent string in the HTTP header look like it came
2802
+** from real person, not a spider or bot.
2803
+*/
2804
+/*
2805
+** SETTING: auto-shun boolean default=on
2806
+** If enabled, automatically pull the shunning list
2807
+** from a server to which the client autosyncs.
2808
+*/
2809
+/*
2810
+** SETTING: autosync width=16 default=on
2811
+** This setting can take either a boolean value or "pullonly"
2812
+** If enabled, automatically pull prior to commit
2813
+** or update and automatically push after commit or
2814
+** tag or branch creation. If the value is "pullonly"
2815
+** then only pull operations occur automatically.
2816
+*/
2817
+/*
2818
+** SETTING: autosync-tries width=16 default=1
2819
+** If autosync is enabled setting this to a value greater
2820
+** than zero will cause autosync to try no more than this
2821
+** number of attempts if there is a sync failure.
2822
+*/
2823
+/*
2824
+** SETTING: binary-glob width=40 versionable
2825
+** The VALUE of this setting is a comma or newline-separated list of
2826
+** GLOB patterns that should be treated as binary files
2827
+** for committing and merging purposes. Example: *.jpg
2828
+*/
2829
+#if defined(_WIN32)||defined(__CYGWIN__)||defined(__DARWIN__)
2830
+/*
2831
+** SETTING: case-sensitive boolean default=off
2832
+** If TRUE, the files whose names differ only in case
2833
+** are considered distinct. If FALSE files whose names
2834
+** differ only in case are the same file. Defaults to
2835
+** TRUE for unix and FALSE for Cygwin, Mac and Windows.
2836
+*/
2837
+#endif
2838
+#if !(defined(_WIN32)||defined(__CYGWIN__)||defined(__DARWIN__))
2839
+/*
2840
+** SETTING: case-sensitive boolean default=on
2841
+** If TRUE, the files whose names differ only in case
2842
+** are considered distinct. If FALSE files whose names
2843
+** differ only in case are the same file. Defaults to
2844
+** TRUE for unix and FALSE for Cygwin, Mac and Windows.
2845
+*/
2846
+#endif
2847
+/*
2848
+** STTING: clean-glob width=40 versionable
2849
+** The VALUE of this setting is a comma or newline-separated list of GLOB
2850
+** patterns specifying files that the "clean" command will
2851
+** delete without prompting or allowing undo.
2852
+** Example: *.a,*.lib,*.o
2853
+*/
2854
+/*
2855
+** SETTING: clearsign boolean default=off
2856
+** When enabled, fossil will attempt to sign all commits
2857
+** with gpg. When disabled, commits will be unsigned.
2858
+*/
2859
+/*
2860
+** SETTING: crlf-glob width=40 versionable
2861
+** The value is a comma or newline-separated list of GLOB patterns for
2862
+** text files in which it is ok to have CR, CR+LF or mixed
2863
+** line endings. Set to "*" to disable CR+LF checking.
2864
+** The crnl-glob setting is a compatibility alias.
2865
+*/
2866
+/*
2867
+** SETTING: crnl-glob width=40 versionable
2868
+** This is an alias for the crlf-glob setting
2869
+*/
2870
+/*
2871
+** SETTING: default-perms width=16 default=u
2872
+** Permissions given automatically to new users. For more
2873
+** information on permissions see the Users page in Server
2874
+** Administration of the HTTP UI.
2875
+*/
2876
+/* SETTING: diff-binary boolean default=on
2877
+** If enabled, permit files that may be binary
2878
+** or that match the "binary-glob" setting to be used with
2879
+** external diff programs. If disabled, skip these files.
2880
+*/
2881
+/*
2882
+** SETTING: diff-command width=40
2883
+** The value is an external command to run when performing a diff.
2884
+** If undefined, the internal text diff will be used.
2885
+*/
2886
+/*
2887
+** SETTING: dont-push boolean default=off
2888
+** If enabled, prevent this repository from pushing from client to
2889
+** server. This can be used as an extra precaution to prevent
2890
+** accidental pushes to a public server from a private clone.
2891
+*/
2892
+/*
2893
+** SETTING: dotfiles boolean versionable default=off
2894
+** If enabled, include --dotfiles option for all compatible commands.
2895
+*/
2896
+/*
2897
+** SETTING: editor width=32
2898
+** The value is an external command that will launch the
2899
+** text editor command used for check-in comments.
2900
+*/
2901
+/*
2902
+** SETTING: empty-dirs width=40 versionable
2903
+** The value is a comma or newline-separated list of pathnames. On
2904
+** update and checkout commands, if no file or directory
2905
+** exists with that name, an empty directory will be
2906
+** created.
2907
+*/
2908
+/*
2909
+** SETTING: encoding-glob width=40 versionable
2910
+** The value is a comma or newline-separated list of GLOB
2911
+** patterns specifying files that the "commit" command will
2912
+** ignore when issuing warnings about text files that may
2913
+** use another encoding than ASCII or UTF-8. Set to "*"
2914
+** to disable encoding checking.
2915
+*/
27972916
#if defined(FOSSIL_ENABLE_EXEC_REL_PATHS)
2798
- { "exec-rel-paths", 0, 0, 0, 0, "on" },
2799
-#else
2800
- { "exec-rel-paths", 0, 0, 0, 0, "off" },
2917
+/*
2918
+** SETTING: exec-rel-paths boolean default=on
2919
+** When executing certain external commands (e.g. diff and
2920
+** gdiff), use relative paths.
2921
+*/
2922
+#endif
2923
+#if !defined(FOSSIL_ENABLE_EXEC_REL_PATHS)
2924
+/*
2925
+** SETTING: exec-rel-paths boolean default=off
2926
+** When executing certain external commands (e.g. diff and
2927
+** gdiff), use relative paths.
2928
+*/
28012929
#endif
2802
- { "gdiff-command", 0, 40, 0, 0, "gdiff" },
2803
- { "gmerge-command", 0, 40, 0, 0, "" },
2804
- { "hash-digits", 0, 5, 0, 0, "10" },
2805
- { "http-port", 0, 16, 0, 0, "8080" },
2806
- { "https-login", 0, 0, 0, 0, "off" },
2807
- { "ignore-glob", 0, 40, 1, 0, "" },
2808
- { "keep-glob", 0, 40, 1, 0, "" },
2809
- { "localauth", 0, 0, 0, 0, "off" },
2810
- { "main-branch", 0, 40, 0, 0, "trunk" },
2811
- { "manifest", 0, 5, 1, 0, "" },
2812
- { "max-loadavg", 0, 25, 0, 0, "0.0" },
2813
- { "max-upload", 0, 25, 0, 0, "250000" },
2814
- { "mtime-changes", 0, 0, 0, 0, "on" },
2930
+/*
2931
+** SETTING; gdiff-command width=40 default=gdiff
2932
+** The value is an external command to run when performing a graphical
2933
+** diff. If undefined, text diff will be used.
2934
+*/
2935
+/*
2936
+** SETTING: gmerge-command width=40
2937
+** The value is a graphical merge conflict resolver command operating
2938
+** on four files. Examples:
2939
+**
2940
+** kdiff3 "%baseline" "%original" "%merge" -o "%output"
2941
+** xxdiff "%original" "%baseline" "%merge" -M "%output"
2942
+** meld "%baseline" "%original" "%merge" "%output"
2943
+*/
2944
+/*
2945
+** SETTING: hash-digits width=5 default=10
2946
+** The number of hexadecimal digits of the SHA3 hash to display.
2947
+*/
2948
+/*
2949
+** SETTING: http-port width=16 default=8080
2950
+** The default TCP/IP port number to use by the "server"
2951
+** and "ui" commands.
2952
+*/
2953
+/*
2954
+** SETTING: https-login boolean default=off
2955
+** If true, then the Fossil web server will redirect unencrypted
2956
+** login screeen requests to HTTPS.
2957
+*/
2958
+/*
2959
+** SETTING: ignore-glob width=40 versionable
2960
+** The value is a comma or newline-separated list of GLOB
2961
+** patterns specifying files that the "add", "addremove",
2962
+** "clean", and "extra" commands will ignore.
2963
+**
2964
+** Example: *.log customCode.c notes.txt
2965
+*/
2966
+/*
2967
+** SETTING: keep-glob width=40 versionable
2968
+** The value is a comma or newline-separated list of GLOB
2969
+** patterns specifying files that the "clean" command will keep
2970
+*/
2971
+/*
2972
+** SETTING: localauth boolean default=off
2973
+** If enabled, require that HTTP connections from
2974
+** 127.0.0.1 be authenticated by password. If
2975
+** false, all HTTP requests from localhost have
2976
+** unrestricted access to the repository.
2977
+*/
2978
+/*
2979
+** SETTING: main-branch width=40 default=trunk
2980
+** The value is the primary branch for the project.
2981
+*/
2982
+/*
2983
+** SETTING: manifest width=5 versionable
2984
+** If enabled, automatically create files "manifest" and "manifest.uuid"
2985
+** in every checkout.
2986
+**
2987
+** Optionally use combinations of characters 'r' for "manifest",
2988
+** 'u' for "manifest.uuid" and 't' for "manifest.tags". The SQLite
2989
+** and Fossil repositories both require manifests.
2990
+*/
2991
+/*
2992
+** SETTING: max-loadavg width=25 default=0.0
2993
+** Some CPU-intensive web pages (ex: /zip, /tarball, /blame)
2994
+** are disallowed if the system load average goes above this
2995
+** value. "0.0" means no limit. This only works on unix.
2996
+** Only local settings of this value make a difference since
2997
+** when running as a web-server, Fossil does not open the
2998
+** global configuration database.
2999
+*/
3000
+/*
3001
+** SETTING: max-upload width=25 default=250000
3002
+** A limit on the size of uplink HTTP requests.
3003
+*/
3004
+/*
3005
+** SETTING: mtime-changes boolean default=on
3006
+** Use file modification times (mtimes) to detect when
3007
+** files have been modified. If disabled, all managed files
3008
+** are hashed to detect changes, which can be slow for large
3009
+** projects.
3010
+*/
28153011
#if FOSSIL_ENABLE_LEGACY_MV_RM
2816
- { "mv-rm-files", 0, 0, 0, 0, "off" },
2817
-#endif
2818
- { "pgp-command", 0, 40, 0, 0, "gpg --clearsign -o " },
2819
- { "proxy", 0, 32, 0, 0, "off" },
2820
- { "relative-paths", 0, 0, 0, 0, "on" },
2821
- { "repo-cksum", 0, 0, 0, 0, "on" },
2822
- { "self-register", 0, 0, 0, 0, "off" },
2823
- { "ssh-command", 0, 40, 0, 0, "" },
2824
- { "ssl-ca-location", 0, 40, 0, 0, "" },
2825
- { "ssl-identity", 0, 40, 0, 0, "" },
2826
-#ifdef FOSSIL_ENABLE_TCL
2827
- { "tcl", 0, 0, 0, 0, "off" },
2828
- { "tcl-setup", 0, 40, 1, 1, "" },
2829
-#endif
2830
-#ifdef FOSSIL_ENABLE_TH1_DOCS
2831
- { "th1-docs", 0, 0, 0, 0, "off" },
3012
+/*
3013
+** SETTING: mv-rm-files boolean default=off
3014
+** If enabled, the "mv" and "rename" commands will also move
3015
+** the associated files within the checkout -AND- the "rm"
3016
+** and "delete" commands will also remove the associated
3017
+** files from within the checkout.
3018
+*/
3019
+#endif
3020
+/*
3021
+** SETTING; pgp-command width=40
3022
+** DEFAULT: gpg --clearsign -o
3023
+**
3024
+** Command used to clear-sign manifests at check-in.
3025
+*/
3026
+/*
3027
+** SETTING: proxy width=32 default=off
3028
+** URL of the HTTP proxy. If undefined or "off" then
3029
+** the "http_proxy" environment variable is consulted.
3030
+** If the http_proxy environment variable is undefined
3031
+** then a direct HTTP connection is used.
3032
+*/
3033
+/*
3034
+** SETTING: relative-paths boolean default=on
3035
+** When showing changes and extras, report paths relative
3036
+** to the current working directory.
3037
+*/
3038
+/*
3039
+** SETTING: repo-cksum boolean default=on
3040
+** Compute checksums over all files in each checkout as a double-check
3041
+** of correctness. Disable this on large repositories for a performance
3042
+** improvement.
3043
+*/
3044
+/*
3045
+** SETTING: self-register boolean default=off
3046
+** Allow users to register themselves through the HTTP UI.
3047
+** This is useful if you want to see other names than
3048
+** "Anonymous" in e.g. ticketing system. On the other hand
3049
+** users can not be deleted.
3050
+*/
3051
+/*
3052
+** SETTING: ssh-command width=40
3053
+** The command used to talk to a remote machine with the "ssh://" protocol.
3054
+*/
3055
+/*
3056
+** SETTING: ssl-ca-location width=40
3057
+** The full pathname to a file containing PEM encoded
3058
+** CA root certificates, or a directory of certificates
3059
+** with filenames formed from the certificate hashes as
3060
+** required by OpenSSL.
3061
+**
3062
+** If set, this will override the OS default list of
3063
+** OpenSSL CAs. If unset, the default list will be used.
3064
+** Some platforms may add additional certificates.
3065
+** Checking your platform behaviour is required if the
3066
+** exact contents of the CA root is critical for your
3067
+** application.
3068
+*/
3069
+/*
3070
+** SETTING: ssl-identity width=40
3071
+** The full pathname to a file containing a certificate
3072
+** and private key in PEM format. Create by concatenating
3073
+** the certificate and private key files.
3074
+**
3075
+** This identity will be presented to SSL servers to
3076
+** authenticate this client, in addition to the normal
3077
+** password authentication.
3078
+*/
3079
+#ifdef FOSSIL_ENABLE_TCL
3080
+/*
3081
+** SETTING: tcl boolean default=off
3082
+** If enabled Tcl integration commands will be added to the TH1
3083
+** interpreter, allowing arbitrary Tcl expressions and
3084
+** scripts to be evaluated from TH1. Additionally, the Tcl
3085
+** interpreter will be able to evaluate arbitrary TH1
3086
+** expressions and scripts.
3087
+*/
3088
+/*
3089
+** SETTING: tcl-setup width=40 versionable block-text
3090
+** This is the setup script to be evaluated after creating
3091
+** and initializing the Tcl interpreter. By default, this
3092
+** is empty and no extra setup is performed.
3093
+*/
3094
+#endif /* FOSSIL_ENABLE_TCL */
3095
+#ifdef FOSSIL_ENABLE_TH1_DOCS
3096
+/*
3097
+** SETTING: th1-docs boolean default=off
3098
+** If enabled, this allows embedded documentation files to contain
3099
+** arbitrary TH1 scripts that are evaluated on the server. If native
3100
+** Tcl integration is also enabled, this setting has the
3101
+** potential to allow anybody with check-in privileges to
3102
+** do almost anything that the associated operating system
3103
+** user account could do. Extreme caution should be used
3104
+** when enabling this setting.
3105
+*/
28323106
#endif
28333107
#ifdef FOSSIL_ENABLE_TH1_HOOKS
2834
- { "th1-hooks", 0, 0, 0, 0, "off" },
3108
+/*
3109
+** SETTING: th1-hooks boolean default=off
3110
+** If enabled, special TH1 commands will be called before and
3111
+** after any Fossil command or web page.
3112
+*/
28353113
#endif
2836
- { "th1-setup", 0, 40, 1, 1, "" },
2837
- { "th1-uri-regexp", 0, 40, 1, 0, "" },
2838
- { "uv-sync", 0, 0, 0, 0, "off" },
2839
- { "web-browser", 0, 32, 0, 0, "" },
2840
- { 0,0,0,0,0,0 }
2841
-};
3114
+/*
3115
+** SETTING: th1-setup width=40 versionable block-text
3116
+** This is the setup script to be evaluated after creating
3117
+** and initializing the TH1 interpreter. By default, this
3118
+** is empty and no extra setup is performed.
3119
+*/
3120
+/*
3121
+** SETTING: th1-uri-regexp width=40 versionable
3122
+** Specify which URI's are allowed in HTTP requests from
3123
+** TH1 scripts. If empty, no HTTP requests are allowed
3124
+** whatsoever.
3125
+*/
3126
+/*
3127
+** SETTING: uv-sync boolean default=off
3128
+** If true, automatically send unversioned files as part
3129
+** of a "fossil clone" or "fossil sync" command. The
3130
+** default is false, in which case the -u option is
3131
+** needed to clone or sync unversioned files.
3132
+*/
3133
+/*
3134
+** SETTING: web-browser width=30
3135
+** A shell command used to launch your preferred
3136
+** web browser when given a URL as an argument.
3137
+** Defaults to "start" on windows, "open" on Mac,
3138
+** and "firefox" on Unix.
3139
+*/
28423140
28433141
/*
28443142
** Look up a control setting by its name. Return a pointer to the Setting
28453143
** object, or NULL if there is no such setting.
28463144
**
28473145
** If allowPrefix is true, then the Setting returned is the first one for
28483146
** which zName is a prefix of the Setting name.
28493147
*/
2850
-const Setting *db_find_setting(const char *zName, int allowPrefix){
3148
+Setting *db_find_setting(const char *zName, int allowPrefix){
28513149
int lwr, mid, upr, c;
28523150
int n = (int)strlen(zName) + !allowPrefix;
3151
+ int nSetting;
3152
+ const Setting *aSetting = setting_info(&nSetting);
28533153
lwr = 0;
2854
- upr = count(aSetting)-2;
3154
+ upr = nSetting - 1;
28553155
while( upr>=lwr ){
28563156
mid = (upr+lwr)/2;
28573157
c = fossil_strncmp(zName, aSetting[mid].name, n);
28583158
if( c<0 ){
28593159
upr = mid - 1;
@@ -2863,269 +3163,40 @@
28633163
if( allowPrefix ){
28643164
while( mid>lwr && fossil_strncmp(zName, aSetting[mid-1].name, n)==0 ){
28653165
mid--;
28663166
}
28673167
}
2868
- return &aSetting[mid];
3168
+ return (Setting*)&aSetting[mid];
28693169
}
28703170
}
28713171
return 0;
28723172
}
28733173
28743174
/*
28753175
** COMMAND: settings
28763176
** COMMAND: unset*
28773177
**
2878
-** Usage: %fossil settings ?PROPERTY? ?VALUE? ?OPTIONS?
2879
-** or: %fossil unset PROPERTY ?OPTIONS?
3178
+** Usage: %fossil settings ?SETTING? ?VALUE? ?OPTIONS?
3179
+** or: %fossil unset SETTING ?OPTIONS?
28803180
**
2881
-** The "settings" command with no arguments lists all properties and their
2882
-** values. With just a property name it shows the value of that property.
2883
-** With a value argument it changes the property for the current repository.
3181
+** The "settings" command with no arguments lists all settings and their
3182
+** values. With just a SETTING name it shows the current value of that setting.
3183
+** With a VALUE argument it changes the property for the current repository.
28843184
**
28853185
** Settings marked as versionable are overridden by the contents of the
28863186
** file named .fossil-settings/PROPERTY in the check-out root, if that
28873187
** file exists.
28883188
**
2889
-** The "unset" command clears a property setting.
2890
-**
2891
-**
2892
-** access-log If enabled, record successful and failed login attempts
2893
-** in the "accesslog" table. Default: off
2894
-**
2895
-** admin-log If enabled, record configuration changes in the
2896
-** "admin_log" table. Default: off
2897
-**
2898
-** allow-symlinks If enabled, don't follow symlinks, and instead treat
2899
-** (versionable) them as symlinks on Unix. Has no effect on Windows
2900
-** (existing links in repository created on Unix become
2901
-** plain-text files with link destination path inside).
2902
-** Default: on (Unix), off (Windows)
2903
-**
2904
-** auto-captcha If enabled, the Login page provides a button to
2905
-** fill in the captcha password. Default: on
2906
-**
2907
-** auto-hyperlink Use javascript to enable hyperlinks on web pages
2908
-** for all users (regardless of the "h" privilege) if the
2909
-** User-Agent string in the HTTP header look like it came
2910
-** from real person, not a spider or bot. Default: on
2911
-**
2912
-** auto-shun If enabled, automatically pull the shunning list
2913
-** from a server to which the client autosyncs.
2914
-** Default: on
2915
-**
2916
-** autosync If enabled, automatically pull prior to commit
2917
-** or update and automatically push after commit or
2918
-** tag or branch creation. If the value is "pullonly"
2919
-** then only pull operations occur automatically.
2920
-** Default: on
2921
-**
2922
-** autosync-tries If autosync is enabled setting this to a value greater
2923
-** than zero will cause autosync to try no more than this
2924
-** number of attempts if there is a sync failure.
2925
-** Default: 1
2926
-**
2927
-** binary-glob The VALUE is a comma or newline-separated list of
2928
-** (versionable) GLOB patterns that should be treated as binary files
2929
-** for committing and merging purposes. Example: *.jpg
2930
-**
2931
-** case-sensitive If TRUE, the files whose names differ only in case
2932
-** are considered distinct. If FALSE files whose names
2933
-** differ only in case are the same file. Defaults to
2934
-** TRUE for unix and FALSE for Cygwin, Mac and Windows.
2935
-**
2936
-** clean-glob The VALUE is a comma or newline-separated list of GLOB
2937
-** (versionable) patterns specifying files that the "clean" command will
2938
-** delete without prompting or allowing undo.
2939
-** Example: *.a,*.lib,*.o
2940
-**
2941
-** clearsign When enabled, fossil will attempt to sign all commits
2942
-** with gpg. When disabled (the default), commits will
2943
-** be unsigned. Default: off
2944
-**
2945
-** crlf-glob A comma or newline-separated list of GLOB patterns for
2946
-** (versionable) text files in which it is ok to have CR, CR+LF or mixed
2947
-** line endings. Set to "*" to disable CR+LF checking.
2948
-** The crnl-glob setting is a compatibility alias.
2949
-**
2950
-** default-perms Permissions given automatically to new users. For more
2951
-** information on permissions see Users page in Server
2952
-** Administration of the HTTP UI. Default: u.
2953
-**
2954
-** diff-binary If TRUE (the default), permit files that may be binary
2955
-** or that match the "binary-glob" setting to be used with
2956
-** external diff programs. If FALSE, skip these files.
2957
-**
2958
-** diff-command External command to run when performing a diff.
2959
-** If undefined, the internal text diff will be used.
2960
-**
2961
-** dont-push Prevent this repository from pushing from client to
2962
-** server. Useful when setting up a private branch.
2963
-**
2964
-** dotfiles Include --dotfiles option for all compatible commands.
2965
-** (versionable)
2966
-**
2967
-** editor Text editor command used for check-in comments.
2968
-**
2969
-** empty-dirs A comma or newline-separated list of pathnames. On
2970
-** (versionable) update and checkout commands, if no file or directory
2971
-** exists with that name, an empty directory will be
2972
-** created.
2973
-**
2974
-** encoding-glob The VALUE is a comma or newline-separated list of GLOB
2975
-** (versionable) patterns specifying files that the "commit" command will
2976
-** ignore when issuing warnings about text files that may
2977
-** use another encoding than ASCII or UTF-8. Set to "*"
2978
-** to disable encoding checking.
2979
-**
2980
-** exec-rel-paths When executing certain external commands (e.g. diff and
2981
-** gdiff), use relative paths.
2982
-**
2983
-** gdiff-command External command to run when performing a graphical
2984
-** diff. If undefined, text diff will be used.
2985
-**
2986
-** gmerge-command A graphical merge conflict resolver command operating
2987
-** on four files.
2988
-** Ex: kdiff3 "%baseline" "%original" "%merge" -o "%output"
2989
-** Ex: xxdiff "%original" "%baseline" "%merge" -M "%output"
2990
-** Ex: meld "%baseline" "%original" "%merge" "%output"
2991
-**
2992
-** hash-digits The number of hexadecimal digits of the SHA1 hash to
2993
-** display. (Default: 10; Minimum: 6)
2994
-**
2995
-** http-port The TCP/IP port number to use by the "server"
2996
-** and "ui" commands. Default: 8080
2997
-**
2998
-** https-login Send login credentials using HTTPS instead of HTTP
2999
-** even if the login page request came via HTTP.
3000
-**
3001
-** ignore-glob The VALUE is a comma or newline-separated list of GLOB
3002
-** (versionable) patterns specifying files that the "add", "addremove",
3003
-** "clean", and "extra" commands will ignore.
3004
-** Example: *.log customCode.c notes.txt
3005
-**
3006
-** keep-glob The VALUE is a comma or newline-separated list of GLOB
3007
-** (versionable) patterns specifying files that the "clean" command will
3008
-** keep.
3009
-**
3010
-** localauth If enabled, require that HTTP connections from
3011
-** 127.0.0.1 be authenticated by password. If
3012
-** false, all HTTP requests from localhost have
3013
-** unrestricted access to the repository.
3014
-**
3015
-** main-branch The primary branch for the project. Default: trunk
3016
-**
3017
-** manifest If set to a true boolean value, automatically create
3018
-** (versionable) files "manifest" and "manifest.uuid" in every checkout.
3019
-** Optionally use combinations of characters 'r'
3020
-** for "manifest", 'u' for "manifest.uuid" and 't' for
3021
-** "manifest.tags". The SQLite and Fossil repositories
3022
-** both require manifests. Default: off.
3023
-**
3024
-** max-loadavg Some CPU-intensive web pages (ex: /zip, /tarball, /blame)
3025
-** are disallowed if the system load average goes above this
3026
-** value. "0.0" means no limit. This only works on unix.
3027
-** Only local settings of this value make a difference since
3028
-** when running as a web-server, Fossil does not open the
3029
-** global configuration database.
3030
-**
3031
-** max-upload A limit on the size of uplink HTTP requests. The
3032
-** default is 250000 bytes.
3033
-**
3034
-** mtime-changes Use file modification times (mtimes) to detect when
3035
-** files have been modified. (Default "on".)
3036
-**
3037
-** mv-rm-files If enabled (and Fossil was compiled with legacy "mv/rm"
3038
-** support), the "mv" and "rename" commands will also move
3039
-** the associated files within the checkout -AND- the "rm"
3040
-** and "delete" commands will also remove the associated
3041
-** files from within the checkout. Default: off.
3042
-**
3043
-** pgp-command Command used to clear-sign manifests at check-in.
3044
-** The default is "gpg --clearsign -o ".
3045
-**
3046
-** proxy URL of the HTTP proxy. If undefined or "off" then
3047
-** the "http_proxy" environment variable is consulted.
3048
-** If the http_proxy environment variable is undefined
3049
-** then a direct HTTP connection is used.
3050
-**
3051
-** relative-paths When showing changes and extras, report paths relative
3052
-** to the current working directory. Default: "on"
3053
-**
3054
-** repo-cksum Compute checksums over all files in each checkout
3055
-** as a double-check of correctness. Defaults to "on".
3056
-** Disable on large repositories for a performance
3057
-** improvement.
3058
-**
3059
-** self-register Allow users to register themselves through the HTTP UI.
3060
-** This is useful if you want to see other names than
3061
-** "Anonymous" in e.g. ticketing system. On the other hand
3062
-** users can not be deleted. Default: off.
3063
-**
3064
-** ssh-command Command used to talk to a remote machine with
3065
-** the "ssh://" protocol.
3066
-**
3067
-** ssl-ca-location The full pathname to a file containing PEM encoded
3068
-** CA root certificates, or a directory of certificates
3069
-** with filenames formed from the certificate hashes as
3070
-** required by OpenSSL.
3071
-** If set, this will override the OS default list of
3072
-** OpenSSL CAs. If unset, the default list will be used.
3073
-** Some platforms may add additional certificates.
3074
-** Checking your platform behaviour is required if the
3075
-** exact contents of the CA root is critical for your
3076
-** application.
3077
-**
3078
-** ssl-identity The full pathname to a file containing a certificate
3079
-** and private key in PEM format. Create by concatenating
3080
-** the certificate and private key files.
3081
-** This identity will be presented to SSL servers to
3082
-** authenticate this client, in addition to the normal
3083
-** password authentication.
3084
-**
3085
-** tcl If enabled (and Fossil was compiled with Tcl support),
3086
-** Tcl integration commands will be added to the TH1
3087
-** interpreter, allowing arbitrary Tcl expressions and
3088
-** scripts to be evaluated from TH1. Additionally, the Tcl
3089
-** interpreter will be able to evaluate arbitrary TH1
3090
-** expressions and scripts. Default: off.
3091
-**
3092
-** tcl-setup This is the setup script to be evaluated after creating
3093
-** (versionable) and initializing the Tcl interpreter. By default, this
3094
-** is empty and no extra setup is performed.
3095
-**
3096
-** th1-docs WARNING: If enabled (and Fossil was compiled with TH1
3097
-** support for embedded documentation files), this allows
3098
-** embedded documentation files to contain arbitrary TH1
3099
-** scripts that are evaluated on the server. If native
3100
-** Tcl integration is also enabled, this setting has the
3101
-** potential to allow anybody with check-in privileges to
3102
-** do almost anything that the associated operating system
3103
-** user account could do. Extreme caution should be used
3104
-** when enabling this setting. Default: off.
3105
-**
3106
-** th1-hooks If enabled (and Fossil was compiled with support for TH1
3107
-** hooks), special TH1 commands will be called before and
3108
-** after any Fossil command or web page. Default: off.
3109
-**
3110
-** th1-setup This is the setup script to be evaluated after creating
3111
-** (versionable) and initializing the TH1 interpreter. By default, this
3112
-** is empty and no extra setup is performed.
3113
-**
3114
-** th1-uri-regexp Specify which URI's are allowed in HTTP requests from
3115
-** (versionable) TH1 scripts. If empty, no HTTP requests are allowed
3116
-** whatsoever. The default is an empty string.
3117
-**
3118
-** uv-sync If true, automatically send unversioned files as part
3119
-** of a "fossil clone" or "fossil sync" command. The
3120
-** default is false, in which case the -u option is
3121
-** needed to clone or sync unversioned files.
3122
-**
3123
-** web-browser A shell command used to launch your preferred
3124
-** web browser when given a URL as an argument.
3125
-** Defaults to "start" on windows, "open" on Mac,
3126
-** and "firefox" on Unix.
3189
+** The "unset" command clears a setting.
3190
+**
3191
+** Settings can have both a "local" repository-only value and "global" value
3192
+** that applies to all repositories. The local values are stored in the
3193
+** "config" table of the repository and the global values are stored in the
3194
+** $HOME/.fossil file on unix or in the %LOCALAPPDATA%/_fossil file on Windows.
3195
+** If both a local and a global value exists for a setting, the local value
3196
+** takes precedence. This command normally operates on the local settings.
3197
+** Use the --global option to change global settings.
31273198
**
31283199
** Options:
31293200
** --global set or unset the given property globally instead of
31303201
** setting or unsetting it for the open repository only.
31313202
**
@@ -3136,10 +3207,12 @@
31363207
void setting_cmd(void){
31373208
int i;
31383209
int globalFlag = find_option("global","g",0)!=0;
31393210
int exactFlag = find_option("exact",0,0)!=0;
31403211
int unsetFlag = g.argv[1][0]=='u';
3212
+ int nSetting;
3213
+ const Setting *aSetting = setting_info(&nSetting);
31413214
find_repository_option();
31423215
verify_all_options();
31433216
db_open_config(1, 0);
31443217
if( !globalFlag ){
31453218
db_find_and_open_repository(OPEN_ANY_SCHEMA | OPEN_OK_NOT_FOUND, 0);
@@ -3149,23 +3222,12 @@
31493222
}
31503223
if( unsetFlag && g.argc!=3 ){
31513224
usage("PROPERTY ?-global?");
31523225
}
31533226
3154
- /* Verify that the aSetting[] entries are in sorted order. This is
3155
- ** necessary for the binary search in db_find_setting() to work correctly.
3156
- */
3157
- for(i=1; aSetting[i].name; i++){
3158
- if( fossil_strcmp(aSetting[i-1].name, aSetting[i].name)>=0 ){
3159
- fossil_panic("Internal Error: aSetting[] entries for \"%s\""
3160
- " and \"%s\" are out of order.",
3161
- aSetting[i-1].name, aSetting[i].name);
3162
- }
3163
- }
3164
-
31653227
if( g.argc==2 ){
3166
- for(i=0; aSetting[i].name; i++){
3228
+ for(i=0; i<nSetting; i++){
31673229
print_setting(&aSetting[i]);
31683230
}
31693231
}else if( g.argc==3 || g.argc==4 ){
31703232
const char *zName = g.argv[2];
31713233
int n = (int)strlen(zName);
31723234
--- src/db.c
+++ src/db.c
@@ -1804,15 +1804,17 @@
1804 ** settings.
1805 */
1806 const char *db_setting_inop_rhs(){
1807 Blob x;
1808 int i;
 
 
1809 const char *zSep = "";
1810
1811 blob_zero(&x);
1812 blob_append_sql(&x, "(");
1813 for(i=0; aSetting[i].name; i++){
1814 blob_append_sql(&x, "%s%Q", zSep/*safe-for-%s*/, aSetting[i].name);
1815 zSep = ",";
1816 }
1817 blob_append_sql(&x, ")");
1818 return blob_sql_text(&x);
@@ -2735,11 +2737,10 @@
2735 }
2736 }
2737 db_finalize(&q);
2738 }
2739
2740
2741 #if INTERFACE
2742 /*
2743 ** Define all settings, which can be controlled via the set/unset
2744 ** command.
2745 **
@@ -2760,100 +2761,399 @@
2760 int forceTextArea; /* Force using a text area for display? */
2761 const char *def; /* Default value */
2762 };
2763 #endif /* INTERFACE */
2764
2765 const Setting aSetting[] = {
2766 { "access-log", 0, 0, 0, 0, "off" },
2767 { "admin-log", 0, 0, 0, 0, "off" },
 
 
 
 
 
 
 
 
 
 
2768 #if defined(_WIN32)
2769 { "allow-symlinks", 0, 0, 1, 0, "off" },
2770 #else
2771 { "allow-symlinks", 0, 0, 1, 0, "on" },
2772 #endif
2773 { "auto-captcha", "autocaptcha", 0, 0, 0, "on" },
2774 { "auto-hyperlink", 0, 0, 0, 0, "on", },
2775 { "auto-shun", 0, 0, 0, 0, "on" },
2776 { "autosync", 0, 0, 0, 0, "on" },
2777 { "autosync-tries", 0, 16, 0, 0, "1" },
2778 { "binary-glob", 0, 40, 1, 0, "" },
2779 #if defined(_WIN32) || defined(__CYGWIN__) || defined(__DARWIN__) || \
2780 defined(__APPLE__)
2781 { "case-sensitive", 0, 0, 0, 0, "off" },
2782 #else
2783 { "case-sensitive", 0, 0, 0, 0, "on" },
2784 #endif
2785 { "clean-glob", 0, 40, 1, 0, "" },
2786 { "clearsign", 0, 0, 0, 0, "off" },
2787 { "crlf-glob", 0, 40, 1, 0, "" },
2788 { "crnl-glob", 0, 40, 1, 0, "" },
2789 { "default-perms", 0, 16, 0, 0, "u" },
2790 { "diff-binary", 0, 0, 0, 0, "on" },
2791 { "diff-command", 0, 40, 0, 0, "" },
2792 { "dont-push", 0, 0, 0, 0, "off" },
2793 { "dotfiles", 0, 0, 1, 0, "off" },
2794 { "editor", 0, 32, 0, 0, "" },
2795 { "empty-dirs", 0, 40, 1, 0, "" },
2796 { "encoding-glob", 0, 40, 1, 0, "" },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2797 #if defined(FOSSIL_ENABLE_EXEC_REL_PATHS)
2798 { "exec-rel-paths", 0, 0, 0, 0, "on" },
2799 #else
2800 { "exec-rel-paths", 0, 0, 0, 0, "off" },
 
 
 
 
 
 
 
 
 
2801 #endif
2802 { "gdiff-command", 0, 40, 0, 0, "gdiff" },
2803 { "gmerge-command", 0, 40, 0, 0, "" },
2804 { "hash-digits", 0, 5, 0, 0, "10" },
2805 { "http-port", 0, 16, 0, 0, "8080" },
2806 { "https-login", 0, 0, 0, 0, "off" },
2807 { "ignore-glob", 0, 40, 1, 0, "" },
2808 { "keep-glob", 0, 40, 1, 0, "" },
2809 { "localauth", 0, 0, 0, 0, "off" },
2810 { "main-branch", 0, 40, 0, 0, "trunk" },
2811 { "manifest", 0, 5, 1, 0, "" },
2812 { "max-loadavg", 0, 25, 0, 0, "0.0" },
2813 { "max-upload", 0, 25, 0, 0, "250000" },
2814 { "mtime-changes", 0, 0, 0, 0, "on" },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2815 #if FOSSIL_ENABLE_LEGACY_MV_RM
2816 { "mv-rm-files", 0, 0, 0, 0, "off" },
2817 #endif
2818 { "pgp-command", 0, 40, 0, 0, "gpg --clearsign -o " },
2819 { "proxy", 0, 32, 0, 0, "off" },
2820 { "relative-paths", 0, 0, 0, 0, "on" },
2821 { "repo-cksum", 0, 0, 0, 0, "on" },
2822 { "self-register", 0, 0, 0, 0, "off" },
2823 { "ssh-command", 0, 40, 0, 0, "" },
2824 { "ssl-ca-location", 0, 40, 0, 0, "" },
2825 { "ssl-identity", 0, 40, 0, 0, "" },
2826 #ifdef FOSSIL_ENABLE_TCL
2827 { "tcl", 0, 0, 0, 0, "off" },
2828 { "tcl-setup", 0, 40, 1, 1, "" },
2829 #endif
2830 #ifdef FOSSIL_ENABLE_TH1_DOCS
2831 { "th1-docs", 0, 0, 0, 0, "off" },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2832 #endif
2833 #ifdef FOSSIL_ENABLE_TH1_HOOKS
2834 { "th1-hooks", 0, 0, 0, 0, "off" },
 
 
 
 
2835 #endif
2836 { "th1-setup", 0, 40, 1, 1, "" },
2837 { "th1-uri-regexp", 0, 40, 1, 0, "" },
2838 { "uv-sync", 0, 0, 0, 0, "off" },
2839 { "web-browser", 0, 32, 0, 0, "" },
2840 { 0,0,0,0,0,0 }
2841 };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2842
2843 /*
2844 ** Look up a control setting by its name. Return a pointer to the Setting
2845 ** object, or NULL if there is no such setting.
2846 **
2847 ** If allowPrefix is true, then the Setting returned is the first one for
2848 ** which zName is a prefix of the Setting name.
2849 */
2850 const Setting *db_find_setting(const char *zName, int allowPrefix){
2851 int lwr, mid, upr, c;
2852 int n = (int)strlen(zName) + !allowPrefix;
 
 
2853 lwr = 0;
2854 upr = count(aSetting)-2;
2855 while( upr>=lwr ){
2856 mid = (upr+lwr)/2;
2857 c = fossil_strncmp(zName, aSetting[mid].name, n);
2858 if( c<0 ){
2859 upr = mid - 1;
@@ -2863,269 +3163,40 @@
2863 if( allowPrefix ){
2864 while( mid>lwr && fossil_strncmp(zName, aSetting[mid-1].name, n)==0 ){
2865 mid--;
2866 }
2867 }
2868 return &aSetting[mid];
2869 }
2870 }
2871 return 0;
2872 }
2873
2874 /*
2875 ** COMMAND: settings
2876 ** COMMAND: unset*
2877 **
2878 ** Usage: %fossil settings ?PROPERTY? ?VALUE? ?OPTIONS?
2879 ** or: %fossil unset PROPERTY ?OPTIONS?
2880 **
2881 ** The "settings" command with no arguments lists all properties and their
2882 ** values. With just a property name it shows the value of that property.
2883 ** With a value argument it changes the property for the current repository.
2884 **
2885 ** Settings marked as versionable are overridden by the contents of the
2886 ** file named .fossil-settings/PROPERTY in the check-out root, if that
2887 ** file exists.
2888 **
2889 ** The "unset" command clears a property setting.
2890 **
2891 **
2892 ** access-log If enabled, record successful and failed login attempts
2893 ** in the "accesslog" table. Default: off
2894 **
2895 ** admin-log If enabled, record configuration changes in the
2896 ** "admin_log" table. Default: off
2897 **
2898 ** allow-symlinks If enabled, don't follow symlinks, and instead treat
2899 ** (versionable) them as symlinks on Unix. Has no effect on Windows
2900 ** (existing links in repository created on Unix become
2901 ** plain-text files with link destination path inside).
2902 ** Default: on (Unix), off (Windows)
2903 **
2904 ** auto-captcha If enabled, the Login page provides a button to
2905 ** fill in the captcha password. Default: on
2906 **
2907 ** auto-hyperlink Use javascript to enable hyperlinks on web pages
2908 ** for all users (regardless of the "h" privilege) if the
2909 ** User-Agent string in the HTTP header look like it came
2910 ** from real person, not a spider or bot. Default: on
2911 **
2912 ** auto-shun If enabled, automatically pull the shunning list
2913 ** from a server to which the client autosyncs.
2914 ** Default: on
2915 **
2916 ** autosync If enabled, automatically pull prior to commit
2917 ** or update and automatically push after commit or
2918 ** tag or branch creation. If the value is "pullonly"
2919 ** then only pull operations occur automatically.
2920 ** Default: on
2921 **
2922 ** autosync-tries If autosync is enabled setting this to a value greater
2923 ** than zero will cause autosync to try no more than this
2924 ** number of attempts if there is a sync failure.
2925 ** Default: 1
2926 **
2927 ** binary-glob The VALUE is a comma or newline-separated list of
2928 ** (versionable) GLOB patterns that should be treated as binary files
2929 ** for committing and merging purposes. Example: *.jpg
2930 **
2931 ** case-sensitive If TRUE, the files whose names differ only in case
2932 ** are considered distinct. If FALSE files whose names
2933 ** differ only in case are the same file. Defaults to
2934 ** TRUE for unix and FALSE for Cygwin, Mac and Windows.
2935 **
2936 ** clean-glob The VALUE is a comma or newline-separated list of GLOB
2937 ** (versionable) patterns specifying files that the "clean" command will
2938 ** delete without prompting or allowing undo.
2939 ** Example: *.a,*.lib,*.o
2940 **
2941 ** clearsign When enabled, fossil will attempt to sign all commits
2942 ** with gpg. When disabled (the default), commits will
2943 ** be unsigned. Default: off
2944 **
2945 ** crlf-glob A comma or newline-separated list of GLOB patterns for
2946 ** (versionable) text files in which it is ok to have CR, CR+LF or mixed
2947 ** line endings. Set to "*" to disable CR+LF checking.
2948 ** The crnl-glob setting is a compatibility alias.
2949 **
2950 ** default-perms Permissions given automatically to new users. For more
2951 ** information on permissions see Users page in Server
2952 ** Administration of the HTTP UI. Default: u.
2953 **
2954 ** diff-binary If TRUE (the default), permit files that may be binary
2955 ** or that match the "binary-glob" setting to be used with
2956 ** external diff programs. If FALSE, skip these files.
2957 **
2958 ** diff-command External command to run when performing a diff.
2959 ** If undefined, the internal text diff will be used.
2960 **
2961 ** dont-push Prevent this repository from pushing from client to
2962 ** server. Useful when setting up a private branch.
2963 **
2964 ** dotfiles Include --dotfiles option for all compatible commands.
2965 ** (versionable)
2966 **
2967 ** editor Text editor command used for check-in comments.
2968 **
2969 ** empty-dirs A comma or newline-separated list of pathnames. On
2970 ** (versionable) update and checkout commands, if no file or directory
2971 ** exists with that name, an empty directory will be
2972 ** created.
2973 **
2974 ** encoding-glob The VALUE is a comma or newline-separated list of GLOB
2975 ** (versionable) patterns specifying files that the "commit" command will
2976 ** ignore when issuing warnings about text files that may
2977 ** use another encoding than ASCII or UTF-8. Set to "*"
2978 ** to disable encoding checking.
2979 **
2980 ** exec-rel-paths When executing certain external commands (e.g. diff and
2981 ** gdiff), use relative paths.
2982 **
2983 ** gdiff-command External command to run when performing a graphical
2984 ** diff. If undefined, text diff will be used.
2985 **
2986 ** gmerge-command A graphical merge conflict resolver command operating
2987 ** on four files.
2988 ** Ex: kdiff3 "%baseline" "%original" "%merge" -o "%output"
2989 ** Ex: xxdiff "%original" "%baseline" "%merge" -M "%output"
2990 ** Ex: meld "%baseline" "%original" "%merge" "%output"
2991 **
2992 ** hash-digits The number of hexadecimal digits of the SHA1 hash to
2993 ** display. (Default: 10; Minimum: 6)
2994 **
2995 ** http-port The TCP/IP port number to use by the "server"
2996 ** and "ui" commands. Default: 8080
2997 **
2998 ** https-login Send login credentials using HTTPS instead of HTTP
2999 ** even if the login page request came via HTTP.
3000 **
3001 ** ignore-glob The VALUE is a comma or newline-separated list of GLOB
3002 ** (versionable) patterns specifying files that the "add", "addremove",
3003 ** "clean", and "extra" commands will ignore.
3004 ** Example: *.log customCode.c notes.txt
3005 **
3006 ** keep-glob The VALUE is a comma or newline-separated list of GLOB
3007 ** (versionable) patterns specifying files that the "clean" command will
3008 ** keep.
3009 **
3010 ** localauth If enabled, require that HTTP connections from
3011 ** 127.0.0.1 be authenticated by password. If
3012 ** false, all HTTP requests from localhost have
3013 ** unrestricted access to the repository.
3014 **
3015 ** main-branch The primary branch for the project. Default: trunk
3016 **
3017 ** manifest If set to a true boolean value, automatically create
3018 ** (versionable) files "manifest" and "manifest.uuid" in every checkout.
3019 ** Optionally use combinations of characters 'r'
3020 ** for "manifest", 'u' for "manifest.uuid" and 't' for
3021 ** "manifest.tags". The SQLite and Fossil repositories
3022 ** both require manifests. Default: off.
3023 **
3024 ** max-loadavg Some CPU-intensive web pages (ex: /zip, /tarball, /blame)
3025 ** are disallowed if the system load average goes above this
3026 ** value. "0.0" means no limit. This only works on unix.
3027 ** Only local settings of this value make a difference since
3028 ** when running as a web-server, Fossil does not open the
3029 ** global configuration database.
3030 **
3031 ** max-upload A limit on the size of uplink HTTP requests. The
3032 ** default is 250000 bytes.
3033 **
3034 ** mtime-changes Use file modification times (mtimes) to detect when
3035 ** files have been modified. (Default "on".)
3036 **
3037 ** mv-rm-files If enabled (and Fossil was compiled with legacy "mv/rm"
3038 ** support), the "mv" and "rename" commands will also move
3039 ** the associated files within the checkout -AND- the "rm"
3040 ** and "delete" commands will also remove the associated
3041 ** files from within the checkout. Default: off.
3042 **
3043 ** pgp-command Command used to clear-sign manifests at check-in.
3044 ** The default is "gpg --clearsign -o ".
3045 **
3046 ** proxy URL of the HTTP proxy. If undefined or "off" then
3047 ** the "http_proxy" environment variable is consulted.
3048 ** If the http_proxy environment variable is undefined
3049 ** then a direct HTTP connection is used.
3050 **
3051 ** relative-paths When showing changes and extras, report paths relative
3052 ** to the current working directory. Default: "on"
3053 **
3054 ** repo-cksum Compute checksums over all files in each checkout
3055 ** as a double-check of correctness. Defaults to "on".
3056 ** Disable on large repositories for a performance
3057 ** improvement.
3058 **
3059 ** self-register Allow users to register themselves through the HTTP UI.
3060 ** This is useful if you want to see other names than
3061 ** "Anonymous" in e.g. ticketing system. On the other hand
3062 ** users can not be deleted. Default: off.
3063 **
3064 ** ssh-command Command used to talk to a remote machine with
3065 ** the "ssh://" protocol.
3066 **
3067 ** ssl-ca-location The full pathname to a file containing PEM encoded
3068 ** CA root certificates, or a directory of certificates
3069 ** with filenames formed from the certificate hashes as
3070 ** required by OpenSSL.
3071 ** If set, this will override the OS default list of
3072 ** OpenSSL CAs. If unset, the default list will be used.
3073 ** Some platforms may add additional certificates.
3074 ** Checking your platform behaviour is required if the
3075 ** exact contents of the CA root is critical for your
3076 ** application.
3077 **
3078 ** ssl-identity The full pathname to a file containing a certificate
3079 ** and private key in PEM format. Create by concatenating
3080 ** the certificate and private key files.
3081 ** This identity will be presented to SSL servers to
3082 ** authenticate this client, in addition to the normal
3083 ** password authentication.
3084 **
3085 ** tcl If enabled (and Fossil was compiled with Tcl support),
3086 ** Tcl integration commands will be added to the TH1
3087 ** interpreter, allowing arbitrary Tcl expressions and
3088 ** scripts to be evaluated from TH1. Additionally, the Tcl
3089 ** interpreter will be able to evaluate arbitrary TH1
3090 ** expressions and scripts. Default: off.
3091 **
3092 ** tcl-setup This is the setup script to be evaluated after creating
3093 ** (versionable) and initializing the Tcl interpreter. By default, this
3094 ** is empty and no extra setup is performed.
3095 **
3096 ** th1-docs WARNING: If enabled (and Fossil was compiled with TH1
3097 ** support for embedded documentation files), this allows
3098 ** embedded documentation files to contain arbitrary TH1
3099 ** scripts that are evaluated on the server. If native
3100 ** Tcl integration is also enabled, this setting has the
3101 ** potential to allow anybody with check-in privileges to
3102 ** do almost anything that the associated operating system
3103 ** user account could do. Extreme caution should be used
3104 ** when enabling this setting. Default: off.
3105 **
3106 ** th1-hooks If enabled (and Fossil was compiled with support for TH1
3107 ** hooks), special TH1 commands will be called before and
3108 ** after any Fossil command or web page. Default: off.
3109 **
3110 ** th1-setup This is the setup script to be evaluated after creating
3111 ** (versionable) and initializing the TH1 interpreter. By default, this
3112 ** is empty and no extra setup is performed.
3113 **
3114 ** th1-uri-regexp Specify which URI's are allowed in HTTP requests from
3115 ** (versionable) TH1 scripts. If empty, no HTTP requests are allowed
3116 ** whatsoever. The default is an empty string.
3117 **
3118 ** uv-sync If true, automatically send unversioned files as part
3119 ** of a "fossil clone" or "fossil sync" command. The
3120 ** default is false, in which case the -u option is
3121 ** needed to clone or sync unversioned files.
3122 **
3123 ** web-browser A shell command used to launch your preferred
3124 ** web browser when given a URL as an argument.
3125 ** Defaults to "start" on windows, "open" on Mac,
3126 ** and "firefox" on Unix.
3127 **
3128 ** Options:
3129 ** --global set or unset the given property globally instead of
3130 ** setting or unsetting it for the open repository only.
3131 **
@@ -3136,10 +3207,12 @@
3136 void setting_cmd(void){
3137 int i;
3138 int globalFlag = find_option("global","g",0)!=0;
3139 int exactFlag = find_option("exact",0,0)!=0;
3140 int unsetFlag = g.argv[1][0]=='u';
 
 
3141 find_repository_option();
3142 verify_all_options();
3143 db_open_config(1, 0);
3144 if( !globalFlag ){
3145 db_find_and_open_repository(OPEN_ANY_SCHEMA | OPEN_OK_NOT_FOUND, 0);
@@ -3149,23 +3222,12 @@
3149 }
3150 if( unsetFlag && g.argc!=3 ){
3151 usage("PROPERTY ?-global?");
3152 }
3153
3154 /* Verify that the aSetting[] entries are in sorted order. This is
3155 ** necessary for the binary search in db_find_setting() to work correctly.
3156 */
3157 for(i=1; aSetting[i].name; i++){
3158 if( fossil_strcmp(aSetting[i-1].name, aSetting[i].name)>=0 ){
3159 fossil_panic("Internal Error: aSetting[] entries for \"%s\""
3160 " and \"%s\" are out of order.",
3161 aSetting[i-1].name, aSetting[i].name);
3162 }
3163 }
3164
3165 if( g.argc==2 ){
3166 for(i=0; aSetting[i].name; i++){
3167 print_setting(&aSetting[i]);
3168 }
3169 }else if( g.argc==3 || g.argc==4 ){
3170 const char *zName = g.argv[2];
3171 int n = (int)strlen(zName);
3172
--- src/db.c
+++ src/db.c
@@ -1804,15 +1804,17 @@
1804 ** settings.
1805 */
1806 const char *db_setting_inop_rhs(){
1807 Blob x;
1808 int i;
1809 int nSetting;
1810 const Setting *aSetting = setting_info(&nSetting);
1811 const char *zSep = "";
1812
1813 blob_zero(&x);
1814 blob_append_sql(&x, "(");
1815 for(i=0; i<nSetting; i++){
1816 blob_append_sql(&x, "%s%Q", zSep/*safe-for-%s*/, aSetting[i].name);
1817 zSep = ",";
1818 }
1819 blob_append_sql(&x, ")");
1820 return blob_sql_text(&x);
@@ -2735,11 +2737,10 @@
2737 }
2738 }
2739 db_finalize(&q);
2740 }
2741
 
2742 #if INTERFACE
2743 /*
2744 ** Define all settings, which can be controlled via the set/unset
2745 ** command.
2746 **
@@ -2760,100 +2761,399 @@
2761 int forceTextArea; /* Force using a text area for display? */
2762 const char *def; /* Default value */
2763 };
2764 #endif /* INTERFACE */
2765
2766 /*
2767 ** SETTING: access-log boolean default=off
2768 **
2769 ** When the access-log setting is enabled, all login attempts (successful
2770 ** and unsuccessful) on the web interface are recorded in the "access" table
2771 ** of the repository.
2772 */
2773 /*
2774 ** SETTING: admin-log boolean default=off
2775 **
2776 ** When the admin-log setting is enabled, configuration changes are recorded
2777 ** in the "admin_log" table of the repository.
2778 */
2779 #if defined(_WIN32)
2780 /*
2781 ** SETTING: allow-symlinks boolean default=off versionable
2782 ** Allows symbolic links in the repository when enabled.
2783 */
2784 #endif
2785 #if !defined(_WIN32)
2786 /*
2787 ** SETTING: allow-symlinks boolean default=on versionable
2788 ** Allows symbolic links in the repository when enabled.
2789 */
2790 #endif
2791 /*
2792 ** SETTING: auto-captcha boolean default=on variable=autocaptcha
2793 ** If enabled, the /login page provides a button that will automatically
2794 ** fill in the captcha password. This makes things easier for human users,
2795 ** at the expense of also making logins easier for malecious robots.
2796 */
2797 /*
2798 ** SETTING: auto-hyperlink boolean default=on
2799 ** Use javascript to enable hyperlinks on web pages
2800 ** for all users (regardless of the "h" privilege) if the
2801 ** User-Agent string in the HTTP header look like it came
2802 ** from real person, not a spider or bot.
2803 */
2804 /*
2805 ** SETTING: auto-shun boolean default=on
2806 ** If enabled, automatically pull the shunning list
2807 ** from a server to which the client autosyncs.
2808 */
2809 /*
2810 ** SETTING: autosync width=16 default=on
2811 ** This setting can take either a boolean value or "pullonly"
2812 ** If enabled, automatically pull prior to commit
2813 ** or update and automatically push after commit or
2814 ** tag or branch creation. If the value is "pullonly"
2815 ** then only pull operations occur automatically.
2816 */
2817 /*
2818 ** SETTING: autosync-tries width=16 default=1
2819 ** If autosync is enabled setting this to a value greater
2820 ** than zero will cause autosync to try no more than this
2821 ** number of attempts if there is a sync failure.
2822 */
2823 /*
2824 ** SETTING: binary-glob width=40 versionable
2825 ** The VALUE of this setting is a comma or newline-separated list of
2826 ** GLOB patterns that should be treated as binary files
2827 ** for committing and merging purposes. Example: *.jpg
2828 */
2829 #if defined(_WIN32)||defined(__CYGWIN__)||defined(__DARWIN__)
2830 /*
2831 ** SETTING: case-sensitive boolean default=off
2832 ** If TRUE, the files whose names differ only in case
2833 ** are considered distinct. If FALSE files whose names
2834 ** differ only in case are the same file. Defaults to
2835 ** TRUE for unix and FALSE for Cygwin, Mac and Windows.
2836 */
2837 #endif
2838 #if !(defined(_WIN32)||defined(__CYGWIN__)||defined(__DARWIN__))
2839 /*
2840 ** SETTING: case-sensitive boolean default=on
2841 ** If TRUE, the files whose names differ only in case
2842 ** are considered distinct. If FALSE files whose names
2843 ** differ only in case are the same file. Defaults to
2844 ** TRUE for unix and FALSE for Cygwin, Mac and Windows.
2845 */
2846 #endif
2847 /*
2848 ** STTING: clean-glob width=40 versionable
2849 ** The VALUE of this setting is a comma or newline-separated list of GLOB
2850 ** patterns specifying files that the "clean" command will
2851 ** delete without prompting or allowing undo.
2852 ** Example: *.a,*.lib,*.o
2853 */
2854 /*
2855 ** SETTING: clearsign boolean default=off
2856 ** When enabled, fossil will attempt to sign all commits
2857 ** with gpg. When disabled, commits will be unsigned.
2858 */
2859 /*
2860 ** SETTING: crlf-glob width=40 versionable
2861 ** The value is a comma or newline-separated list of GLOB patterns for
2862 ** text files in which it is ok to have CR, CR+LF or mixed
2863 ** line endings. Set to "*" to disable CR+LF checking.
2864 ** The crnl-glob setting is a compatibility alias.
2865 */
2866 /*
2867 ** SETTING: crnl-glob width=40 versionable
2868 ** This is an alias for the crlf-glob setting
2869 */
2870 /*
2871 ** SETTING: default-perms width=16 default=u
2872 ** Permissions given automatically to new users. For more
2873 ** information on permissions see the Users page in Server
2874 ** Administration of the HTTP UI.
2875 */
2876 /* SETTING: diff-binary boolean default=on
2877 ** If enabled, permit files that may be binary
2878 ** or that match the "binary-glob" setting to be used with
2879 ** external diff programs. If disabled, skip these files.
2880 */
2881 /*
2882 ** SETTING: diff-command width=40
2883 ** The value is an external command to run when performing a diff.
2884 ** If undefined, the internal text diff will be used.
2885 */
2886 /*
2887 ** SETTING: dont-push boolean default=off
2888 ** If enabled, prevent this repository from pushing from client to
2889 ** server. This can be used as an extra precaution to prevent
2890 ** accidental pushes to a public server from a private clone.
2891 */
2892 /*
2893 ** SETTING: dotfiles boolean versionable default=off
2894 ** If enabled, include --dotfiles option for all compatible commands.
2895 */
2896 /*
2897 ** SETTING: editor width=32
2898 ** The value is an external command that will launch the
2899 ** text editor command used for check-in comments.
2900 */
2901 /*
2902 ** SETTING: empty-dirs width=40 versionable
2903 ** The value is a comma or newline-separated list of pathnames. On
2904 ** update and checkout commands, if no file or directory
2905 ** exists with that name, an empty directory will be
2906 ** created.
2907 */
2908 /*
2909 ** SETTING: encoding-glob width=40 versionable
2910 ** The value is a comma or newline-separated list of GLOB
2911 ** patterns specifying files that the "commit" command will
2912 ** ignore when issuing warnings about text files that may
2913 ** use another encoding than ASCII or UTF-8. Set to "*"
2914 ** to disable encoding checking.
2915 */
2916 #if defined(FOSSIL_ENABLE_EXEC_REL_PATHS)
2917 /*
2918 ** SETTING: exec-rel-paths boolean default=on
2919 ** When executing certain external commands (e.g. diff and
2920 ** gdiff), use relative paths.
2921 */
2922 #endif
2923 #if !defined(FOSSIL_ENABLE_EXEC_REL_PATHS)
2924 /*
2925 ** SETTING: exec-rel-paths boolean default=off
2926 ** When executing certain external commands (e.g. diff and
2927 ** gdiff), use relative paths.
2928 */
2929 #endif
2930 /*
2931 ** SETTING; gdiff-command width=40 default=gdiff
2932 ** The value is an external command to run when performing a graphical
2933 ** diff. If undefined, text diff will be used.
2934 */
2935 /*
2936 ** SETTING: gmerge-command width=40
2937 ** The value is a graphical merge conflict resolver command operating
2938 ** on four files. Examples:
2939 **
2940 ** kdiff3 "%baseline" "%original" "%merge" -o "%output"
2941 ** xxdiff "%original" "%baseline" "%merge" -M "%output"
2942 ** meld "%baseline" "%original" "%merge" "%output"
2943 */
2944 /*
2945 ** SETTING: hash-digits width=5 default=10
2946 ** The number of hexadecimal digits of the SHA3 hash to display.
2947 */
2948 /*
2949 ** SETTING: http-port width=16 default=8080
2950 ** The default TCP/IP port number to use by the "server"
2951 ** and "ui" commands.
2952 */
2953 /*
2954 ** SETTING: https-login boolean default=off
2955 ** If true, then the Fossil web server will redirect unencrypted
2956 ** login screeen requests to HTTPS.
2957 */
2958 /*
2959 ** SETTING: ignore-glob width=40 versionable
2960 ** The value is a comma or newline-separated list of GLOB
2961 ** patterns specifying files that the "add", "addremove",
2962 ** "clean", and "extra" commands will ignore.
2963 **
2964 ** Example: *.log customCode.c notes.txt
2965 */
2966 /*
2967 ** SETTING: keep-glob width=40 versionable
2968 ** The value is a comma or newline-separated list of GLOB
2969 ** patterns specifying files that the "clean" command will keep
2970 */
2971 /*
2972 ** SETTING: localauth boolean default=off
2973 ** If enabled, require that HTTP connections from
2974 ** 127.0.0.1 be authenticated by password. If
2975 ** false, all HTTP requests from localhost have
2976 ** unrestricted access to the repository.
2977 */
2978 /*
2979 ** SETTING: main-branch width=40 default=trunk
2980 ** The value is the primary branch for the project.
2981 */
2982 /*
2983 ** SETTING: manifest width=5 versionable
2984 ** If enabled, automatically create files "manifest" and "manifest.uuid"
2985 ** in every checkout.
2986 **
2987 ** Optionally use combinations of characters 'r' for "manifest",
2988 ** 'u' for "manifest.uuid" and 't' for "manifest.tags". The SQLite
2989 ** and Fossil repositories both require manifests.
2990 */
2991 /*
2992 ** SETTING: max-loadavg width=25 default=0.0
2993 ** Some CPU-intensive web pages (ex: /zip, /tarball, /blame)
2994 ** are disallowed if the system load average goes above this
2995 ** value. "0.0" means no limit. This only works on unix.
2996 ** Only local settings of this value make a difference since
2997 ** when running as a web-server, Fossil does not open the
2998 ** global configuration database.
2999 */
3000 /*
3001 ** SETTING: max-upload width=25 default=250000
3002 ** A limit on the size of uplink HTTP requests.
3003 */
3004 /*
3005 ** SETTING: mtime-changes boolean default=on
3006 ** Use file modification times (mtimes) to detect when
3007 ** files have been modified. If disabled, all managed files
3008 ** are hashed to detect changes, which can be slow for large
3009 ** projects.
3010 */
3011 #if FOSSIL_ENABLE_LEGACY_MV_RM
3012 /*
3013 ** SETTING: mv-rm-files boolean default=off
3014 ** If enabled, the "mv" and "rename" commands will also move
3015 ** the associated files within the checkout -AND- the "rm"
3016 ** and "delete" commands will also remove the associated
3017 ** files from within the checkout.
3018 */
3019 #endif
3020 /*
3021 ** SETTING; pgp-command width=40
3022 ** DEFAULT: gpg --clearsign -o
3023 **
3024 ** Command used to clear-sign manifests at check-in.
3025 */
3026 /*
3027 ** SETTING: proxy width=32 default=off
3028 ** URL of the HTTP proxy. If undefined or "off" then
3029 ** the "http_proxy" environment variable is consulted.
3030 ** If the http_proxy environment variable is undefined
3031 ** then a direct HTTP connection is used.
3032 */
3033 /*
3034 ** SETTING: relative-paths boolean default=on
3035 ** When showing changes and extras, report paths relative
3036 ** to the current working directory.
3037 */
3038 /*
3039 ** SETTING: repo-cksum boolean default=on
3040 ** Compute checksums over all files in each checkout as a double-check
3041 ** of correctness. Disable this on large repositories for a performance
3042 ** improvement.
3043 */
3044 /*
3045 ** SETTING: self-register boolean default=off
3046 ** Allow users to register themselves through the HTTP UI.
3047 ** This is useful if you want to see other names than
3048 ** "Anonymous" in e.g. ticketing system. On the other hand
3049 ** users can not be deleted.
3050 */
3051 /*
3052 ** SETTING: ssh-command width=40
3053 ** The command used to talk to a remote machine with the "ssh://" protocol.
3054 */
3055 /*
3056 ** SETTING: ssl-ca-location width=40
3057 ** The full pathname to a file containing PEM encoded
3058 ** CA root certificates, or a directory of certificates
3059 ** with filenames formed from the certificate hashes as
3060 ** required by OpenSSL.
3061 **
3062 ** If set, this will override the OS default list of
3063 ** OpenSSL CAs. If unset, the default list will be used.
3064 ** Some platforms may add additional certificates.
3065 ** Checking your platform behaviour is required if the
3066 ** exact contents of the CA root is critical for your
3067 ** application.
3068 */
3069 /*
3070 ** SETTING: ssl-identity width=40
3071 ** The full pathname to a file containing a certificate
3072 ** and private key in PEM format. Create by concatenating
3073 ** the certificate and private key files.
3074 **
3075 ** This identity will be presented to SSL servers to
3076 ** authenticate this client, in addition to the normal
3077 ** password authentication.
3078 */
3079 #ifdef FOSSIL_ENABLE_TCL
3080 /*
3081 ** SETTING: tcl boolean default=off
3082 ** If enabled Tcl integration commands will be added to the TH1
3083 ** interpreter, allowing arbitrary Tcl expressions and
3084 ** scripts to be evaluated from TH1. Additionally, the Tcl
3085 ** interpreter will be able to evaluate arbitrary TH1
3086 ** expressions and scripts.
3087 */
3088 /*
3089 ** SETTING: tcl-setup width=40 versionable block-text
3090 ** This is the setup script to be evaluated after creating
3091 ** and initializing the Tcl interpreter. By default, this
3092 ** is empty and no extra setup is performed.
3093 */
3094 #endif /* FOSSIL_ENABLE_TCL */
3095 #ifdef FOSSIL_ENABLE_TH1_DOCS
3096 /*
3097 ** SETTING: th1-docs boolean default=off
3098 ** If enabled, this allows embedded documentation files to contain
3099 ** arbitrary TH1 scripts that are evaluated on the server. If native
3100 ** Tcl integration is also enabled, this setting has the
3101 ** potential to allow anybody with check-in privileges to
3102 ** do almost anything that the associated operating system
3103 ** user account could do. Extreme caution should be used
3104 ** when enabling this setting.
3105 */
3106 #endif
3107 #ifdef FOSSIL_ENABLE_TH1_HOOKS
3108 /*
3109 ** SETTING: th1-hooks boolean default=off
3110 ** If enabled, special TH1 commands will be called before and
3111 ** after any Fossil command or web page.
3112 */
3113 #endif
3114 /*
3115 ** SETTING: th1-setup width=40 versionable block-text
3116 ** This is the setup script to be evaluated after creating
3117 ** and initializing the TH1 interpreter. By default, this
3118 ** is empty and no extra setup is performed.
3119 */
3120 /*
3121 ** SETTING: th1-uri-regexp width=40 versionable
3122 ** Specify which URI's are allowed in HTTP requests from
3123 ** TH1 scripts. If empty, no HTTP requests are allowed
3124 ** whatsoever.
3125 */
3126 /*
3127 ** SETTING: uv-sync boolean default=off
3128 ** If true, automatically send unversioned files as part
3129 ** of a "fossil clone" or "fossil sync" command. The
3130 ** default is false, in which case the -u option is
3131 ** needed to clone or sync unversioned files.
3132 */
3133 /*
3134 ** SETTING: web-browser width=30
3135 ** A shell command used to launch your preferred
3136 ** web browser when given a URL as an argument.
3137 ** Defaults to "start" on windows, "open" on Mac,
3138 ** and "firefox" on Unix.
3139 */
3140
3141 /*
3142 ** Look up a control setting by its name. Return a pointer to the Setting
3143 ** object, or NULL if there is no such setting.
3144 **
3145 ** If allowPrefix is true, then the Setting returned is the first one for
3146 ** which zName is a prefix of the Setting name.
3147 */
3148 Setting *db_find_setting(const char *zName, int allowPrefix){
3149 int lwr, mid, upr, c;
3150 int n = (int)strlen(zName) + !allowPrefix;
3151 int nSetting;
3152 const Setting *aSetting = setting_info(&nSetting);
3153 lwr = 0;
3154 upr = nSetting - 1;
3155 while( upr>=lwr ){
3156 mid = (upr+lwr)/2;
3157 c = fossil_strncmp(zName, aSetting[mid].name, n);
3158 if( c<0 ){
3159 upr = mid - 1;
@@ -2863,269 +3163,40 @@
3163 if( allowPrefix ){
3164 while( mid>lwr && fossil_strncmp(zName, aSetting[mid-1].name, n)==0 ){
3165 mid--;
3166 }
3167 }
3168 return (Setting*)&aSetting[mid];
3169 }
3170 }
3171 return 0;
3172 }
3173
3174 /*
3175 ** COMMAND: settings
3176 ** COMMAND: unset*
3177 **
3178 ** Usage: %fossil settings ?SETTING? ?VALUE? ?OPTIONS?
3179 ** or: %fossil unset SETTING ?OPTIONS?
3180 **
3181 ** The "settings" command with no arguments lists all settings and their
3182 ** values. With just a SETTING name it shows the current value of that setting.
3183 ** With a VALUE argument it changes the property for the current repository.
3184 **
3185 ** Settings marked as versionable are overridden by the contents of the
3186 ** file named .fossil-settings/PROPERTY in the check-out root, if that
3187 ** file exists.
3188 **
3189 ** The "unset" command clears a setting.
3190 **
3191 ** Settings can have both a "local" repository-only value and "global" value
3192 ** that applies to all repositories. The local values are stored in the
3193 ** "config" table of the repository and the global values are stored in the
3194 ** $HOME/.fossil file on unix or in the %LOCALAPPDATA%/_fossil file on Windows.
3195 ** If both a local and a global value exists for a setting, the local value
3196 ** takes precedence. This command normally operates on the local settings.
3197 ** Use the --global option to change global settings.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3198 **
3199 ** Options:
3200 ** --global set or unset the given property globally instead of
3201 ** setting or unsetting it for the open repository only.
3202 **
@@ -3136,10 +3207,12 @@
3207 void setting_cmd(void){
3208 int i;
3209 int globalFlag = find_option("global","g",0)!=0;
3210 int exactFlag = find_option("exact",0,0)!=0;
3211 int unsetFlag = g.argv[1][0]=='u';
3212 int nSetting;
3213 const Setting *aSetting = setting_info(&nSetting);
3214 find_repository_option();
3215 verify_all_options();
3216 db_open_config(1, 0);
3217 if( !globalFlag ){
3218 db_find_and_open_repository(OPEN_ANY_SCHEMA | OPEN_OK_NOT_FOUND, 0);
@@ -3149,23 +3222,12 @@
3222 }
3223 if( unsetFlag && g.argc!=3 ){
3224 usage("PROPERTY ?-global?");
3225 }
3226
 
 
 
 
 
 
 
 
 
 
 
3227 if( g.argc==2 ){
3228 for(i=0; i<nSetting; i++){
3229 print_setting(&aSetting[i]);
3230 }
3231 }else if( g.argc==3 || g.argc==4 ){
3232 const char *zName = g.argv[2];
3233 int n = (int)strlen(zName);
3234
+35 -13
--- src/dispatch.c
+++ src/dispatch.c
@@ -22,11 +22,10 @@
2222
*/
2323
#include "config.h"
2424
#include <assert.h>
2525
#include "dispatch.h"
2626
27
-
2827
#if INTERFACE
2928
/*
3029
** An instance of this object defines everything we need to know about an
3130
** individual command or webpage.
3231
*/
@@ -39,20 +38,24 @@
3938
4039
/***************************************************************************
4140
** These macros must match similar macros in mkindex.c
4241
** Allowed values for CmdOrPage.eCmdFlags.
4342
*/
44
-#define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */
45
-#define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */
46
-#define CMDFLAG_TEST 0x0004 /* Commands for testing only */
47
-#define CMDFLAG_WEBPAGE 0x0008 /* Web pages */
48
-#define CMDFLAG_COMMAND 0x0010 /* A command */
43
+#define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */
44
+#define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */
45
+#define CMDFLAG_TEST 0x0004 /* Commands for testing only */
46
+#define CMDFLAG_WEBPAGE 0x0008 /* Web pages */
47
+#define CMDFLAG_COMMAND 0x0010 /* A command */
48
+#define CMDFLAG_SETTING 0x0020 /* A setting */
49
+#define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */
50
+#define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */
51
+#define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */
4952
/**************************************************************************/
5053
5154
/* Values for the 2nd parameter to dispatch_name_search() */
52
-#define CMDFLAG_ANY 0x0018 /* Match anything */
53
-#define CMDFLAG_PREFIX 0x0020 /* Prefix match is ok */
55
+#define CMDFLAG_ANY 0x0038 /* Match anything */
56
+#define CMDFLAG_PREFIX 0x0200 /* Prefix match is ok */
5457
5558
#endif /* INTERFACE */
5659
5760
/*
5861
** The page_index.h file contains the definition for aCommand[] - an array
@@ -442,15 +445,16 @@
442445
** or: %fossil COMMAND --help
443446
**
444447
** Display information on how to use COMMAND. To display a list of
445448
** available commands use one of:
446449
**
447
-** %fossil help Show common commands
448
-** %fossil help -a|--all Show both common and auxiliary commands
449
-** %fossil help -t|--test Show test commands only
450
-** %fossil help -x|--aux Show auxiliary commands only
451
-** %fossil help -w|--www Show list of WWW pages
450
+** %fossil help Show common commands
451
+** %fossil help -a|--all Show both common and auxiliary commands
452
+** %fossil help -s|--settings Show setting names
453
+** %fossil help -t|--test Show test commands only
454
+** %fossil help -x|--aux Show auxiliary commands only
455
+** %fossil help -w|--www Show list of WWW pages
452456
*/
453457
void help_cmd(void){
454458
int rc;
455459
int isPage = 0;
456460
const char *z;
@@ -480,10 +484,14 @@
480484
return;
481485
}
482486
else if( find_option("test","t",0) ){
483487
command_list(0, CMDFLAG_TEST);
484488
return;
489
+ }
490
+ else if( find_option("setting","s",0) ){
491
+ command_list(0, CMDFLAG_SETTING);
492
+ return;
485493
}
486494
isPage = ('/' == *g.argv[2]) ? 1 : 0;
487495
if(isPage){
488496
zCmdOrPage = "page";
489497
zCmdOrPagePlural = "pages";
@@ -506,10 +514,13 @@
506514
z = pCmd->zHelp;
507515
if( z==0 ){
508516
fossil_fatal("no help available for the %s %s",
509517
pCmd->zName, zCmdOrPage);
510518
}
519
+ if( pCmd->eCmdFlags & CMDFLAG_SETTING ){
520
+ fossil_print("Setting: \"%s\"\n\n", pCmd->zName);
521
+ }
511522
while( *z ){
512523
if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){
513524
fossil_print("%s", g.argv[0]);
514525
z += 7;
515526
}else{
@@ -517,5 +528,16 @@
517528
z++;
518529
}
519530
}
520531
putchar('\n');
521532
}
533
+
534
+/*
535
+** Return a pointer to the setting information array.
536
+**
537
+** This routine provides access to the aSetting2[] array which is created
538
+** by the mkindex utility program and included with <page_index.h>.
539
+*/
540
+const Setting *setting_info(int *pnCount){
541
+ if( pnCount ) *pnCount = (int)(sizeof(aSetting)/sizeof(aSetting[0]));
542
+ return aSetting;
543
+}
522544
--- src/dispatch.c
+++ src/dispatch.c
@@ -22,11 +22,10 @@
22 */
23 #include "config.h"
24 #include <assert.h>
25 #include "dispatch.h"
26
27
28 #if INTERFACE
29 /*
30 ** An instance of this object defines everything we need to know about an
31 ** individual command or webpage.
32 */
@@ -39,20 +38,24 @@
39
40 /***************************************************************************
41 ** These macros must match similar macros in mkindex.c
42 ** Allowed values for CmdOrPage.eCmdFlags.
43 */
44 #define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */
45 #define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */
46 #define CMDFLAG_TEST 0x0004 /* Commands for testing only */
47 #define CMDFLAG_WEBPAGE 0x0008 /* Web pages */
48 #define CMDFLAG_COMMAND 0x0010 /* A command */
 
 
 
 
49 /**************************************************************************/
50
51 /* Values for the 2nd parameter to dispatch_name_search() */
52 #define CMDFLAG_ANY 0x0018 /* Match anything */
53 #define CMDFLAG_PREFIX 0x0020 /* Prefix match is ok */
54
55 #endif /* INTERFACE */
56
57 /*
58 ** The page_index.h file contains the definition for aCommand[] - an array
@@ -442,15 +445,16 @@
442 ** or: %fossil COMMAND --help
443 **
444 ** Display information on how to use COMMAND. To display a list of
445 ** available commands use one of:
446 **
447 ** %fossil help Show common commands
448 ** %fossil help -a|--all Show both common and auxiliary commands
449 ** %fossil help -t|--test Show test commands only
450 ** %fossil help -x|--aux Show auxiliary commands only
451 ** %fossil help -w|--www Show list of WWW pages
 
452 */
453 void help_cmd(void){
454 int rc;
455 int isPage = 0;
456 const char *z;
@@ -480,10 +484,14 @@
480 return;
481 }
482 else if( find_option("test","t",0) ){
483 command_list(0, CMDFLAG_TEST);
484 return;
 
 
 
 
485 }
486 isPage = ('/' == *g.argv[2]) ? 1 : 0;
487 if(isPage){
488 zCmdOrPage = "page";
489 zCmdOrPagePlural = "pages";
@@ -506,10 +514,13 @@
506 z = pCmd->zHelp;
507 if( z==0 ){
508 fossil_fatal("no help available for the %s %s",
509 pCmd->zName, zCmdOrPage);
510 }
 
 
 
511 while( *z ){
512 if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){
513 fossil_print("%s", g.argv[0]);
514 z += 7;
515 }else{
@@ -517,5 +528,16 @@
517 z++;
518 }
519 }
520 putchar('\n');
521 }
 
 
 
 
 
 
 
 
 
 
 
522
--- src/dispatch.c
+++ src/dispatch.c
@@ -22,11 +22,10 @@
22 */
23 #include "config.h"
24 #include <assert.h>
25 #include "dispatch.h"
26
 
27 #if INTERFACE
28 /*
29 ** An instance of this object defines everything we need to know about an
30 ** individual command or webpage.
31 */
@@ -39,20 +38,24 @@
38
39 /***************************************************************************
40 ** These macros must match similar macros in mkindex.c
41 ** Allowed values for CmdOrPage.eCmdFlags.
42 */
43 #define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */
44 #define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */
45 #define CMDFLAG_TEST 0x0004 /* Commands for testing only */
46 #define CMDFLAG_WEBPAGE 0x0008 /* Web pages */
47 #define CMDFLAG_COMMAND 0x0010 /* A command */
48 #define CMDFLAG_SETTING 0x0020 /* A setting */
49 #define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */
50 #define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */
51 #define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */
52 /**************************************************************************/
53
54 /* Values for the 2nd parameter to dispatch_name_search() */
55 #define CMDFLAG_ANY 0x0038 /* Match anything */
56 #define CMDFLAG_PREFIX 0x0200 /* Prefix match is ok */
57
58 #endif /* INTERFACE */
59
60 /*
61 ** The page_index.h file contains the definition for aCommand[] - an array
@@ -442,15 +445,16 @@
445 ** or: %fossil COMMAND --help
446 **
447 ** Display information on how to use COMMAND. To display a list of
448 ** available commands use one of:
449 **
450 ** %fossil help Show common commands
451 ** %fossil help -a|--all Show both common and auxiliary commands
452 ** %fossil help -s|--settings Show setting names
453 ** %fossil help -t|--test Show test commands only
454 ** %fossil help -x|--aux Show auxiliary commands only
455 ** %fossil help -w|--www Show list of WWW pages
456 */
457 void help_cmd(void){
458 int rc;
459 int isPage = 0;
460 const char *z;
@@ -480,10 +484,14 @@
484 return;
485 }
486 else if( find_option("test","t",0) ){
487 command_list(0, CMDFLAG_TEST);
488 return;
489 }
490 else if( find_option("setting","s",0) ){
491 command_list(0, CMDFLAG_SETTING);
492 return;
493 }
494 isPage = ('/' == *g.argv[2]) ? 1 : 0;
495 if(isPage){
496 zCmdOrPage = "page";
497 zCmdOrPagePlural = "pages";
@@ -506,10 +514,13 @@
514 z = pCmd->zHelp;
515 if( z==0 ){
516 fossil_fatal("no help available for the %s %s",
517 pCmd->zName, zCmdOrPage);
518 }
519 if( pCmd->eCmdFlags & CMDFLAG_SETTING ){
520 fossil_print("Setting: \"%s\"\n\n", pCmd->zName);
521 }
522 while( *z ){
523 if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){
524 fossil_print("%s", g.argv[0]);
525 z += 7;
526 }else{
@@ -517,5 +528,16 @@
528 z++;
529 }
530 }
531 putchar('\n');
532 }
533
534 /*
535 ** Return a pointer to the setting information array.
536 **
537 ** This routine provides access to the aSetting2[] array which is created
538 ** by the mkindex utility program and included with <page_index.h>.
539 */
540 const Setting *setting_info(int *pnCount){
541 if( pnCount ) *pnCount = (int)(sizeof(aSetting)/sizeof(aSetting[0]));
542 return aSetting;
543 }
544
+128 -32
--- src/mkindex.c
+++ src/mkindex.c
@@ -13,29 +13,25 @@
1313
** [email protected]
1414
** http://www.hwaci.com/drh/
1515
**
1616
*******************************************************************************
1717
**
18
-** This program scans Fossil source code files looking for special
19
-** comments that indicate a command-line command or a webpage. This
20
-** routine collects information about these entry points and then
21
-** generates (on standard output) C code used by Fossil to dispatch
22
-** to those entry points.
18
+** This utility program scans Fossil source text looking for specially
19
+** formatted comments and generates C source code for constant tables
20
+** that define the behavior of commands, webpages, and settings.
2321
**
2422
** The source code is scanned for comment lines of the form:
2523
**
2624
** WEBPAGE: /abc/xyz
2725
** COMMAND: cmdname
26
+** SETTING: access-log
2827
**
29
-** These comment should be followed by a function definition of the
30
-** form:
28
+** The WEBPAGE and COMMAND comments should be followed by a function that
29
+** implements the webpage or command. The form of this function is:
3130
**
3231
** void function_name(void){
3332
**
34
-** This routine creates C source code for a constant table that maps
35
-** command and webpage name into pointers to the function.
36
-**
3733
** Command names can divided into three classes: 1st-tier, 2nd-tier,
3834
** and test. 1st-tier commands are the most frequently used and the
3935
** ones that show up with "fossil help". 2nd-tier are seldom-used and/or
4036
** legacy command. Test commands are unsupported commands used for testing
4137
** and analysis only.
@@ -47,21 +43,37 @@
4743
**
4844
** COMMAND: abcde*
4945
** COMMAND: fghij 2nd-tier
5046
** COMMAND: test-xyzzy
5147
** COMMAND: xyzzy test
48
+**
49
+** A SETTING: may be followed by arguments that give additional attributes
50
+** to that setting:
51
+**
52
+** SETTING: clean-blob versionable width=40 block-text
53
+** SETTING: auto-shun boolean default=on
5254
**
5355
** New arguments may be added in future releases that set additional
5456
** bits in the eCmdFlags field.
5557
**
56
-** Additional lines of comment after the COMMAND: or WEBPAGE: become
57
-** the built-in help text for that command or webpage.
58
+** Additional lines of comment after the COMMAND: or WEBPAGE: or SETTING:
59
+** become the built-in help text for that command or webpage or setting.
5860
**
5961
** Multiple COMMAND: entries can be attached to the same command, thus
6062
** creating multiple aliases for that command. Similarly, multiple
6163
** WEBPAGE: entries can be attached to the same webpage function, to give
6264
** that page aliases.
65
+**
66
+** For SETTING: entries, the default value for the setting can be specified
67
+** using a default=VALUE argument if the default contains no spaces. If the
68
+** default value does contain spaces, use a separate line like this:
69
+**
70
+** SETTING: pgp-command
71
+** DEFAULT: gpg --clearsign -o
72
+**
73
+** If no default is supplied, the default is assumed to be an empty string
74
+** or "off" in the case of a boolean.
6375
*/
6476
#include <stdio.h>
6577
#include <stdlib.h>
6678
#include <assert.h>
6779
#include <string.h>
@@ -68,15 +80,19 @@
6880
6981
/***************************************************************************
7082
** These macros must match similar macros in dispatch.c.
7183
**
7284
** Allowed values for CmdOrPage.eCmdFlags. */
73
-#define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */
74
-#define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */
75
-#define CMDFLAG_TEST 0x0004 /* Commands for testing only */
76
-#define CMDFLAG_WEBPAGE 0x0008 /* Web pages */
77
-#define CMDFLAG_COMMAND 0x0010 /* A command */
85
+#define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */
86
+#define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */
87
+#define CMDFLAG_TEST 0x0004 /* Commands for testing only */
88
+#define CMDFLAG_WEBPAGE 0x0008 /* Web pages */
89
+#define CMDFLAG_COMMAND 0x0010 /* A command */
90
+#define CMDFLAG_SETTING 0x0020 /* A setting */
91
+#define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */
92
+#define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */
93
+#define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */
7894
/**************************************************************************/
7995
8096
/*
8197
** Each entry looks like this:
8298
*/
@@ -84,11 +100,14 @@
84100
int eType; /* CMDFLAG_* values */
85101
char *zIf; /* Enclose in #if */
86102
char *zFunc; /* Name of implementation */
87103
char *zPath; /* Webpage or command name */
88104
char *zHelp; /* Help text */
105
+ char *zDflt; /* Default value for settings */
106
+ char *zVar; /* config.name for settings, if different from zPath */
89107
int iHelp; /* Index of Help text */
108
+ int iWidth; /* Display width for SETTING: values */
90109
} Entry;
91110
92111
/*
93112
** Maximum number of entries
94113
*/
@@ -217,18 +236,34 @@
217236
aEntry[nUsed].eType &= ~(CMDFLAG_1ST_TIER|CMDFLAG_TEST);
218237
aEntry[nUsed].eType |= CMDFLAG_2ND_TIER;
219238
}else if( j==4 && strncmp(&zLine[i], "test", j)==0 ){
220239
aEntry[nUsed].eType &= ~(CMDFLAG_1ST_TIER|CMDFLAG_2ND_TIER);
221240
aEntry[nUsed].eType |= CMDFLAG_TEST;
241
+ }else if( j==7 && strncmp(&zLine[i], "boolean", j)==0 ){
242
+ aEntry[nUsed].eType &= ~(CMDFLAG_BLOCKTEXT);
243
+ aEntry[nUsed].iWidth = 0;
244
+ aEntry[nUsed].eType |= CMDFLAG_BOOLEAN;
245
+ }else if( j==10 && strncmp(&zLine[i], "block-text", j)==0 ){
246
+ aEntry[nUsed].eType &= ~(CMDFLAG_BOOLEAN);
247
+ aEntry[nUsed].eType |= CMDFLAG_BLOCKTEXT;
248
+ }else if( j==11 && strncmp(&zLine[i], "versionable", j)==0 ){
249
+ aEntry[nUsed].eType |= CMDFLAG_VERSIONABLE;
250
+ }else if( j>6 && strncmp(&zLine[i], "width=", 6)==0 ){
251
+ aEntry[nUsed].iWidth = atoi(&zLine[i+6]);
252
+ }else if( j>8 && strncmp(&zLine[i], "default=", 8)==0 ){
253
+ aEntry[nUsed].zDflt = string_dup(&zLine[i+8], j-8);
254
+ }else if( j>9 && strncmp(&zLine[i], "variable=", 9)==0 ){
255
+ aEntry[nUsed].zVar = string_dup(&zLine[i+9], j-9);
222256
}else{
223257
fprintf(stderr, "%s:%d: unknown option: '%.*s'\n",
224258
zFile, nLine, j, &zLine[i]);
225259
nErr++;
226260
}
227261
}
228262
229263
nUsed++;
264
+ return;
230265
}
231266
232267
/*
233268
** Check to see if the current line is an #if and if it is, add it to
234269
** the zIf[] string. If the current line is an #endif or #else or #elif
@@ -246,24 +281,44 @@
246281
memcpy(&zIf[1], &zLine[i], len+1);
247282
}else if( zLine[i]=='e' ){
248283
zIf[0] = 0;
249284
}
250285
}
286
+
287
+/*
288
+** Check to see if the current line is a "** DEFAULT: ..." line for a
289
+** SETTING definition. If so, remember the default value.
290
+*/
291
+void scan_for_default(const char *zLine){
292
+ int len;
293
+ const char *z;
294
+ if( nUsed<1 ) return;
295
+ if( (aEntry[nUsed-1].eType & CMDFLAG_SETTING)==0 ) return;
296
+ if( strncmp(zLine, "** DEFAULT: ", 12)!=0 ) return;
297
+ z = zLine + 12;
298
+ while( fossil_isspace(z[0]) ) z++;
299
+ len = (int)strlen(z);
300
+ while( len>0 && fossil_isspace(z[len-1]) ){ len--; }
301
+ aEntry[nUsed-1].zDflt = string_dup(z,len);
302
+}
251303
252304
/*
253305
** Scan a line for a function that implements a web page or command.
254306
*/
255307
void scan_for_func(char *zLine){
256308
int i,j,k;
257309
char *z;
310
+ int isSetting;
258311
if( nUsed<=nFixed ) return;
259312
if( strncmp(zLine, "**", 2)==0
260313
&& fossil_isspace(zLine[2])
261314
&& strlen(zLine)<sizeof(zHelp)-nHelp-1
262315
&& nUsed>nFixed
263316
&& strncmp(zLine,"** COMMAND:",11)!=0
264317
&& strncmp(zLine,"** WEBPAGE:",11)!=0
318
+ && strncmp(zLine,"** SETTING:",11)!=0
319
+ && strncmp(zLine,"** DEFAULT:",11)!=0
265320
){
266321
if( zLine[2]=='\n' ){
267322
zHelp[nHelp++] = '\n';
268323
}else{
269324
if( strncmp(&zLine[3], "Usage: ", 6)==0 ) nHelp = 0;
@@ -272,19 +327,22 @@
272327
}
273328
return;
274329
}
275330
for(i=0; fossil_isspace(zLine[i]); i++){}
276331
if( zLine[i]==0 ) return;
277
- if( strncmp(&zLine[i],"void",4)!=0 ){
278
- if( zLine[i]!='*' ) goto page_skip;
279
- return;
280
- }
281
- i += 4;
282
- if( !fossil_isspace(zLine[i]) ) goto page_skip;
283
- while( fossil_isspace(zLine[i]) ){ i++; }
284
- for(j=0; fossil_isident(zLine[i+j]); j++){}
285
- if( j==0 ) goto page_skip;
332
+ isSetting = (aEntry[nFixed].eType & CMDFLAG_SETTING)!=0;
333
+ if( !isSetting ){
334
+ if( strncmp(&zLine[i],"void",4)!=0 ){
335
+ if( zLine[i]!='*' ) goto page_skip;
336
+ return;
337
+ }
338
+ i += 4;
339
+ if( !fossil_isspace(zLine[i]) ) goto page_skip;
340
+ while( fossil_isspace(zLine[i]) ){ i++; }
341
+ for(j=0; fossil_isident(zLine[i+j]); j++){}
342
+ if( j==0 ) goto page_skip;
343
+ }
286344
for(k=nHelp-1; k>=0 && fossil_isspace(zHelp[k]); k--){}
287345
nHelp = k+1;
288346
zHelp[nHelp] = 0;
289347
for(k=0; k<nHelp && fossil_isspace(zHelp[k]); k++){}
290348
if( k<nHelp ){
@@ -292,18 +350,20 @@
292350
}else{
293351
z = "";
294352
}
295353
for(k=nFixed; k<nUsed; k++){
296354
aEntry[k].zIf = zIf[0] ? string_dup(zIf, -1) : 0;
297
- aEntry[k].zFunc = string_dup(&zLine[i], j);
355
+ aEntry[k].zFunc = isSetting ? "0" : string_dup(&zLine[i], j);
298356
aEntry[k].zHelp = z;
299357
z = 0;
300358
aEntry[k].iHelp = nFixed;
301359
}
302
- i+=j;
303
- while( fossil_isspace(zLine[i]) ){ i++; }
304
- if( zLine[i]!='(' ) goto page_skip;
360
+ if( !isSetting ){
361
+ i+=j;
362
+ while( fossil_isspace(zLine[i]) ){ i++; }
363
+ if( zLine[i]!='(' ) goto page_skip;
364
+ }
305365
nFixed = nUsed;
306366
nHelp = 0;
307367
return;
308368
309369
page_skip:
@@ -341,10 +401,11 @@
341401
"*/\n"
342402
);
343403
344404
/* Output declarations for all the action functions */
345405
for(i=0; i<nFixed; i++){
406
+ if( aEntry[i].eType & CMDFLAG_SETTING ) continue;
346407
if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
347408
printf("extern void %s(void);\n", aEntry[i].zFunc);
348409
if( aEntry[i].zIf ) printf("#endif\n");
349410
}
350411
@@ -376,22 +437,55 @@
376437
if( aEntry[i].zIf ){
377438
printf("%s", aEntry[i].zIf);
378439
}else if( (aEntry[i].eType & CMDFLAG_WEBPAGE)!=0 ){
379440
nWeb++;
380441
}
381
- printf(" { \"%.*s\",%*s%s,%*szHelp%03d, 0x%02x },\n",
442
+ printf(" { \"%.*s\",%*s%s,%*szHelp%03d, 0x%03x },\n",
382443
n, z,
383444
25-n, "",
384445
aEntry[i].zFunc,
385
- (int)(30-strlen(aEntry[i].zFunc)), "",
446
+ (int)(29-strlen(aEntry[i].zFunc)), "",
386447
aEntry[i].iHelp,
387448
aEntry[i].eType
388449
);
389450
if( aEntry[i].zIf ) printf("#endif\n");
390451
}
391452
printf("};\n");
392453
printf("#define FOSSIL_FIRST_CMD %d\n", nWeb);
454
+
455
+ /* Generate the aSetting[] table */
456
+ printf("const Setting aSetting[] = {\n");
457
+ for(i=0; i<nFixed; i++){
458
+ const char *z;
459
+ const char *zVar;
460
+ const char *zDef;
461
+ if( (aEntry[i].eType & CMDFLAG_SETTING)==0 ) continue;
462
+ z = aEntry[i].zPath;
463
+ zVar = aEntry[i].zVar;
464
+ zDef = aEntry[i].zDflt;
465
+ if( zDef==0 ) zDef = "";
466
+ if( aEntry[i].zIf ){
467
+ printf("%s", aEntry[i].zIf);
468
+ }
469
+ printf(" { \"%s\",%*s", z, (int)(20-strlen(z)), "");
470
+ if( zVar ){
471
+ printf(" \"%s\",%*s", zVar, (int)(15-strlen(zVar)), "");
472
+ }else{
473
+ printf(" 0,%*s", 16, "");
474
+ }
475
+ printf(" %3d, %d, %d, \"%s\"%*s },\n",
476
+ aEntry[i].iWidth,
477
+ (aEntry[i].eType & CMDFLAG_VERSIONABLE)!=0,
478
+ (aEntry[i].eType & CMDFLAG_BLOCKTEXT)!=0,
479
+ zDef, (int)(10-strlen(zDef)), ""
480
+ );
481
+ if( aEntry[i].zIf ){
482
+ printf("#endif\n");
483
+ }
484
+ }
485
+ printf("};\n");
486
+
393487
}
394488
395489
/*
396490
** Process a single file of input
397491
*/
@@ -407,10 +501,12 @@
407501
nLine++;
408502
scan_for_if(zLine);
409503
scan_for_label("WEBPAGE:",zLine,CMDFLAG_WEBPAGE);
410504
scan_for_label("COMMAND:",zLine,CMDFLAG_COMMAND);
411505
scan_for_func(zLine);
506
+ scan_for_label("SETTING:",zLine,CMDFLAG_SETTING);
507
+ scan_for_default(zLine);
412508
}
413509
fclose(in);
414510
nUsed = nFixed;
415511
}
416512
417513
--- src/mkindex.c
+++ src/mkindex.c
@@ -13,29 +13,25 @@
13 ** [email protected]
14 ** http://www.hwaci.com/drh/
15 **
16 *******************************************************************************
17 **
18 ** This program scans Fossil source code files looking for special
19 ** comments that indicate a command-line command or a webpage. This
20 ** routine collects information about these entry points and then
21 ** generates (on standard output) C code used by Fossil to dispatch
22 ** to those entry points.
23 **
24 ** The source code is scanned for comment lines of the form:
25 **
26 ** WEBPAGE: /abc/xyz
27 ** COMMAND: cmdname
 
28 **
29 ** These comment should be followed by a function definition of the
30 ** form:
31 **
32 ** void function_name(void){
33 **
34 ** This routine creates C source code for a constant table that maps
35 ** command and webpage name into pointers to the function.
36 **
37 ** Command names can divided into three classes: 1st-tier, 2nd-tier,
38 ** and test. 1st-tier commands are the most frequently used and the
39 ** ones that show up with "fossil help". 2nd-tier are seldom-used and/or
40 ** legacy command. Test commands are unsupported commands used for testing
41 ** and analysis only.
@@ -47,21 +43,37 @@
47 **
48 ** COMMAND: abcde*
49 ** COMMAND: fghij 2nd-tier
50 ** COMMAND: test-xyzzy
51 ** COMMAND: xyzzy test
 
 
 
 
 
 
52 **
53 ** New arguments may be added in future releases that set additional
54 ** bits in the eCmdFlags field.
55 **
56 ** Additional lines of comment after the COMMAND: or WEBPAGE: become
57 ** the built-in help text for that command or webpage.
58 **
59 ** Multiple COMMAND: entries can be attached to the same command, thus
60 ** creating multiple aliases for that command. Similarly, multiple
61 ** WEBPAGE: entries can be attached to the same webpage function, to give
62 ** that page aliases.
 
 
 
 
 
 
 
 
 
 
63 */
64 #include <stdio.h>
65 #include <stdlib.h>
66 #include <assert.h>
67 #include <string.h>
@@ -68,15 +80,19 @@
68
69 /***************************************************************************
70 ** These macros must match similar macros in dispatch.c.
71 **
72 ** Allowed values for CmdOrPage.eCmdFlags. */
73 #define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */
74 #define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */
75 #define CMDFLAG_TEST 0x0004 /* Commands for testing only */
76 #define CMDFLAG_WEBPAGE 0x0008 /* Web pages */
77 #define CMDFLAG_COMMAND 0x0010 /* A command */
 
 
 
 
78 /**************************************************************************/
79
80 /*
81 ** Each entry looks like this:
82 */
@@ -84,11 +100,14 @@
84 int eType; /* CMDFLAG_* values */
85 char *zIf; /* Enclose in #if */
86 char *zFunc; /* Name of implementation */
87 char *zPath; /* Webpage or command name */
88 char *zHelp; /* Help text */
 
 
89 int iHelp; /* Index of Help text */
 
90 } Entry;
91
92 /*
93 ** Maximum number of entries
94 */
@@ -217,18 +236,34 @@
217 aEntry[nUsed].eType &= ~(CMDFLAG_1ST_TIER|CMDFLAG_TEST);
218 aEntry[nUsed].eType |= CMDFLAG_2ND_TIER;
219 }else if( j==4 && strncmp(&zLine[i], "test", j)==0 ){
220 aEntry[nUsed].eType &= ~(CMDFLAG_1ST_TIER|CMDFLAG_2ND_TIER);
221 aEntry[nUsed].eType |= CMDFLAG_TEST;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222 }else{
223 fprintf(stderr, "%s:%d: unknown option: '%.*s'\n",
224 zFile, nLine, j, &zLine[i]);
225 nErr++;
226 }
227 }
228
229 nUsed++;
 
230 }
231
232 /*
233 ** Check to see if the current line is an #if and if it is, add it to
234 ** the zIf[] string. If the current line is an #endif or #else or #elif
@@ -246,24 +281,44 @@
246 memcpy(&zIf[1], &zLine[i], len+1);
247 }else if( zLine[i]=='e' ){
248 zIf[0] = 0;
249 }
250 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
252 /*
253 ** Scan a line for a function that implements a web page or command.
254 */
255 void scan_for_func(char *zLine){
256 int i,j,k;
257 char *z;
 
258 if( nUsed<=nFixed ) return;
259 if( strncmp(zLine, "**", 2)==0
260 && fossil_isspace(zLine[2])
261 && strlen(zLine)<sizeof(zHelp)-nHelp-1
262 && nUsed>nFixed
263 && strncmp(zLine,"** COMMAND:",11)!=0
264 && strncmp(zLine,"** WEBPAGE:",11)!=0
 
 
265 ){
266 if( zLine[2]=='\n' ){
267 zHelp[nHelp++] = '\n';
268 }else{
269 if( strncmp(&zLine[3], "Usage: ", 6)==0 ) nHelp = 0;
@@ -272,19 +327,22 @@
272 }
273 return;
274 }
275 for(i=0; fossil_isspace(zLine[i]); i++){}
276 if( zLine[i]==0 ) return;
277 if( strncmp(&zLine[i],"void",4)!=0 ){
278 if( zLine[i]!='*' ) goto page_skip;
279 return;
280 }
281 i += 4;
282 if( !fossil_isspace(zLine[i]) ) goto page_skip;
283 while( fossil_isspace(zLine[i]) ){ i++; }
284 for(j=0; fossil_isident(zLine[i+j]); j++){}
285 if( j==0 ) goto page_skip;
 
 
 
286 for(k=nHelp-1; k>=0 && fossil_isspace(zHelp[k]); k--){}
287 nHelp = k+1;
288 zHelp[nHelp] = 0;
289 for(k=0; k<nHelp && fossil_isspace(zHelp[k]); k++){}
290 if( k<nHelp ){
@@ -292,18 +350,20 @@
292 }else{
293 z = "";
294 }
295 for(k=nFixed; k<nUsed; k++){
296 aEntry[k].zIf = zIf[0] ? string_dup(zIf, -1) : 0;
297 aEntry[k].zFunc = string_dup(&zLine[i], j);
298 aEntry[k].zHelp = z;
299 z = 0;
300 aEntry[k].iHelp = nFixed;
301 }
302 i+=j;
303 while( fossil_isspace(zLine[i]) ){ i++; }
304 if( zLine[i]!='(' ) goto page_skip;
 
 
305 nFixed = nUsed;
306 nHelp = 0;
307 return;
308
309 page_skip:
@@ -341,10 +401,11 @@
341 "*/\n"
342 );
343
344 /* Output declarations for all the action functions */
345 for(i=0; i<nFixed; i++){
 
346 if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
347 printf("extern void %s(void);\n", aEntry[i].zFunc);
348 if( aEntry[i].zIf ) printf("#endif\n");
349 }
350
@@ -376,22 +437,55 @@
376 if( aEntry[i].zIf ){
377 printf("%s", aEntry[i].zIf);
378 }else if( (aEntry[i].eType & CMDFLAG_WEBPAGE)!=0 ){
379 nWeb++;
380 }
381 printf(" { \"%.*s\",%*s%s,%*szHelp%03d, 0x%02x },\n",
382 n, z,
383 25-n, "",
384 aEntry[i].zFunc,
385 (int)(30-strlen(aEntry[i].zFunc)), "",
386 aEntry[i].iHelp,
387 aEntry[i].eType
388 );
389 if( aEntry[i].zIf ) printf("#endif\n");
390 }
391 printf("};\n");
392 printf("#define FOSSIL_FIRST_CMD %d\n", nWeb);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
393 }
394
395 /*
396 ** Process a single file of input
397 */
@@ -407,10 +501,12 @@
407 nLine++;
408 scan_for_if(zLine);
409 scan_for_label("WEBPAGE:",zLine,CMDFLAG_WEBPAGE);
410 scan_for_label("COMMAND:",zLine,CMDFLAG_COMMAND);
411 scan_for_func(zLine);
 
 
412 }
413 fclose(in);
414 nUsed = nFixed;
415 }
416
417
--- src/mkindex.c
+++ src/mkindex.c
@@ -13,29 +13,25 @@
13 ** [email protected]
14 ** http://www.hwaci.com/drh/
15 **
16 *******************************************************************************
17 **
18 ** This utility program scans Fossil source text looking for specially
19 ** formatted comments and generates C source code for constant tables
20 ** that define the behavior of commands, webpages, and settings.
 
 
21 **
22 ** The source code is scanned for comment lines of the form:
23 **
24 ** WEBPAGE: /abc/xyz
25 ** COMMAND: cmdname
26 ** SETTING: access-log
27 **
28 ** The WEBPAGE and COMMAND comments should be followed by a function that
29 ** implements the webpage or command. The form of this function is:
30 **
31 ** void function_name(void){
32 **
 
 
 
33 ** Command names can divided into three classes: 1st-tier, 2nd-tier,
34 ** and test. 1st-tier commands are the most frequently used and the
35 ** ones that show up with "fossil help". 2nd-tier are seldom-used and/or
36 ** legacy command. Test commands are unsupported commands used for testing
37 ** and analysis only.
@@ -47,21 +43,37 @@
43 **
44 ** COMMAND: abcde*
45 ** COMMAND: fghij 2nd-tier
46 ** COMMAND: test-xyzzy
47 ** COMMAND: xyzzy test
48 **
49 ** A SETTING: may be followed by arguments that give additional attributes
50 ** to that setting:
51 **
52 ** SETTING: clean-blob versionable width=40 block-text
53 ** SETTING: auto-shun boolean default=on
54 **
55 ** New arguments may be added in future releases that set additional
56 ** bits in the eCmdFlags field.
57 **
58 ** Additional lines of comment after the COMMAND: or WEBPAGE: or SETTING:
59 ** become the built-in help text for that command or webpage or setting.
60 **
61 ** Multiple COMMAND: entries can be attached to the same command, thus
62 ** creating multiple aliases for that command. Similarly, multiple
63 ** WEBPAGE: entries can be attached to the same webpage function, to give
64 ** that page aliases.
65 **
66 ** For SETTING: entries, the default value for the setting can be specified
67 ** using a default=VALUE argument if the default contains no spaces. If the
68 ** default value does contain spaces, use a separate line like this:
69 **
70 ** SETTING: pgp-command
71 ** DEFAULT: gpg --clearsign -o
72 **
73 ** If no default is supplied, the default is assumed to be an empty string
74 ** or "off" in the case of a boolean.
75 */
76 #include <stdio.h>
77 #include <stdlib.h>
78 #include <assert.h>
79 #include <string.h>
@@ -68,15 +80,19 @@
80
81 /***************************************************************************
82 ** These macros must match similar macros in dispatch.c.
83 **
84 ** Allowed values for CmdOrPage.eCmdFlags. */
85 #define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */
86 #define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */
87 #define CMDFLAG_TEST 0x0004 /* Commands for testing only */
88 #define CMDFLAG_WEBPAGE 0x0008 /* Web pages */
89 #define CMDFLAG_COMMAND 0x0010 /* A command */
90 #define CMDFLAG_SETTING 0x0020 /* A setting */
91 #define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */
92 #define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */
93 #define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */
94 /**************************************************************************/
95
96 /*
97 ** Each entry looks like this:
98 */
@@ -84,11 +100,14 @@
100 int eType; /* CMDFLAG_* values */
101 char *zIf; /* Enclose in #if */
102 char *zFunc; /* Name of implementation */
103 char *zPath; /* Webpage or command name */
104 char *zHelp; /* Help text */
105 char *zDflt; /* Default value for settings */
106 char *zVar; /* config.name for settings, if different from zPath */
107 int iHelp; /* Index of Help text */
108 int iWidth; /* Display width for SETTING: values */
109 } Entry;
110
111 /*
112 ** Maximum number of entries
113 */
@@ -217,18 +236,34 @@
236 aEntry[nUsed].eType &= ~(CMDFLAG_1ST_TIER|CMDFLAG_TEST);
237 aEntry[nUsed].eType |= CMDFLAG_2ND_TIER;
238 }else if( j==4 && strncmp(&zLine[i], "test", j)==0 ){
239 aEntry[nUsed].eType &= ~(CMDFLAG_1ST_TIER|CMDFLAG_2ND_TIER);
240 aEntry[nUsed].eType |= CMDFLAG_TEST;
241 }else if( j==7 && strncmp(&zLine[i], "boolean", j)==0 ){
242 aEntry[nUsed].eType &= ~(CMDFLAG_BLOCKTEXT);
243 aEntry[nUsed].iWidth = 0;
244 aEntry[nUsed].eType |= CMDFLAG_BOOLEAN;
245 }else if( j==10 && strncmp(&zLine[i], "block-text", j)==0 ){
246 aEntry[nUsed].eType &= ~(CMDFLAG_BOOLEAN);
247 aEntry[nUsed].eType |= CMDFLAG_BLOCKTEXT;
248 }else if( j==11 && strncmp(&zLine[i], "versionable", j)==0 ){
249 aEntry[nUsed].eType |= CMDFLAG_VERSIONABLE;
250 }else if( j>6 && strncmp(&zLine[i], "width=", 6)==0 ){
251 aEntry[nUsed].iWidth = atoi(&zLine[i+6]);
252 }else if( j>8 && strncmp(&zLine[i], "default=", 8)==0 ){
253 aEntry[nUsed].zDflt = string_dup(&zLine[i+8], j-8);
254 }else if( j>9 && strncmp(&zLine[i], "variable=", 9)==0 ){
255 aEntry[nUsed].zVar = string_dup(&zLine[i+9], j-9);
256 }else{
257 fprintf(stderr, "%s:%d: unknown option: '%.*s'\n",
258 zFile, nLine, j, &zLine[i]);
259 nErr++;
260 }
261 }
262
263 nUsed++;
264 return;
265 }
266
267 /*
268 ** Check to see if the current line is an #if and if it is, add it to
269 ** the zIf[] string. If the current line is an #endif or #else or #elif
@@ -246,24 +281,44 @@
281 memcpy(&zIf[1], &zLine[i], len+1);
282 }else if( zLine[i]=='e' ){
283 zIf[0] = 0;
284 }
285 }
286
287 /*
288 ** Check to see if the current line is a "** DEFAULT: ..." line for a
289 ** SETTING definition. If so, remember the default value.
290 */
291 void scan_for_default(const char *zLine){
292 int len;
293 const char *z;
294 if( nUsed<1 ) return;
295 if( (aEntry[nUsed-1].eType & CMDFLAG_SETTING)==0 ) return;
296 if( strncmp(zLine, "** DEFAULT: ", 12)!=0 ) return;
297 z = zLine + 12;
298 while( fossil_isspace(z[0]) ) z++;
299 len = (int)strlen(z);
300 while( len>0 && fossil_isspace(z[len-1]) ){ len--; }
301 aEntry[nUsed-1].zDflt = string_dup(z,len);
302 }
303
304 /*
305 ** Scan a line for a function that implements a web page or command.
306 */
307 void scan_for_func(char *zLine){
308 int i,j,k;
309 char *z;
310 int isSetting;
311 if( nUsed<=nFixed ) return;
312 if( strncmp(zLine, "**", 2)==0
313 && fossil_isspace(zLine[2])
314 && strlen(zLine)<sizeof(zHelp)-nHelp-1
315 && nUsed>nFixed
316 && strncmp(zLine,"** COMMAND:",11)!=0
317 && strncmp(zLine,"** WEBPAGE:",11)!=0
318 && strncmp(zLine,"** SETTING:",11)!=0
319 && strncmp(zLine,"** DEFAULT:",11)!=0
320 ){
321 if( zLine[2]=='\n' ){
322 zHelp[nHelp++] = '\n';
323 }else{
324 if( strncmp(&zLine[3], "Usage: ", 6)==0 ) nHelp = 0;
@@ -272,19 +327,22 @@
327 }
328 return;
329 }
330 for(i=0; fossil_isspace(zLine[i]); i++){}
331 if( zLine[i]==0 ) return;
332 isSetting = (aEntry[nFixed].eType & CMDFLAG_SETTING)!=0;
333 if( !isSetting ){
334 if( strncmp(&zLine[i],"void",4)!=0 ){
335 if( zLine[i]!='*' ) goto page_skip;
336 return;
337 }
338 i += 4;
339 if( !fossil_isspace(zLine[i]) ) goto page_skip;
340 while( fossil_isspace(zLine[i]) ){ i++; }
341 for(j=0; fossil_isident(zLine[i+j]); j++){}
342 if( j==0 ) goto page_skip;
343 }
344 for(k=nHelp-1; k>=0 && fossil_isspace(zHelp[k]); k--){}
345 nHelp = k+1;
346 zHelp[nHelp] = 0;
347 for(k=0; k<nHelp && fossil_isspace(zHelp[k]); k++){}
348 if( k<nHelp ){
@@ -292,18 +350,20 @@
350 }else{
351 z = "";
352 }
353 for(k=nFixed; k<nUsed; k++){
354 aEntry[k].zIf = zIf[0] ? string_dup(zIf, -1) : 0;
355 aEntry[k].zFunc = isSetting ? "0" : string_dup(&zLine[i], j);
356 aEntry[k].zHelp = z;
357 z = 0;
358 aEntry[k].iHelp = nFixed;
359 }
360 if( !isSetting ){
361 i+=j;
362 while( fossil_isspace(zLine[i]) ){ i++; }
363 if( zLine[i]!='(' ) goto page_skip;
364 }
365 nFixed = nUsed;
366 nHelp = 0;
367 return;
368
369 page_skip:
@@ -341,10 +401,11 @@
401 "*/\n"
402 );
403
404 /* Output declarations for all the action functions */
405 for(i=0; i<nFixed; i++){
406 if( aEntry[i].eType & CMDFLAG_SETTING ) continue;
407 if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
408 printf("extern void %s(void);\n", aEntry[i].zFunc);
409 if( aEntry[i].zIf ) printf("#endif\n");
410 }
411
@@ -376,22 +437,55 @@
437 if( aEntry[i].zIf ){
438 printf("%s", aEntry[i].zIf);
439 }else if( (aEntry[i].eType & CMDFLAG_WEBPAGE)!=0 ){
440 nWeb++;
441 }
442 printf(" { \"%.*s\",%*s%s,%*szHelp%03d, 0x%03x },\n",
443 n, z,
444 25-n, "",
445 aEntry[i].zFunc,
446 (int)(29-strlen(aEntry[i].zFunc)), "",
447 aEntry[i].iHelp,
448 aEntry[i].eType
449 );
450 if( aEntry[i].zIf ) printf("#endif\n");
451 }
452 printf("};\n");
453 printf("#define FOSSIL_FIRST_CMD %d\n", nWeb);
454
455 /* Generate the aSetting[] table */
456 printf("const Setting aSetting[] = {\n");
457 for(i=0; i<nFixed; i++){
458 const char *z;
459 const char *zVar;
460 const char *zDef;
461 if( (aEntry[i].eType & CMDFLAG_SETTING)==0 ) continue;
462 z = aEntry[i].zPath;
463 zVar = aEntry[i].zVar;
464 zDef = aEntry[i].zDflt;
465 if( zDef==0 ) zDef = "";
466 if( aEntry[i].zIf ){
467 printf("%s", aEntry[i].zIf);
468 }
469 printf(" { \"%s\",%*s", z, (int)(20-strlen(z)), "");
470 if( zVar ){
471 printf(" \"%s\",%*s", zVar, (int)(15-strlen(zVar)), "");
472 }else{
473 printf(" 0,%*s", 16, "");
474 }
475 printf(" %3d, %d, %d, \"%s\"%*s },\n",
476 aEntry[i].iWidth,
477 (aEntry[i].eType & CMDFLAG_VERSIONABLE)!=0,
478 (aEntry[i].eType & CMDFLAG_BLOCKTEXT)!=0,
479 zDef, (int)(10-strlen(zDef)), ""
480 );
481 if( aEntry[i].zIf ){
482 printf("#endif\n");
483 }
484 }
485 printf("};\n");
486
487 }
488
489 /*
490 ** Process a single file of input
491 */
@@ -407,10 +501,12 @@
501 nLine++;
502 scan_for_if(zLine);
503 scan_for_label("WEBPAGE:",zLine,CMDFLAG_WEBPAGE);
504 scan_for_label("COMMAND:",zLine,CMDFLAG_COMMAND);
505 scan_for_func(zLine);
506 scan_for_label("SETTING:",zLine,CMDFLAG_SETTING);
507 scan_for_default(zLine);
508 }
509 fclose(in);
510 nUsed = nFixed;
511 }
512
513
+7 -4
--- src/setup.c
+++ src/setup.c
@@ -1534,11 +1534,14 @@
15341534
**
15351535
** Change or view miscellaneous settings. Part of the
15361536
** Admin pages requiring Admin privileges.
15371537
*/
15381538
void setup_settings(void){
1539
+ int nSetting;
1540
+ int i;
15391541
Setting const *pSet;
1542
+ const Setting *aSetting = setting_info(&nSetting);
15401543
15411544
login_check_credentials();
15421545
if( !g.perm.Setup ){
15431546
login_needed(0);
15441547
return;
@@ -1555,11 +1558,11 @@
15551558
@ See the "fossil help setting" output below for further information on
15561559
@ the meaning of each setting.</p><hr />
15571560
@ <form action="%s(g.zTop)/setup_settings" method="post"><div>
15581561
@ <table border="0"><tr><td valign="top">
15591562
login_insert_csrf_secret();
1560
- for(pSet=aSetting; pSet->name!=0; pSet++){
1563
+ for(i=0, pSet=aSetting; i<nSetting; i++, pSet++){
15611564
if( pSet->width==0 ){
15621565
int hasVersionableValue = pSet->versionable &&
15631566
(db_get_versioned(pSet->name, NULL)!=0);
15641567
onoff_attribute(pSet->name, pSet->name,
15651568
pSet->var!=0 ? pSet->var : pSet->name,
@@ -1571,29 +1574,29 @@
15711574
}
15721575
}
15731576
}
15741577
@ <br /><input type="submit" name="submit" value="Apply Changes" />
15751578
@ </td><td style="width:50px;"></td><td valign="top">
1576
- for(pSet=aSetting; pSet->name!=0; pSet++){
1579
+ for(i=0, pSet=aSetting; i<nSetting; i++, pSet++){
15771580
if( pSet->width!=0 && !pSet->versionable && !pSet->forceTextArea ){
15781581
entry_attribute(pSet->name, /*pSet->width*/ 25, pSet->name,
15791582
pSet->var!=0 ? pSet->var : pSet->name,
15801583
(char*)pSet->def, 0);
15811584
@ <br />
15821585
}
15831586
}
1584
- for(pSet=aSetting; pSet->name!=0; pSet++){
1587
+ for(i=0, pSet=aSetting; i<nSetting; i++, pSet++){
15851588
if( pSet->width!=0 && !pSet->versionable && pSet->forceTextArea ){
15861589
@<b>%s(pSet->name)</b><br />
15871590
textarea_attribute("", /*rows*/ 3, /*cols*/ 50, pSet->name,
15881591
pSet->var!=0 ? pSet->var : pSet->name,
15891592
(char*)pSet->def, 0);
15901593
@ <br />
15911594
}
15921595
}
15931596
@ </td><td style="width:50px;"></td><td valign="top">
1594
- for(pSet=aSetting; pSet->name!=0; pSet++){
1597
+ for(i=0, pSet=aSetting; i<nSetting; i++, pSet++){
15951598
if( pSet->width!=0 && pSet->versionable ){
15961599
int hasVersionableValue = db_get_versioned(pSet->name, NULL)!=0;
15971600
@<b>%s(pSet->name)</b> (v)<br />
15981601
textarea_attribute("", /*rows*/ 3, /*cols*/ 20, pSet->name,
15991602
pSet->var!=0 ? pSet->var : pSet->name,
16001603
--- src/setup.c
+++ src/setup.c
@@ -1534,11 +1534,14 @@
1534 **
1535 ** Change or view miscellaneous settings. Part of the
1536 ** Admin pages requiring Admin privileges.
1537 */
1538 void setup_settings(void){
 
 
1539 Setting const *pSet;
 
1540
1541 login_check_credentials();
1542 if( !g.perm.Setup ){
1543 login_needed(0);
1544 return;
@@ -1555,11 +1558,11 @@
1555 @ See the "fossil help setting" output below for further information on
1556 @ the meaning of each setting.</p><hr />
1557 @ <form action="%s(g.zTop)/setup_settings" method="post"><div>
1558 @ <table border="0"><tr><td valign="top">
1559 login_insert_csrf_secret();
1560 for(pSet=aSetting; pSet->name!=0; pSet++){
1561 if( pSet->width==0 ){
1562 int hasVersionableValue = pSet->versionable &&
1563 (db_get_versioned(pSet->name, NULL)!=0);
1564 onoff_attribute(pSet->name, pSet->name,
1565 pSet->var!=0 ? pSet->var : pSet->name,
@@ -1571,29 +1574,29 @@
1571 }
1572 }
1573 }
1574 @ <br /><input type="submit" name="submit" value="Apply Changes" />
1575 @ </td><td style="width:50px;"></td><td valign="top">
1576 for(pSet=aSetting; pSet->name!=0; pSet++){
1577 if( pSet->width!=0 && !pSet->versionable && !pSet->forceTextArea ){
1578 entry_attribute(pSet->name, /*pSet->width*/ 25, pSet->name,
1579 pSet->var!=0 ? pSet->var : pSet->name,
1580 (char*)pSet->def, 0);
1581 @ <br />
1582 }
1583 }
1584 for(pSet=aSetting; pSet->name!=0; pSet++){
1585 if( pSet->width!=0 && !pSet->versionable && pSet->forceTextArea ){
1586 @<b>%s(pSet->name)</b><br />
1587 textarea_attribute("", /*rows*/ 3, /*cols*/ 50, pSet->name,
1588 pSet->var!=0 ? pSet->var : pSet->name,
1589 (char*)pSet->def, 0);
1590 @ <br />
1591 }
1592 }
1593 @ </td><td style="width:50px;"></td><td valign="top">
1594 for(pSet=aSetting; pSet->name!=0; pSet++){
1595 if( pSet->width!=0 && pSet->versionable ){
1596 int hasVersionableValue = db_get_versioned(pSet->name, NULL)!=0;
1597 @<b>%s(pSet->name)</b> (v)<br />
1598 textarea_attribute("", /*rows*/ 3, /*cols*/ 20, pSet->name,
1599 pSet->var!=0 ? pSet->var : pSet->name,
1600
--- src/setup.c
+++ src/setup.c
@@ -1534,11 +1534,14 @@
1534 **
1535 ** Change or view miscellaneous settings. Part of the
1536 ** Admin pages requiring Admin privileges.
1537 */
1538 void setup_settings(void){
1539 int nSetting;
1540 int i;
1541 Setting const *pSet;
1542 const Setting *aSetting = setting_info(&nSetting);
1543
1544 login_check_credentials();
1545 if( !g.perm.Setup ){
1546 login_needed(0);
1547 return;
@@ -1555,11 +1558,11 @@
1558 @ See the "fossil help setting" output below for further information on
1559 @ the meaning of each setting.</p><hr />
1560 @ <form action="%s(g.zTop)/setup_settings" method="post"><div>
1561 @ <table border="0"><tr><td valign="top">
1562 login_insert_csrf_secret();
1563 for(i=0, pSet=aSetting; i<nSetting; i++, pSet++){
1564 if( pSet->width==0 ){
1565 int hasVersionableValue = pSet->versionable &&
1566 (db_get_versioned(pSet->name, NULL)!=0);
1567 onoff_attribute(pSet->name, pSet->name,
1568 pSet->var!=0 ? pSet->var : pSet->name,
@@ -1571,29 +1574,29 @@
1574 }
1575 }
1576 }
1577 @ <br /><input type="submit" name="submit" value="Apply Changes" />
1578 @ </td><td style="width:50px;"></td><td valign="top">
1579 for(i=0, pSet=aSetting; i<nSetting; i++, pSet++){
1580 if( pSet->width!=0 && !pSet->versionable && !pSet->forceTextArea ){
1581 entry_attribute(pSet->name, /*pSet->width*/ 25, pSet->name,
1582 pSet->var!=0 ? pSet->var : pSet->name,
1583 (char*)pSet->def, 0);
1584 @ <br />
1585 }
1586 }
1587 for(i=0, pSet=aSetting; i<nSetting; i++, pSet++){
1588 if( pSet->width!=0 && !pSet->versionable && pSet->forceTextArea ){
1589 @<b>%s(pSet->name)</b><br />
1590 textarea_attribute("", /*rows*/ 3, /*cols*/ 50, pSet->name,
1591 pSet->var!=0 ? pSet->var : pSet->name,
1592 (char*)pSet->def, 0);
1593 @ <br />
1594 }
1595 }
1596 @ </td><td style="width:50px;"></td><td valign="top">
1597 for(i=0, pSet=aSetting; i<nSetting; i++, pSet++){
1598 if( pSet->width!=0 && pSet->versionable ){
1599 int hasVersionableValue = db_get_versioned(pSet->name, NULL)!=0;
1600 @<b>%s(pSet->name)</b> (v)<br />
1601 textarea_attribute("", /*rows*/ 3, /*cols*/ 20, pSet->name,
1602 pSet->var!=0 ? pSet->var : pSet->name,
1603

Keyboard Shortcuts

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