diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1998-03-18 12:12:19 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1998-03-18 12:12:19 -0500 |
commit | d8e8363bb47d88e434c2128c4c1ffbf501a67898 (patch) | |
tree | af03af9eef872e7b81ac815a702c992f2c4e1977 /src/LYReadCFG.c | |
parent | 88a8487639527e04313c7c87f390e7a45f7c529a (diff) | |
download | lynx-snapshots-d8e8363bb47d88e434c2128c4c1ffbf501a67898.tar.gz |
snapshot of project "lynx", label v2-8-1dev_2
Diffstat (limited to 'src/LYReadCFG.c')
-rw-r--r-- | src/LYReadCFG.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index 736aeab4..4a57dcdc 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -440,8 +440,10 @@ PRIVATE void parse_color ARGS1( /* * Process the configuration file (lynx.cfg). */ -PUBLIC void read_cfg ARGS1( - char *, cfg_filename) +PUBLIC void read_cfg ARGS3( + char *, cfg_filename, + char *, parent_filename, + int, nesting_level) { FILE *fp; char buffer[501]; @@ -449,6 +451,22 @@ PUBLIC void read_cfg ARGS1( char *cp, *cp1; int i, j, len; + if (TRACE) { + fprintf(stderr, + "Loading cfg file '%s'.\n", cfg_filename); + } + /* + * Don't get hung up by an include file loop. Arbitrary max depth + * of 10. - BL + */ + if (nesting_level > 10) { + fprintf(stderr, + "More than %d nested lynx.cfg includes -- perhaps there is a loop?!?\n", + nesting_level - 1); + fprintf(stderr,"Last attempted include was '%s',\n", cfg_filename); + fprintf(stderr,"included from '%s'.\n", parent_filename); + exit(-1); + } /* * Locate and open the file. */ @@ -620,6 +638,7 @@ PUBLIC void read_cfg ARGS1( } else if (!strncasecomp(buffer, "DEFAULT_CACHE_SIZE:", 19)) { HTCacheSize = atoi(buffer+19); + if (HTCacheSize < 2) HTCacheSize = 2; } else if (!system_editor && !strncasecomp(buffer, "DEFAULT_EDITOR:", 15)) { @@ -766,7 +785,10 @@ PUBLIC void read_cfg ARGS1( break; case 'I': - if (!strncasecomp(buffer, "INFOSECS:", 9)) { + if (!strncasecomp(buffer, "include:", 8)) { + strcpy(temp, buffer+8); + read_cfg(temp, cfg_filename, nesting_level + 1); + } else if (!strncasecomp(buffer, "INFOSECS:", 9)) { strcpy(temp, buffer+9); for (i = 0; temp[i]; i++) { if (!isdigit(temp[i])) { |