Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Merge the enhanced load control measure to trunk. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
9413395f5b2306678f7a86b62c636ae4 |
| User & Date: | drh 2022-04-15 13:56:40.738 |
Context
|
2022-04-16
| ||
| 16:29 | Minor spelling corrections. No change in functionality. ... (check-in: 53754fff0c user: andybradford tags: trunk) | |
|
2022-04-15
| ||
| 13:56 | Merge the enhanced load control measure to trunk. ... (check-in: 9413395f5b user: drh tags: trunk) | |
| 13:51 | Enhanced interpretation of the "autosync" setting. It is now possible to set the setting to "on,open=off" to cause autosync to be on by default but off for the "open" command, as an example. Use the "help autosync" command for further detail. ... (check-in: 346e45702c user: drh tags: trunk) | |
|
2022-04-14
| ||
| 17:41 | Added new loadavg-exempt WEBPAGE: flag for mkindex.c which exempts a given page from the load_control() check. Currently applied to /chat and its dependents: /builtin and /style.css. ... (Closed-Leaf check-in: 5c49ab3c7a user: stephan tags: load-control-rework) | |
Changes
Changes to src/builtin.c.
| ︙ | ︙ | |||
154 155 156 157 158 159 160 |
while( fossil_isdigit(zList[0]) ) zList++;
if( zList[0]==',' ) zList++;
}
return;
}
/*
| | | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
while( fossil_isdigit(zList[0]) ) zList++;
if( zList[0]==',' ) zList++;
}
return;
}
/*
** WEBPAGE: builtin loadavg-exempt
**
** Return one of many built-in content files. Query parameters:
**
** name=FILENAME Return the single file whose name is FILENAME.
** mimetype=TYPE Override the mimetype in the returned file to
** be TYPE. If this query parameter is omitted
** (the usual case) then the mimetype is inferred
|
| ︙ | ︙ |
Changes to src/chat.c.
| ︙ | ︙ | |||
126 127 128 129 130 131 132 | /* ** SETTING: chat-alert-sound width=10 ** ** This is the name of the builtin sound file to use for the alert tone. ** The value must be the name of a builtin WAV file. */ /* | | | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | /* ** SETTING: chat-alert-sound width=10 ** ** This is the name of the builtin sound file to use for the alert tone. ** The value must be the name of a builtin WAV file. */ /* ** WEBPAGE: chat loadavg-exempt ** ** Start up a browser-based chat session. ** ** This is the main page that humans use to access the chatroom. Simply ** point a web-browser at /chat and the screen fills with the latest ** chat messages, and waits for new one. ** |
| ︙ | ︙ | |||
340 341 342 343 344 345 346 |
}else{
CX("}");
}
fossil_free(zTime);
}
/*
| | | 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
}else{
CX("}");
}
fossil_free(zTime);
}
/*
** WEBPAGE: chat-send hidden loadavg-exempt
**
** This page receives (via XHR) a new chat-message and/or a new file
** to be entered into the chat history.
**
** On success it responds with an empty response: the new message
** should be fetched via /chat-poll. On error, e.g. login expiry,
** it emits a JSON response in the same form as described for
|
| ︙ | ︙ | |||
446 447 448 449 450 451 452 |
zOut = chat_format_to_html(g.argv[i]);
fossil_print("[%d]: %s\n", i, zOut);
fossil_free(zOut);
}
}
/*
| | | 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 |
zOut = chat_format_to_html(g.argv[i]);
fossil_print("[%d]: %s\n", i, zOut);
fossil_free(zOut);
}
}
/*
** WEBPAGE: chat-poll hidden loadavg-exempt
**
** The chat page generated by /chat using an XHR to this page to
** request new chat content. A typical invocation is:
**
** /chat-poll/N
** /chat-poll?name=N
**
|
| ︙ | ︙ | |||
665 666 667 668 669 670 671 | db_finalize(&q1); blob_append(&json, "\n]}", 3); cgi_set_content(&json); return; } /* | | | 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 | db_finalize(&q1); blob_append(&json, "\n]}", 3); cgi_set_content(&json); return; } /* ** WEBPAGE: chat-fetch-one hidden loadavg-exempt ** ** /chat-fetch-one/N ** ** Fetches a single message with the given ID, if available. ** ** Options: ** |
| ︙ | ︙ | |||
742 743 744 745 746 747 748 |
}else{
ajax_route_error(404,"Chat message #%d not found.", msgid);
}
db_finalize(&q);
}
/*
| | | 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 |
}else{
ajax_route_error(404,"Chat message #%d not found.", msgid);
}
db_finalize(&q);
}
/*
** WEBPAGE: chat-download hidden loadavg-exempt
**
** Download the CHAT.FILE attachment associated with a single chat
** entry. The "name" query parameter begins with an integer that
** identifies the particular chat message. The integer may be followed
** by a / and a filename, which will indicate to the browser to use
** the indicated name when saving the file.
*/
|
| ︙ | ︙ | |||
775 776 777 778 779 780 781 | db_blob(&r, "SELECT file FROM chat WHERE msgid=%d", msgid); cgi_set_content_type(zMime); cgi_set_content(&r); } /* | | | 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 |
db_blob(&r, "SELECT file FROM chat WHERE msgid=%d", msgid);
cgi_set_content_type(zMime);
cgi_set_content(&r);
}
/*
** WEBPAGE: chat-delete hidden loadavg-exempt
**
** Delete the chat entry identified by the name query parameter.
** Invoking fetch("chat-delete/"+msgid) from javascript in the client
** will delete a chat entry from the CHAT table.
**
** This routine both deletes the identified chat entry and also inserts
** a new entry with the current timestamp and with:
|
| ︙ | ︙ |
Changes to src/diff.c.
| ︙ | ︙ | |||
3592 3593 3594 3595 3596 3597 3598 |
unsigned clr1, clr2, clr;
int bBlame = g.zPath[0]!='a';/* True for BLAME output. False for ANNOTATE. */
/* Gather query parameters */
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
if( exclude_spiders() ) return;
| | | 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 |
unsigned clr1, clr2, clr;
int bBlame = g.zPath[0]!='a';/* True for BLAME output. False for ANNOTATE. */
/* Gather query parameters */
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
if( exclude_spiders() ) return;
fossil_nice_default();
zFilename = P("filename");
zRevision = PD("checkin",0);
zOrigin = P("origin");
zLimit = P("limit");
showLog = PB("log");
fileVers = PB("filevers");
ignoreWs = PB("w");
|
| ︙ | ︙ |
Changes to src/diffcmd.c.
| ︙ | ︙ | |||
1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 |
const char *zFrom = P("from");
const char *zTo = P("to");
DiffConfig DCfg;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
if( zFrom==0 || zTo==0 ) fossil_redirect_home();
cgi_set_content_type("text/plain");
diff_config_init(&DCfg, DIFF_VERBOSE);
diff_two_versions(zFrom, zTo, &DCfg, 0);
}
| > | 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 |
const char *zFrom = P("from");
const char *zTo = P("to");
DiffConfig DCfg;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
if( zFrom==0 || zTo==0 ) fossil_redirect_home();
fossil_nice_default();
cgi_set_content_type("text/plain");
diff_config_init(&DCfg, DIFF_VERBOSE);
diff_two_versions(zFrom, zTo, &DCfg, 0);
}
|
Changes to src/dispatch.c.
| ︙ | ︙ | |||
36 37 38 39 40 41 42 | unsigned int eCmdFlags; /* Flags */ }; /*************************************************************************** ** These macros must match similar macros in mkindex.c ** Allowed values for CmdOrPage.eCmdFlags. */ | | | | | | | | | | | | | > | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | unsigned int eCmdFlags; /* Flags */ }; /*************************************************************************** ** These macros must match similar macros in mkindex.c ** Allowed values for CmdOrPage.eCmdFlags. */ #define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */ #define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */ #define CMDFLAG_TEST 0x0004 /* Commands for testing only */ #define CMDFLAG_WEBPAGE 0x0008 /* Web pages */ #define CMDFLAG_COMMAND 0x0010 /* A command */ #define CMDFLAG_SETTING 0x0020 /* A setting */ #define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */ #define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */ #define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */ #define CMDFLAG_RAWCONTENT 0x0200 /* Do not interpret POST content */ /* NOTE: 0x0400 = CMDFLAG_SENSITIVE in mkindex.c! */ #define CMDFLAG_HIDDEN 0x0800 /* Elide from most listings */ #define CMDFLAG_LDAVG_EXEMPT 0x1000 /* Exempt from load_control() */ /**************************************************************************/ /* Values for the 2nd parameter to dispatch_name_search() */ #define CMDFLAG_ANY 0x0038 /* Match anything */ #define CMDFLAG_PREFIX 0x0200 /* Prefix match is ok */ #endif /* INTERFACE */ |
| ︙ | ︙ |
Changes to src/info.c.
| ︙ | ︙ | |||
1180 1181 1182 1183 1184 1185 1186 |
int graphFlags = 0;
Blob qp;
int bInvert = PB("inv");
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
login_anonymous_available();
| | | 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 |
int graphFlags = 0;
Blob qp;
int bInvert = PB("inv");
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
login_anonymous_available();
fossil_nice_default();
blob_init(&qp, 0, 0);
diffType = preferred_diff_type();
zRe = P("regex");
if( zRe ) re_compile(&pRe, zRe, 0);
zBranch = P("branch");
if( zBranch && zBranch[0]==0 ) zBranch = 0;
if( zBranch ){
|
| ︙ | ︙ |
Changes to src/json.c.
| ︙ | ︙ | |||
737 738 739 740 741 742 743 | /* ** Returns non-zero if the json_bootstrap_early() function has already ** been called. In general, this function should be used sparingly, ** e.g. from low-level support functions like fossil_warning() where ** there is genuine uncertainty about whether (or not) the JSON setup ** has already been called. */ | | | | 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 |
/*
** Returns non-zero if the json_bootstrap_early() function has already
** been called. In general, this function should be used sparingly,
** e.g. from low-level support functions like fossil_warning() where
** there is genuine uncertainty about whether (or not) the JSON setup
** has already been called.
*/
int json_is_bootstrapped_early(void){
return ((g.json.gc.v != NULL) && (g.json.gc.a != NULL));
}
/*
** Initializes some JSON bits which need to be initialized relatively
** early on. It should be called by any routine which might need to
** call into JSON relatively early on in the init process.
** Specifically, early on in cgi_init() and json_cmd_top(), but also
** from any error reporting routines which might be triggered (early
** on in those functions).
**
** Initializes g.json.gc and g.json.param. This code does not (and
** must not) rely on any of the fossil environment having been set
** up. e.g. it must not use cgi_parameter() and friends because this
** must be called before those data are initialized.
**
** If called multiple times, calls after the first are a no-op.
*/
void json_bootstrap_early(void){
cson_value * v;
if(g.json.gc.v!=NULL){
/* Avoid multiple bootstrappings. */
return;
}
g.json.timerId = fossil_timer_start();
|
| ︙ | ︙ |
Changes to src/loadctrl.c.
| ︙ | ︙ | |||
43 44 45 46 47 48 49 |
** Print the load average on the host machine.
*/
void loadavg_test_cmd(void){
fossil_print("load-average: %f\n", load_average());
}
/*
| | | > > > > > > > > > | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
** Print the load average on the host machine.
*/
void loadavg_test_cmd(void){
fossil_print("load-average: %f\n", load_average());
}
/*
** Abort the current page request if the load average of the host
** computer is too high. Admin and Setup users are exempt from this
** restriction.
*/
void load_control(void){
double mxLoad = atof(db_get("max-loadavg", 0));
#if 1
/* Disable this block only to test load restrictions */
if( mxLoad<=0.0 || mxLoad>=load_average() ) return;
login_check_credentials();
if(g.perm.Admin || g.perm.Setup){
return;
}
#endif
style_set_current_feature("test");
style_header("Server Overload");
@ <h2>The server load is currently too high.
@ Please try again later.</h2>
@ <p>Current load average: %f(load_average()).<br />
@ Load average limit: %f(mxLoad)</p>
|
| ︙ | ︙ |
Changes to src/login.c.
| ︙ | ︙ | |||
983 984 985 986 987 988 989 990 991 992 993 994 995 996 |
** variables appropriately.
**
** g.userUid Database USER.UID value. Might be -1 for "nobody"
** g.zLogin Database USER.LOGIN value. NULL for user "nobody"
** g.perm Permissions granted to this user
** g.anon Permissions that would be available to anonymous
** g.isHuman True if the user is human, not a spider or robot
**
*/
void login_check_credentials(void){
int uid = 0; /* User id */
const char *zCookie; /* Text of the login cookie */
const char *zIpAddr; /* Raw IP address of the requestor */
const char *zCap = 0; /* Capability string */
| > | 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 |
** variables appropriately.
**
** g.userUid Database USER.UID value. Might be -1 for "nobody"
** g.zLogin Database USER.LOGIN value. NULL for user "nobody"
** g.perm Permissions granted to this user
** g.anon Permissions that would be available to anonymous
** g.isHuman True if the user is human, not a spider or robot
** g.perm Populated based on user account's capabilities
**
*/
void login_check_credentials(void){
int uid = 0; /* User id */
const char *zCookie; /* Text of the login cookie */
const char *zIpAddr; /* Raw IP address of the requestor */
const char *zCap = 0; /* Capability string */
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
1871 1872 1873 1874 1875 1876 1877 |
}
}
/* At this point, the appropriate repository database file will have
** been opened.
*/
| < | 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 |
}
}
/* At this point, the appropriate repository database file will have
** been opened.
*/
/*
** Check to see if the first term of PATH_INFO specifies an
** alternative skin. This will be the case if the first term of
** PATH_INFO begins with "draftN/" where N is an integer between 1
** and 9. If so, activate the skin associated with that draft.
*/
if( zPathInfo && strncmp(zPathInfo,"/draft",6)==0
|
| ︙ | ︙ | |||
2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 |
#endif
{
@ <h1>Server Configuration Error</h1>
@ <p>The database schema on the server is out-of-date. Please ask
@ the administrator to run <b>fossil rebuild</b>.</p>
}
}else{
#ifdef FOSSIL_ENABLE_JSON
static int jsonOnce = 0;
if( jsonOnce==0 && g.json.isJsonMode!=0 ){
assert(json_is_bootstrapped_early());
json_bootstrap_late();
jsonOnce = 1;
}
| > > > | 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 |
#endif
{
@ <h1>Server Configuration Error</h1>
@ <p>The database schema on the server is out-of-date. Please ask
@ the administrator to run <b>fossil rebuild</b>.</p>
}
}else{
if(0==(CMDFLAG_LDAVG_EXEMPT & pCmd->eCmdFlags)){
load_control();
}
#ifdef FOSSIL_ENABLE_JSON
static int jsonOnce = 0;
if( jsonOnce==0 && g.json.isJsonMode!=0 ){
assert(json_is_bootstrapped_early());
json_bootstrap_late();
jsonOnce = 1;
}
|
| ︙ | ︙ |
Changes to src/stat.c.
| ︙ | ︙ | |||
961 962 963 964 965 966 967 |
** user without check-in privileges, to prevent excessive usage by
** robots and random passers-by on the internet
*/
if( !g.perm.Write && !db_get_boolean("artifact_stats_enable",0) ){
login_needed(g.anon.Write);
return;
}
| | | 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 |
** user without check-in privileges, to prevent excessive usage by
** robots and random passers-by on the internet
*/
if( !g.perm.Write && !db_get_boolean("artifact_stats_enable",0) ){
login_needed(g.anon.Write);
return;
}
fossil_nice_default();
style_set_current_feature("stat");
style_header("Artifact Statistics");
style_submenu_element("Repository Stats", "stat");
style_submenu_element("Artifact List", "bloblist");
gather_artifact_stats(1);
|
| ︙ | ︙ |
Changes to src/style.c.
| ︙ | ︙ | |||
1208 1209 1210 1211 1212 1213 1214 | ** /forumXYZ CSS into one file, all /setupXYZ into another, etc. As ** of this writing, doing so would only shave a few kb from ** default.css. */ fossil_free(zFile); } /* | | | 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 | ** /forumXYZ CSS into one file, all /setupXYZ into another, etc. As ** of this writing, doing so would only shave a few kb from ** default.css. */ fossil_free(zFile); } /* ** WEBPAGE: style.css loadavg-exempt ** ** Return the style sheet. The style sheet is assemblied from ** multiple sources, in order: ** ** (1) The built-in "default.css" style sheet containing basic defaults. ** ** (2) The page-specific style sheet taken from the built-in |
| ︙ | ︙ |
Changes to src/tar.c.
| ︙ | ︙ | |||
754 755 756 757 758 759 760 |
Glob *pInclude = 0; /* The compiled in= glob pattern */
Glob *pExclude = 0; /* The compiled ex= glob pattern */
Blob tarball; /* Tarball accumulated here */
const char *z;
login_check_credentials();
if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
| | | 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 |
Glob *pInclude = 0; /* The compiled in= glob pattern */
Glob *pExclude = 0; /* The compiled ex= glob pattern */
Blob tarball; /* Tarball accumulated here */
const char *z;
login_check_credentials();
if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
fossil_nice_default();
zName = fossil_strdup(PD("name",""));
z = P("r");
if( z==0 ) z = P("uuid");
if( z==0 ) z = tar_uuid_from_name(&zName);
if( z==0 ) z = "trunk";
g.zOpenRevision = zRid = fossil_strdup(z);
nRid = strlen(zRid);
|
| ︙ | ︙ |
Changes to src/util.c.
| ︙ | ︙ | |||
894 895 896 897 898 899 900 |
break;
}
}
}
#endif
return zBrowser;
}
| > > > > > > > > > > > > > > > > > > > | 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 |
break;
}
}
}
#endif
return zBrowser;
}
/*
** On non-Windows systems, calls nice(2) with the given level. Errors
** are ignored. On Windows this is a no-op.
*/
void fossil_nice(int level){
#ifndef _WIN32
nice(level);
#else
(void)level;
#endif
}
/*
** Calls fossil_nice() with a default level.
*/
void fossil_nice_default(void){
fossil_nice(20);
}
|
Changes to src/zip.c.
| ︙ | ︙ | |||
919 920 921 922 923 924 925 |
if( fossil_strcmp(g.zPath, "sqlar")==0 ){
eType = ARCHIVE_SQLAR;
zType = "SQL";
}else{
eType = ARCHIVE_ZIP;
zType = "ZIP";
}
| | | 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 |
if( fossil_strcmp(g.zPath, "sqlar")==0 ){
eType = ARCHIVE_SQLAR;
zType = "SQL";
}else{
eType = ARCHIVE_ZIP;
zType = "ZIP";
}
fossil_nice_default();
zName = fossil_strdup(PD("name",""));
z = P("r");
if( z==0 ) z = P("uuid");
if( z==0 ) z = tar_uuid_from_name(&zName);
if( z==0 ) z = "trunk";
nName = strlen(zName);
g.zOpenRevision = zRid = fossil_strdup(z);
|
| ︙ | ︙ |
Changes to tools/mkindex.c.
| ︙ | ︙ | |||
78 79 80 81 82 83 84 | #include <assert.h> #include <string.h> /*************************************************************************** ** These macros must match similar macros in dispatch.c. ** ** Allowed values for CmdOrPage.eCmdFlags. */ | | | | | | | | | | | | | > | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
#include <assert.h>
#include <string.h>
/***************************************************************************
** These macros must match similar macros in dispatch.c.
**
** Allowed values for CmdOrPage.eCmdFlags. */
#define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */
#define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */
#define CMDFLAG_TEST 0x0004 /* Commands for testing only */
#define CMDFLAG_WEBPAGE 0x0008 /* Web pages */
#define CMDFLAG_COMMAND 0x0010 /* A command */
#define CMDFLAG_SETTING 0x0020 /* A setting */
#define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */
#define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */
#define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */
#define CMDFLAG_RAWCONTENT 0x0200 /* Do not interpret webpage content */
#define CMDFLAG_SENSITIVE 0x0400 /* Security-sensitive setting */
#define CMDFLAG_HIDDEN 0x0800 /* Elide from most listings */
#define CMDFLAG_LDAVG_EXEMPT 0x1000 /* Exempt from load_control() */
/**************************************************************************/
/*
** Each entry looks like this:
*/
typedef struct Entry {
int eType; /* CMDFLAG_* values */
|
| ︙ | ︙ | |||
258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
aEntry[nUsed].iWidth = atoi(&zLine[i+6]);
}else if( j>8 && strncmp(&zLine[i], "default=", 8)==0 ){
aEntry[nUsed].zDflt = string_dup(&zLine[i+8], j-8);
}else if( j>9 && strncmp(&zLine[i], "variable=", 9)==0 ){
aEntry[nUsed].zVar = string_dup(&zLine[i+9], j-9);
}else if( j==6 && strncmp(&zLine[i], "hidden", 6)==0 ){
aEntry[nUsed].eType |= CMDFLAG_HIDDEN;
}else{
fprintf(stderr, "%s:%d: unknown option: '%.*s'\n",
zFile, nLine, j, &zLine[i]);
nErr++;
}
}
| > > | 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
aEntry[nUsed].iWidth = atoi(&zLine[i+6]);
}else if( j>8 && strncmp(&zLine[i], "default=", 8)==0 ){
aEntry[nUsed].zDflt = string_dup(&zLine[i+8], j-8);
}else if( j>9 && strncmp(&zLine[i], "variable=", 9)==0 ){
aEntry[nUsed].zVar = string_dup(&zLine[i+9], j-9);
}else if( j==6 && strncmp(&zLine[i], "hidden", 6)==0 ){
aEntry[nUsed].eType |= CMDFLAG_HIDDEN;
}else if( j==14 && strncmp(&zLine[i], "loadavg-exempt", 14)==0 ){
aEntry[nUsed].eType |= CMDFLAG_LDAVG_EXEMPT;
}else{
fprintf(stderr, "%s:%d: unknown option: '%.*s'\n",
zFile, nLine, j, &zLine[i]);
nErr++;
}
}
|
| ︙ | ︙ |