diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1998-09-22 11:57:43 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1998-09-22 11:57:43 -0400 |
commit | 07e246c51644d9790f2eaf4001ff4ffd40e3274f (patch) | |
tree | 6a3715d7c5d8cabf396b5fbf54b26f502d760587 /src | |
parent | 51a6f85e8e96e257cbb43d0daab7abdf36ad2186 (diff) | |
download | lynx-snapshots-07e246c51644d9790f2eaf4001ff4ffd40e3274f.tar.gz |
snapshot of project "lynx", label v2-8-1pre_1
Diffstat (limited to 'src')
-rw-r--r-- | src/HTAlert.c | 17 | ||||
-rw-r--r-- | src/HTML.c | 21 | ||||
-rw-r--r-- | src/HTML.h | 4 | ||||
-rw-r--r-- | src/LYCharUtils.c | 2 | ||||
-rw-r--r-- | src/LYGlobalDefs.h | 9 | ||||
-rw-r--r-- | src/LYMain.c | 1 | ||||
-rw-r--r-- | src/LYOptions.c | 6 | ||||
-rw-r--r-- | src/LYReadCFG.c | 1 | ||||
-rw-r--r-- | src/LYStrings.c | 6 | ||||
-rw-r--r-- | src/LYUtils.c | 5 |
10 files changed, 46 insertions, 26 deletions
diff --git a/src/HTAlert.c b/src/HTAlert.c index a4c57b8f..d305cbb4 100644 --- a/src/HTAlert.c +++ b/src/HTAlert.c @@ -93,7 +93,7 @@ PUBLIC void HTReadProgress ARGS2( static long kb_units = 1024; static time_t first, last; static long bytes_last; - long transfer_rate; + long transfer_rate, divisor; char line[80]; time_t now = time((time_t *)0); /* once per second */ char *units = "bytes"; @@ -115,18 +115,21 @@ PUBLIC void HTReadProgress ARGS2( last = now; bytes_last = bytes; } - if (total >= kb_units || bytes >= kb_units) { - bytes /= 1024; - if (total > 0) total /= 1024; + divisor = 1; + if (LYshow_kb_rate + && (total >= kb_units || bytes >= kb_units)) { + divisor = 1024; + bytes /= divisor; + if (total > 0) total /= divisor; units = "KB"; } if (total > 0) sprintf (line, "Read %ld of %ld %s of data.", bytes, total, units); - if (total <= 0) + else sprintf (line, "Read %ld %s of data.", bytes, units); - if (transfer_rate > 0) - sprintf (line + strlen(line), " %ld KB/sec.", transfer_rate / 1024); + if (transfer_rate > 0) + sprintf (line + strlen(line), ", %ld %s/sec.", transfer_rate / divisor, units); if (total < 0) { if (total < -1) strcat(line, " (Press 'z' to abort)"); diff --git a/src/HTML.c b/src/HTML.c index 964af7f8..4271a1d3 100644 --- a/src/HTML.c +++ b/src/HTML.c @@ -83,7 +83,7 @@ PRIVATE HTStyleSheet * styleSheet; /* Application-wide */ /* Module-wide style cache */ -PUBLIC HTStyle *styles[HTML_ELEMENTS+31]; /* adding 24 nested list styles */ +PRIVATE HTStyle *styles[HTML_ELEMENTS+31]; /* adding 24 nested list styles */ /* and 3 header alignment styles */ /* and 3 div alignment styles */ PRIVATE HTStyle *default_style; @@ -101,12 +101,6 @@ PRIVATE void HTML_end_element PARAMS((HTStructured *me, int element_number, char **include)); -/* Forward declarations of routines -*/ -PRIVATE void get_styles NOPARAMS; -PRIVATE void change_paragraph_style PARAMS((HTStructured * me, - HTStyle * style)); - /* * If we have verbose_img set, display labels for images. */ @@ -6972,6 +6966,7 @@ PRIVATE void HTML_abort ARGS2(HTStructured *, me, HTError, e) */ PRIVATE void get_styles NOARGS { + styleSheet = DefaultStyle(); default_style = HTStyleNamed(styleSheet, "Normal"); styles[HTML_H1] = HTStyleNamed(styleSheet, "Heading1"); @@ -7038,6 +7033,17 @@ PRIVATE void get_styles NOARGS styles[HTML_LISTING] = HTStyleNamed(styleSheet, "Listing"); } +/* + * If we're called from another module, make sure we've initialized styles + * array first. + */ +PUBLIC HTStyle *LYstyles ARGS1(int, style_number) +{ + if (styles[style_number] == 0) + get_styles(); + return styles[style_number]; +} + /* P U B L I C */ @@ -7099,7 +7105,6 @@ PUBLIC HTStructured* HTML_new ARGS3( * array is not necessarily the same as it was from 'get_styles()'. So * we reinitialize the whole thing. */ - styleSheet = DefaultStyle(); get_styles(); me->isa = &HTMLPresentation; diff --git a/src/HTML.h b/src/HTML.h index 8a5ee014..c2da4189 100644 --- a/src/HTML.h +++ b/src/HTML.h @@ -207,9 +207,7 @@ struct _HTStructured { int tag_charset; /* charset for attribute values etc. */ }; -extern HTStyle *styles[HTML_ELEMENTS+31]; /* adding 24 nested list styles */ - /* and 3 header alignment styles */ - /* and 3 div alignment styles */ +extern HTStyle *LYstyles PARAMS((int style_number)); /* * Semi-Private functions. - FM diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c index d9f01c15..f372471e 100644 --- a/src/LYCharUtils.c +++ b/src/LYCharUtils.c @@ -3121,7 +3121,7 @@ PUBLIC void LYHandleP ARGS5( me->in_word = NO; if (LYoverride_default_alignment(me)) { - me->sp->style->alignment = styles[me->sp[0].tag_number]->alignment; + me->sp->style->alignment = LYstyles(me->sp[0].tag_number)->alignment; } else if (me->List_Nesting_Level >= 0 || ((me->Division_Level < 0) && (!strcmp(me->sp->style->name, "Normal") || diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h index 3dc93a14..c3ebddbd 100644 --- a/src/LYGlobalDefs.h +++ b/src/LYGlobalDefs.h @@ -154,7 +154,8 @@ extern BOOLEAN LYforce_no_cache; extern BOOLEAN LYoverride_no_cache; /* don't need fresh copy, from history */ extern BOOLEAN LYinternal_flag; /* don't need fresh copy, was internal link */ extern BOOLEAN LYresubmit_posts; -extern int user_mode; /* novice or advanced */ +extern BOOLEAN LYshow_kb_rate; /* show KB/sec in HTReadProgress */ +extern int user_mode; /* novice or advanced */ extern BOOLEAN is_www_index; extern BOOLEAN dump_output_immediately; extern int dump_output_width; @@ -167,9 +168,9 @@ extern BOOLEAN telnet_ok; extern BOOLEAN news_ok; extern BOOLEAN ftp_ok; extern BOOLEAN rlogin_ok; -extern BOOLEAN no_print; /* TRUE to disable printing */ -extern BOOLEAN system_editor; /* True if locked-down editor */ -extern BOOLEAN child_lynx; /* TRUE to exit with an arrow */ +extern BOOLEAN no_print; /* TRUE to disable printing */ +extern BOOLEAN system_editor; /* True if locked-down editor */ +extern BOOLEAN child_lynx; /* TRUE to exit with an arrow */ extern BOOLEAN error_logging; /* TRUE to mail error messages */ extern BOOLEAN check_mail; /* TRUE to report unread/new mail messages */ extern BOOLEAN vi_keys; /* TRUE to turn on vi-like key movement */ diff --git a/src/LYMain.c b/src/LYMain.c index 83d0ac22..05e7d45f 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -150,6 +150,7 @@ PUBLIC BOOLEAN LYforce_no_cache = FALSE; PUBLIC BOOLEAN LYoverride_no_cache = FALSE;/*override no-cache b/c history etc*/ PUBLIC BOOLEAN LYinternal_flag = FALSE; /* override no-cache b/c internal link*/ PUBLIC BOOLEAN LYresubmit_posts = ALWAYS_RESUBMIT_POSTS; +PUBLIC BOOLEAN LYshow_kb_rate = TRUE; PUBLIC BOOLEAN LYUserSpecifiedURL = TRUE;/* always TRUE the first time */ PUBLIC BOOLEAN LYJumpFileURL = FALSE; /* always FALSE the first time */ PUBLIC BOOLEAN jump_buffer = JUMPBUFFER; /* TRUE if offering default shortcut */ diff --git a/src/LYOptions.c b/src/LYOptions.c index 905aa333..b735913c 100644 --- a/src/LYOptions.c +++ b/src/LYOptions.c @@ -3145,6 +3145,7 @@ static OptValues search_type_values[] = { { TRUE, "Case sensitive", "case_sensitive" }, { 0, 0, 0 }}; static char * select_popups_string = "select_popups"; +#if defined(USE_SLANG) || defined(COLOR_CURSES) static char * show_color_string = "show_color"; static OptValues show_color_values[] = { { SHOW_COLOR_NEVER, never_string, never_string }, @@ -3152,6 +3153,7 @@ static OptValues show_color_values[] = { { SHOW_COLOR_ON, on_string, on_string }, { SHOW_COLOR_ALWAYS, always_string, always_string }, { 0, 0, 0 }}; +#endif static char * show_cursor_string = "show_cursor"; static char * user_mode_string = "user_mode"; static OptValues user_mode_values[] = { @@ -3363,7 +3365,9 @@ PUBLIC int postoptions ARGS1( BOOLEAN raw_mode_changed = FALSE; BOOLEAN assume_char_set_changed = FALSE; BOOLEAN need_reload = FALSE; +#if defined(USE_SLANG) || defined(COLOR_CURSES) int CurrentShowColor = LYShowColor; +#endif /*------------------------------------------------- * kludge a link from mbm_menu, the URL was: @@ -3685,7 +3689,9 @@ PUBLIC int gen_options ARGS1( char **, newfile) { int i; +#if defined(USE_SLANG) || defined(COLOR_CURSES) BOOLEAN can_do_colors; +#endif static char tempfile[LY_MAXPATH]; FILE *fp0; size_t cset_len = 0; diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index 53ccd4b3..e88aa621 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -913,6 +913,7 @@ static Config_Type Config_Table [] = PARSE_SET("seek_frag_map_in_cur", CONF_BOOL, LYSeekFragMAPinCur), PARSE_SET("set_cookies", CONF_BOOL, LYSetCookies), PARSE_SET("show_cursor", CONF_BOOL, LYShowCursor), + PARSE_SET("show_kb_rate", CONF_BOOL, LYshow_kb_rate), PARSE_ENV("snews_proxy", CONF_ENV, 0 ), PARSE_ENV("snewspost_proxy", CONF_ENV, 0 ), PARSE_ENV("snewsreply_proxy", CONF_ENV, 0 ), diff --git a/src/LYStrings.c b/src/LYStrings.c index 54375259..8a6a8c65 100644 --- a/src/LYStrings.c +++ b/src/LYStrings.c @@ -737,8 +737,10 @@ PRIVATE void setup_vtXXX_keymap NOARGS DEFINE_KEY( "\033[6~", PGDOWN, KEY_NPAGE ), DEFINE_KEY( "\033[8~", END_KEY, KEY_END ), DEFINE_KEY( "\033[7~", HOME, KEY_HOME), - DEFINE_KEY( "\033[28~", F1, KEY_F(0) ), - DEFINE_KEY( "\033[29~", DO_KEY, KEY_F(6) ), + DEFINE_KEY( "\033[28~", F1, KEY_F(1) ), + DEFINE_KEY( "\033OP", F1, KEY_F(1) ), + DEFINE_KEY( "\033[OP", F1, KEY_F(1) ), + DEFINE_KEY( "\033[29~", DO_KEY, KEY_F(16) ), }; size_t n; for (n = 0; n < TABLESIZE(table); n++) diff --git a/src/LYUtils.c b/src/LYUtils.c index 9f1ae177..e2447dde 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -3485,11 +3485,14 @@ PUBLIC void parse_restrictions ARGS1( while (*p != ',' && *p != '\0') p++; - for (i=0; restrict_name[i]; i++) + for (i=0; restrict_name[i]; i++) { if (STRNEQ(word, restrict_name[i], p-word)) { *restrict_flag[i] = TRUE; break; } + } + if (*p) + p++; } return; } |