diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2016-10-12 01:51:06 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2016-10-12 01:51:06 -0400 |
commit | 4fc57660cf68a336d4180dda2abfd664976015f9 (patch) | |
tree | 86d0a6473388a6e35457bee1e8fa1755c9a40856 | |
parent | 66c15ac4faa5911f76f1bd481930d58ea4770ae1 (diff) | |
download | lynx-snapshots-4fc57660cf68a336d4180dda2abfd664976015f9.tar.gz |
snapshot of project "lynx", label v2-8-9dev_9d
-rw-r--r-- | CHANGES | 10 | ||||
-rwxr-xr-x | samples/oldlynx | 8 | ||||
-rw-r--r-- | src/LYCurses.h | 3 | ||||
-rw-r--r-- | src/LYReadCFG.c | 9 | ||||
-rw-r--r-- | src/LYStyle.c | 45 |
5 files changed, 54 insertions, 21 deletions
diff --git a/CHANGES b/CHANGES index 7ccc4cc8..82a60f3d 100644 --- a/CHANGES +++ b/CHANGES @@ -1,9 +1,17 @@ --- $LynxId: CHANGES,v 1.850 2016/10/11 09:00:29 tom Exp $ +-- $LynxId: CHANGES,v 1.852 2016/10/12 01:51:06 tom Exp $ =============================================================================== Changes since Lynx 2.8 release =============================================================================== 2016-10-11 (2.8.9dev.10) +* modify samples/oldlynx to provide an empty ".lss" file as a better default + than providing an empty "-lss" option -TD +* amend change made in 2.8.8dev.17 to permit multiple COLOR_STYLE items to + restore the ability to cancel the color-style by providing an explicitly + empty configuration item (in lynx.cfg, -lss or $LYNX_LSS). In lynx.cfg, it + is possible to follow the empty COLOR_STYLE with other data, but the -lss + option overrides everything, and if that is not found, $LYNX_LSS overrides + lynx.cfg -TD * correct ifdef so that if the "news" parsing is disabled at compile time, HTTP.c interprets https:// links correctly when a https_proxy is set up (patch by Al Walker). diff --git a/samples/oldlynx b/samples/oldlynx index 11fde3b0..79721b1f 100755 --- a/samples/oldlynx +++ b/samples/oldlynx @@ -3,7 +3,10 @@ # non-color-style scheme -TD my_cfg=${TMPDIR:-/tmp}/lynxcfg$$ -trap "rm -f $my_cfg" 0 1 2 5 15 +my_lss=${TMPDIR:-/tmp}/lynxlss$$ +trap "rm -f $my_lss $my_cfg" 0 1 2 5 15 + +echo >$my_lss rm -f "$my_cfg" echo "DEFAULT_COLORS:off" >>$my_cfg @@ -15,6 +18,7 @@ echo "NESTED_TABLES:off" >>$my_cfg LYNX_CFG=$my_cfg export LYNX_CFG -unset LYNX_LSS +LYNX_LSS=$my_lss +export LYNX_LSS ${LYNX_PROG-lynx} "$@" diff --git a/src/LYCurses.h b/src/LYCurses.h index b597ed2c..b7924a1f 100644 --- a/src/LYCurses.h +++ b/src/LYCurses.h @@ -1,4 +1,4 @@ -/* $LynxId: LYCurses.h,v 1.94 2013/10/22 08:10:43 tom Exp $ */ +/* $LynxId: LYCurses.h,v 1.95 2016/10/11 23:43:51 tom Exp $ */ #ifndef LYCURSES_H #define LYCURSES_H @@ -501,6 +501,7 @@ extern "C" { #if defined(USE_COLOR_STYLE) extern void add_to_lss_list(const char *source, const char *resolved); + extern void clear_lss_list(void); extern void curses_css(char *name, int dir); extern void curses_style(int style, int dir); extern void curses_w_style(WINDOW * win, int style, int dir); diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index d2ae340b..6d509779 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYReadCFG.c,v 1.187 2015/12/18 01:58:34 tom Exp $ + * $LynxId: LYReadCFG.c,v 1.188 2016/10/11 23:44:06 tom Exp $ */ #ifndef NO_RULES #include <HTRules.h> @@ -655,7 +655,12 @@ static int color_fun(char *value) #ifdef USE_COLOR_STYLE static int lynx_lss_file_fun(char *value) { - add_to_lss_list(value, NULL); + CTRACE((tfp, "lynx_lss_file_fun '%s'\n", NonNull(value))); + if (isEmpty(value)) { + clear_lss_list(); + } else { + add_to_lss_list(value, NULL); + } return 0; } #endif diff --git a/src/LYStyle.c b/src/LYStyle.c index 41d5591b..a9132f8a 100644 --- a/src/LYStyle.c +++ b/src/LYStyle.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYStyle.c,v 1.96 2014/01/09 21:01:22 tom Exp $ + * $LynxId: LYStyle.c,v 1.97 2016/10/12 00:50:05 tom Exp $ * * character level styles for Lynx * (c) 1996 Rob Partington -- donated to the Lyncei (if they want it :-) @@ -47,6 +47,7 @@ static HTList *lss_styles = NULL; static unsigned *cached_styles_ptr = NULL; static int cached_styles_rows = 0; static int cached_styles_cols = 0; +static BOOL empty_lss_list = FALSE; /* true if list explicitly emptied */ /* stack of attributes during page rendering */ int last_styles[MAX_LAST_STYLES + 1] = @@ -413,8 +414,7 @@ static void style_deleteStyleList(void) lss_styles = NULL; } -#ifdef LY_FIND_LEAKS -static void free_colorstyle_leaks(void) +static void free_lss_list(void) { LSS_NAMES *obj; @@ -429,7 +429,6 @@ static void free_colorstyle_leaks(void) } HTList_delete(list_of_lss_files); } -#endif static void free_colorstylestuff(void) { @@ -840,6 +839,13 @@ static char *find_lss_file(const char *nominal) return LYFindConfigFile(nominal, LYNX_LSS_FILE); } +void clear_lss_list(void) +{ + CTRACE((tfp, "clear_lss_list()\n")); + free_lss_list(); + empty_lss_list = TRUE; +} + /* * Add an entry to the lss-list, and cache the resolved filename if known. */ @@ -880,6 +886,7 @@ void add_to_lss_list(const char *source, const char *resolved) StrAllocCopy(obj->given, source); StrAllocCopy(obj->actual, resolved); HTList_appendObject(list_of_lss_files, obj); + empty_lss_list = FALSE; } } @@ -889,12 +896,27 @@ void add_to_lss_list(const char *source, const char *resolved) */ void init_color_styles(char **from_cmdline, const char *default_styles) { + char *user_lss_file = *from_cmdline; char *cp; /* - * If we read no COLOR_STYLE data from lynx.cfg, build a default list now. + * If a command-line "-lss" option was given, or if an environment variable + * is found, use that in preference to data from lynx.cfg */ - if (list_of_lss_files == 0) { + if (user_lss_file == 0) + user_lss_file = LYGetEnv("LYNX_LSS"); + if (user_lss_file == 0) + user_lss_file = LYGetEnv("lynx_lss"); + if (user_lss_file != 0) + empty_lss_list = (*user_lss_file == '\0'); + + /* + * If the color-style is explicitly emptied, go no further. + */ + if (empty_lss_list) { + CTRACE((tfp, "init_color_styles: overridden/empty\n")); + return; + } else if (list_of_lss_files == 0) { char *source = 0; char *config; @@ -910,17 +932,10 @@ void init_color_styles(char **from_cmdline, const char *default_styles) FREE(source); } - /* - * A command-line "-lss" always overrides the config-file, even if it is - * an empty string such as -lss="". - */ - if (*from_cmdline != 0) { + if (user_lss_file != 0) { FREE(lynx_lss_file); - lynx_lss_file = find_lss_file(cp = *from_cmdline); + lynx_lss_file = find_lss_file(cp = user_lss_file); *from_cmdline = 0; - } else if (((cp = LYGetEnv("LYNX_LSS")) != NULL) || - (cp = LYGetEnv("lynx_lss")) != NULL) { - lynx_lss_file = find_lss_file(cp); } else { lynx_lss_file = find_lss_file(cp = DeConst(LYNX_LSS_FILE)); } |