diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2001-02-13 01:44:28 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2001-02-13 01:44:28 -0500 |
commit | affaa4f761ddf2c0edce3e00f3a989a0ef8a44d8 (patch) | |
tree | 3da4fcaa7cba63a893e69b0e6737b6eb4cea4079 /src | |
parent | 2a786b2632ff4fe945cb5826f7a378778caf72eb (diff) | |
download | lynx-snapshots-affaa4f761ddf2c0edce3e00f3a989a0ef8a44d8.tar.gz |
snapshot of project "lynx", label v2-8-4dev_18
Diffstat (limited to 'src')
-rw-r--r-- | src/GridText.c | 85 | ||||
-rw-r--r-- | src/HTAlert.c | 4 | ||||
-rw-r--r-- | src/HTML.c | 9 | ||||
-rw-r--r-- | src/LYCurses.c | 140 | ||||
-rw-r--r-- | src/LYCurses.h | 8 | ||||
-rw-r--r-- | src/LYEditmap.c | 13 | ||||
-rw-r--r-- | src/LYForms.c | 19 | ||||
-rw-r--r-- | src/LYGlobalDefs.h | 1 | ||||
-rw-r--r-- | src/LYHash.c | 22 | ||||
-rw-r--r-- | src/LYHash.h | 6 | ||||
-rw-r--r-- | src/LYKeymap.c | 1 | ||||
-rw-r--r-- | src/LYMain.c | 12 | ||||
-rw-r--r-- | src/LYMainLoop.c | 11 | ||||
-rw-r--r-- | src/LYNews.c | 4 | ||||
-rw-r--r-- | src/LYOptions.c | 2 | ||||
-rw-r--r-- | src/LYReadCFG.c | 13 | ||||
-rw-r--r-- | src/LYReadCFG.h | 1 | ||||
-rw-r--r-- | src/LYStrings.c | 25 | ||||
-rw-r--r-- | src/LYStrings.h | 7 | ||||
-rw-r--r-- | src/LYStyle.c | 35 | ||||
-rw-r--r-- | src/LYUtils.c | 25 | ||||
-rw-r--r-- | src/LYexit.c | 10 | ||||
-rw-r--r-- | src/makefile.in | 2 |
23 files changed, 271 insertions, 184 deletions
diff --git a/src/GridText.c b/src/GridText.c index 94d45d17..8c2078d9 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -146,14 +146,6 @@ PUBLIC int LYsb_end = -1; #if defined(USE_COLOR_STYLE) #define MAX_STYLES_ON_LINE 64 -#ifdef OLD_HTSTYLECHANGE -typedef struct _stylechange { - int horizpos; /* horizontal position of this change */ - int style; /* which style to change to */ - int direction; /* on or off */ - int previous; /* previous style */ -} HTStyleChange; -#else /*try to fit in 2 shorts*/ typedef struct _stylechange { unsigned int direction:2; /* on or off */ @@ -162,7 +154,6 @@ typedef struct _stylechange { unsigned short style; /* which style to change to */ } HTStyleChange; #endif -#endif typedef struct _line { struct _line *next; @@ -173,17 +164,13 @@ typedef struct _line { BOOL bullet; /* Do we bullet? */ BOOL expansion_line; /* TEXTAREA edit new line flag */ #if defined(USE_COLOR_STYLE) -#ifdef OLD_HTSTYLECHANGE - HTStyleChange styles[MAX_STYLES_ON_LINE]; -#else HTStyleChange* styles; -#endif int numstyles; #endif char data[1]; /* Space for terminator at least! */ } HTLine; -#if defined(USE_COLOR_STYLE) && !defined(OLD_HTSTYLECHANGE) +#if defined(USE_COLOR_STYLE) typedef struct _HTStyleChangePool { HTStyleChange data[4092]; struct _HTStyleChangePool* next; @@ -412,7 +399,7 @@ struct _HText { HTStream * target; /* Output stream */ HTStreamClass targetClass; /* Output routines */ -#if defined(USE_COLOR_STYLE) && !defined(OLD_HTSTYLECHANGE) +#if defined(USE_COLOR_STYLE) HTStyleChangePool* styles_pool; #endif }; @@ -761,14 +748,12 @@ PUBLIC HText * HText_new ARGS1( line->offset = line->size = 0; #ifdef USE_COLOR_STYLE line->numstyles = 0; -#ifndef OLD_HTSTYLECHANGE POOL_NEW(HTStyleChangePool,self->styles_pool); if (!self->styles_pool) outofmem(__FILE__, "HText_New"); stylechanges_buffers_free = 0; line->styles = stylechanges_buffers[0]; #endif -#endif self->Lines = self->chars = 0; self->first_anchor = self->last_anchor = NULL; self->style = &default_style; @@ -936,7 +921,7 @@ PUBLIC void HText_free ARGS1( return; HTAnchor_setDocument(self->node_anchor, (HyperDoc *)0); -#if defined(USE_COLOR_STYLE) && !defined(OLD_HTSTYLECHANGE) +#if defined(USE_COLOR_STYLE) POOL_FREE(HTStyleChangePool,self->styles_pool); #endif while (YES) { /* Free off line array */ @@ -1223,8 +1208,8 @@ PRIVATE int display_line ARGS4( while (current_style < line->numstyles && i >= (int) (CStyle.horizpos + line->offset + 1)) { - LynxChangeStyle (CStyle.style,CStyle.direction,CStyle.previous); - current_style++; + LynxChangeStyle (CStyle.style,CStyle.direction); + current_style++; } #endif switch (buffer[0]) { @@ -1427,7 +1412,7 @@ after_while: #else while (current_style < line->numstyles) { - LynxChangeStyle (CStyle.style, CStyle.direction, CStyle.previous); + LynxChangeStyle (CStyle.style, CStyle.direction); current_style++; } #undef CStyle @@ -1458,9 +1443,9 @@ PRIVATE void display_title ARGS1( #ifdef USE_COLOR_STYLE /* turn the TITLE style on */ if (last_colorattr_ptr > 0) { - LynxChangeStyle(s_title, STACK_ON, 0); + LynxChangeStyle(s_title, STACK_ON); } else { - LynxChangeStyle(s_title, ABS_ON, 0); + LynxChangeStyle(s_title, ABS_ON); } #endif /* USE_COLOR_STYLE */ @@ -1581,7 +1566,7 @@ PRIVATE void display_title ARGS1( #ifdef USE_COLOR_STYLE /* turn the TITLE style off */ - LynxChangeStyle(s_title, STACK_OFF, 0); + LynxChangeStyle(s_title, STACK_OFF); #endif /* USE_COLOR_STYLE */ lynx_stop_title_color (); @@ -1645,31 +1630,31 @@ PRIVATE void display_scrollbar ARGS1( int s = top_skip ? s_sb_aa : s_sb_naa; if (last_colorattr_ptr > 0) { - LynxChangeStyle(s, STACK_ON, 0); + LynxChangeStyle(s, STACK_ON); } else { - LynxChangeStyle(s, ABS_ON, 0); + LynxChangeStyle(s, ABS_ON); } #endif /* USE_COLOR_STYLE */ LYmove(1, LYcols - 1); addch_raw(ACS_UARROW); #ifdef USE_COLOR_STYLE - LynxChangeStyle(s, STACK_OFF, 0); + LynxChangeStyle(s, STACK_OFF); #endif /* USE_COLOR_STYLE */ } #ifdef USE_COLOR_STYLE if (last_colorattr_ptr > 0) { - LynxChangeStyle(s_sb_bg, STACK_ON, 0); + LynxChangeStyle(s_sb_bg, STACK_ON); } else { - LynxChangeStyle(s_sb_bg, ABS_ON, 0); + LynxChangeStyle(s_sb_bg, ABS_ON); } #endif /* USE_COLOR_STYLE */ for (i=1; i <= h; i++) { #ifdef USE_COLOR_STYLE if (i-1 <= top_skip && i > top_skip) - LynxChangeStyle(s_sb_bar, STACK_ON, 0); + LynxChangeStyle(s_sb_bar, STACK_ON); if (i-1 <= h - bot_skip && i > h - bot_skip) - LynxChangeStyle(s_sb_bar, STACK_OFF, 0); + LynxChangeStyle(s_sb_bar, STACK_OFF); #endif /* USE_COLOR_STYLE */ LYmove(i + off, LYcols - 1); if (i > top_skip && i <= h - bot_skip) @@ -1678,7 +1663,7 @@ PRIVATE void display_scrollbar ARGS1( LYaddch(ACS_CKBOARD); } #ifdef USE_COLOR_STYLE - LynxChangeStyle(s_sb_bg, STACK_OFF, 0); + LynxChangeStyle(s_sb_bg, STACK_OFF); #endif /* USE_COLOR_STYLE */ if (LYsb_arrow) { @@ -1686,15 +1671,15 @@ PRIVATE void display_scrollbar ARGS1( int s = bot_skip ? s_sb_aa : s_sb_naa; if (last_colorattr_ptr > 0) { - LynxChangeStyle(s, STACK_ON, 0); + LynxChangeStyle(s, STACK_ON); } else { - LynxChangeStyle(s, ABS_ON, 0); + LynxChangeStyle(s, ABS_ON); } #endif /* USE_COLOR_STYLE */ LYmove(h + 2, LYcols - 1); addch_raw(ACS_DARROW); #ifdef USE_COLOR_STYLE - LynxChangeStyle(s, STACK_OFF, 0); + LynxChangeStyle(s, STACK_OFF); #endif /* USE_COLOR_STYLE */ } return; @@ -2385,7 +2370,7 @@ PRIVATE void split_line ARGS2( HTLine * line = (HTLine *)LY_CALLOC(1, LINE_SIZE(MAX_LINE)+2); if (line == NULL) outofmem(__FILE__, "split_line_1"); -#if defined(USE_COLOR_STYLE) && !defined(OLD_HTSTYLECHANGE) +#if defined(USE_COLOR_STYLE) line->styles = stylechanges_buffers[stylechanges_buffers_free = (stylechanges_buffers_free + 1) &1]; #endif ctrl_chars_on_this_line = 0; /*reset since we are going to a new line*/ @@ -2657,7 +2642,7 @@ PRIVATE void split_line ARGS2( /* * Color style changes after the split position + possible trimmed * head characters are transferred to the new line. Ditto for changes - * within the trimming region, but be stop when we reach an OFF change. + * within the trimming region, but we stop when we reach an OFF change. * The second while loop below may then handle remaining changes. - kw */ while (previous->numstyles && inew >= 0) { @@ -2801,7 +2786,7 @@ PRIVATE void split_line ARGS2( if (temp == NULL) outofmem(__FILE__, "split_line_2"); memcpy(temp, previous, LINE_SIZE(previous->size)); -#if defined(USE_COLOR_STYLE) && !defined(OLD_HTSTYLECHANGE) +#if defined(USE_COLOR_STYLE) ALLOC_IN_POOL((text->styles_pool),HTStyleChangePool,previous->numstyles,temp->styles); memcpy(temp->styles, previous->styles, sizeof(HTStyleChange)*previous->numstyles); if (!temp->styles) @@ -3127,7 +3112,7 @@ PRIVATE void split_line ARGS2( jline = allocHTLine(previous->size+spare); if (jline == NULL) outofmem(__FILE__, "split_line_1"); -#if defined(USE_COLOR_STYLE) && !defined(OLD_HTSTYLECHANGE) +#if defined(USE_COLOR_STYLE) jline->styles = previous->styles; #endif jdata = jline->data; @@ -3195,9 +3180,6 @@ PRIVATE void split_line ARGS2( jline->styles[i].style = previous->styles[i].style; jline->styles[i].direction = previous->styles[i].direction; -#ifdef OLD_HTSTYLECHANGE - jline->styles[i].previous = previous->styles[i].previous; -#endif /*there are stylechanges with hpos > line length */ jline->styles[i].horizpos = (hpos > previous->size) ? previous->size + spare @@ -4696,11 +4678,10 @@ PRIVATE int HText_insertBlanksInStblLines ARGS2( first_lineno_pass2 = lineno; if (TRACE) { int ip; - CTRACE((tfp, "line %d first to adjust -- newpos:", - lineno)); + CTRACE((tfp, "line %d first to adjust -- newpos:", lineno)); for (ip = 0; ip < ncols; ip++) fprintf(tfp, " %d", newpos[ip]); - fprintf(tfp, "\r\n"); + fprintf(tfp, "\n"); } } if (line == me->last_line) { @@ -4724,7 +4705,7 @@ PRIVATE int HText_insertBlanksInStblLines ARGS2( max_width = width; if (width && last_nonempty < lineno) last_nonempty = lineno; - CTRACE((tfp, "line %d true/max width:%d/%d oldpos: NONE\r\n", + CTRACE((tfp, "line %d true/max width:%d/%d oldpos: NONE\n", lineno, width, max_width)); continue; } @@ -4771,7 +4752,7 @@ PRIVATE int HText_insertBlanksInStblLines ARGS2( lineno, width, max_width)); for (ip = 0; ip < ninserts; ip++) fprintf(tfp, " %d", oldpos[ip]); - fprintf(tfp, "\r\n"); + fprintf(tfp, "\n"); } } } @@ -4866,7 +4847,7 @@ PRIVATE int HText_insertBlanksInStblLines ARGS2( if (max_width) Stbl_update_enclosing(me->stbl, max_width, last_nonempty); } - CTRACE((tfp, " %d:done\r\n", lineno)); + CTRACE((tfp, " %d:done\n", lineno)); free(oldpos); return lines_changed; } @@ -12214,11 +12195,9 @@ PRIVATE void insert_new_textarea_anchor ARGS2( #if defined(USE_COLOR_STYLE) /* dup styles[] if needed [no need in TEXTAREA (?); leave 0's] */ l->numstyles = htline->numstyles; -#ifndef OLD_HTSTYLECHANGE /*we fork the pointers!*/ l->styles = htline->styles; #endif -#endif strcpy (l->data, htline->data); if (keypad_mode == LINKS_AND_FIELDS_ARE_NUMBERED) { a->number++; @@ -13087,11 +13066,9 @@ PUBLIC int HText_InsertFile ARGS1( #if defined(USE_COLOR_STYLE) /* dup styles[] if needed [no need in TEXTAREA (?); leave 0's] */ l->numstyles = htline->numstyles; -#ifndef OLD_HTSTYLECHANGE /*we fork the pointers!*/ l->styles = htline->styles; #endif -#endif strcpy (l->data, htline->data); /* @@ -13265,7 +13242,7 @@ PRIVATE void redraw_part_of_line ARGS4( while (current_style < line->numstyles && i >= (int) (CStyle.horizpos + line->offset + 1)) { - LynxChangeStyle (CStyle.style,CStyle.direction,CStyle.previous); + LynxChangeStyle (CStyle.style,CStyle.direction); current_style++; } #endif @@ -13405,7 +13382,7 @@ PRIVATE void redraw_part_of_line ARGS4( while (current_style < line->numstyles) { - LynxChangeStyle (CStyle.style, CStyle.direction, CStyle.previous); + LynxChangeStyle (CStyle.style, CStyle.direction); current_style++; } diff --git a/src/HTAlert.c b/src/HTAlert.c index 27fab50f..cd1d5a56 100644 --- a/src/HTAlert.c +++ b/src/HTAlert.c @@ -780,12 +780,12 @@ PUBLIC BOOL HTConfirmCookie ARGS4( && isalpha(ch) && (p = strrchr(prompt, L_PAREN)) != 0) { - while (*p != R_PAREN && *p != 0 && isalpha(*s)) { + while (*p != R_PAREN && *p != 0 && isalpha(UCH(*s))) { if (*p == ch) { ch = *s; break; } else { - if (isalpha(*p) && (*p == TOUPPER(*p))) + if (isalpha(UCH(*p)) && (*p == TOUPPER(*p))) s++; p++; } diff --git a/src/HTML.c b/src/HTML.c index e14f453e..e682e451 100644 --- a/src/HTML.c +++ b/src/HTML.c @@ -153,8 +153,6 @@ PRIVATE char* MakeNewMapValue PARAMS((CONST char ** value, CONST char* mapstr)); #define SET_SKIP_STACK(el_num) if (HTML_dtd.tags[el_num].contents != SGML_EMPTY) \ { me->skip_stack++; } -extern int hash_code PARAMS((char* i)); - PUBLIC void strtolower ARGS1(char*, i) { if (!i) return; @@ -1203,11 +1201,12 @@ PRIVATE int HTML_start_element ARGS6( #if OPT_SCN && !OMIT_SCN_KEEPING /* Can be done in other cases too... */ if (!class_used && ElementNumber == HTML_INPUT) { /* For some other too? */ - char *type = "", *oend = Style_className_end; + CONST char *type = ""; + char *oend = Style_className_end; int l, ohcode = hcode; if (present && present[HTML_INPUT_TYPE] && value[HTML_INPUT_TYPE]) - type = (char *)value[HTML_INPUT_TYPE]; + type = value[HTML_INPUT_TYPE]; l = strlen(type); *Style_className_end = '.'; @@ -5801,7 +5800,7 @@ PRIVATE int HTML_start_element ARGS6( * table tracking code. Cancel tracking, it would only make * things worse. - kw */ - HText_cancelStbl(me->text); /* Not needed with new TRST */ + /* HText_cancelStbl(me->text); ** Not needed with new TRST */ if (me->inA) { SET_SKIP_STACK(HTML_A); HTML_end_element(me, HTML_A, include); diff --git a/src/LYCurses.c b/src/LYCurses.c index bb03e38a..c9f8c16b 100644 --- a/src/LYCurses.c +++ b/src/LYCurses.c @@ -69,11 +69,11 @@ PUBLIC int Current_Attr, Masked_Attr; in HTML.c when lss support is on. 1 to increase performance. The value must correspond to the value of macro OMIT_SCN_KEEPING defined in HTML.c*/ - #ifdef USE_SLANG PUBLIC unsigned int Lynx_Color_Flags = 0; PUBLIC BOOLEAN FullRefresh = FALSE; PUBLIC int curscr = 0; + #ifdef SLANG_MBCS_HACK /* * Will be set by size_change. - KW @@ -82,7 +82,6 @@ PUBLIC int PHYSICAL_SLtt_Screen_Cols = 10; #endif /* SLANG_MBCS_HACK */ - PUBLIC void LY_SLrefresh NOARGS { if (FullRefresh) { @@ -204,6 +203,71 @@ PRIVATE void sl_suspend ARGS1( #endif /* SIGSTOP */ return; } +#else + +#ifdef FANCY_CURSES +/* definitions for the mono attributes we can use */ +static struct { + char *name; + int code; +} Mono_Attrs[7] = +{ + { "normal", A_NORMAL }, + { "bold", A_BOLD }, + { "reverse", A_REVERSE }, + { "underline", A_UNDERLINE }, + { "standout", A_STANDOUT }, + { "blink", A_BLINK }, + { "dim", A_DIM }, +}; + +PUBLIC int string_to_attr ARGS1( + char *, name) +{ + unsigned i; + + for (i = 0; i < TABLESIZE(Mono_Attrs); i++) { + if (!strcasecomp(Mono_Attrs[i].name, name)) { + return Mono_Attrs[i].code; + } + } + return 0; +} + +#ifdef USE_COLOR_STYLE +PRIVATE char *attr_to_string ARGS1( + int, code) +{ + static char result[sizeof(Mono_Attrs) + 80]; + unsigned i; + int pair = PAIR_NUMBER(code); + int bold = (pair != 0 && (code & A_BOLD) != 0); + + if (bold) + code &= ~A_BOLD; + + *result = 0; + for (i = 0; i < TABLESIZE(Mono_Attrs); i++) { + if (Mono_Attrs[i].code & code) { + if (*result) + strcat(result, "+"); + strcat(result, Mono_Attrs[i].name); + } + } + if (pair != 0) { + short f, b; + if (pair_content(pair, &f, &b) != ERR) { + CONST char *fg = lookup_color(bold ? f+COLORS : f); + CONST char *bg = lookup_color(b); + if (*result) + strcat(result, "+"); + sprintf(result + strlen(result), "%s/%s", fg, bg); + } + } + return result; +} +#endif /* USE_COLOR_STYLE */ +#endif /* FANCY_CURSES */ #endif /* USE_SLANG */ /* @@ -293,17 +357,28 @@ PUBLIC HTCharStyle displayStyles[DSTYLE_ELEMENTS]; /* * set a style's attributes - RP */ -PUBLIC void setStyle ARGS4(int,style,int,color,int,cattr,int,mono) +PUBLIC void setStyle ARGS4( + int, style, + int, color, + int, cattr, + int, mono) { displayStyles[style].color = color; displayStyles[style].cattr = cattr; displayStyles[style].mono = mono; } -PUBLIC void setHashStyle ARGS5(int,style,int,color,int,cattr,int,mono,char*,element) +PUBLIC void setHashStyle ARGS5( + int, style, + int, color, + int, cattr, + int, mono, + char *, element) { bucket* ds = &hashStyles[style]; + CTRACE((tfp, "CSS(SET): <%s> hash=%d, ca=%#x, ma=%#x\n", element, style, color, mono)); + ds->color = color; ds->cattr = cattr; ds->mono = mono; @@ -315,24 +390,29 @@ PUBLIC void setHashStyle ARGS5(int,style,int,color,int,cattr,int,mono,char*,elem /* * set the curses attributes to be color or mono - RP */ -PRIVATE int LYAttrset ARGS3(WINDOW*,win,int,color,int,mono) -{ - CTRACE((tfp, "CSS:LYAttrset (%#x, %#x)\n", color, mono)); - if (lynx_has_color && LYShowColor >= SHOW_COLOR_ON && color > -1) - { - wattrset(win,color); - return color; - } - if (mono > -1) - { - wattrset(win,mono); - return mono; - } - wattrset(win,A_NORMAL); +PRIVATE int LYAttrset ARGS3( + WINDOW *, win, + int, color, + int, mono) +{ + if (lynx_has_color + && LYShowColor >= SHOW_COLOR_ON + && color >= 0) { + CTRACE((tfp, "CSS:LYAttrset color (%s)\n", attr_to_string(color))); + wattrset(win, color); + return color; + } else if (mono >= 0) { + CTRACE((tfp, "CSS:LYAttrset mono (%s)\n", attr_to_string(mono))); + wattrset(win, mono); + return mono; + } else { + CTRACE((tfp, "CSS:LYAttrset (A_NORMAL)\n")); + wattrset(win, A_NORMAL); return A_NORMAL; + } } -PUBLIC void curses_w_style ARGS3( +PRIVATE void curses_w_style ARGS3( WINDOW*, win, int, style, int, dir) @@ -365,7 +445,7 @@ PUBLIC void curses_w_style ARGS3( if (style == s_normal && dir) { wattrset(win,A_NORMAL); - if (win==LYwin) cached_styles[YP][XP]=s_normal; + if (win == LYwin) cached_styles[YP][XP] = s_normal; return; } @@ -442,7 +522,9 @@ PUBLIC void wcurses_css ARGS3( } } -PUBLIC void curses_css ARGS2(char *,name,int,dir) +PUBLIC void curses_css ARGS2( + char *, name, + int, dir) { wcurses_css(LYwin, name, dir); } @@ -453,13 +535,6 @@ PUBLIC void curses_style ARGS2( { curses_w_style(LYwin, style, dir); } - -#ifdef NOT_USED -void attribute ARGS2(int,style,int,dir) -{ - curses_style(style, dir, 0); -} -#endif #endif /* USE_COLOR_STYLE */ PRIVATE BOOL lynx_called_initscr = FALSE; @@ -1444,6 +1519,13 @@ PUBLIC void LYwaddnstr ARGS3( CONST char *, s, size_t, len) { +#ifdef USE_COLOR_STYLE + if (TRACE) { + int y, x; + LYGetYX(y, x); + CTRACE((tfp, "[%2d,%2d] LYwaddnstr(%.*s)\n", y, x, (int) len, s)); + } +#endif while (len > 0) { char temp[MAX_LINE]; size_t use = (len >= MAX_LINE) ? MAX_LINE - 1 : len; @@ -2082,7 +2164,7 @@ PUBLIC void lynx_stop_link_color ARGS2( int, pending GCC_UNUSED) { #ifdef USE_COLOR_STYLE - LynxChangeStyle(flag == ON ? s_alink : s_a, ABS_OFF, 0); + LynxChangeStyle(flag == ON ? s_alink : s_a, ABS_OFF); #else if (flag) { stop_reverse(); diff --git a/src/LYCurses.h b/src/LYCurses.h index 7dc13067..c872758e 100644 --- a/src/LYCurses.h +++ b/src/LYCurses.h @@ -304,14 +304,10 @@ extern void VMSsignal PARAMS((int sig, void (*func)())); #if defined(USE_COLOR_STYLE) extern void curses_css PARAMS((char * name, int dir)); extern void curses_style PARAMS((int style, int dir)); -extern void curses_w_style PARAMS((WINDOW* win, int style, int dir)); extern void setHashStyle PARAMS((int style, int color, int cattr, int mono, char* element)); extern void setStyle PARAMS((int style, int color, int cattr, int mono)); extern void wcurses_css PARAMS((WINDOW * win, char* name, int dir)); -#define LynxChangeStyle(style,dir,previous) curses_style(style,dir) -#else -extern int slang_style PARAMS((int style, int dir, int previous)); -#define LynxChangeStyle(style,dir,previous) slang_style(style,dir,previous) +#define LynxChangeStyle(style,dir) curses_style(style,dir) #endif /* USE_COLOR_STYLE */ #if USE_COLOR_TABLE @@ -431,6 +427,8 @@ extern void VTHome NOPARAMS; #else /* Not VMS: */ +extern int string_to_attr PARAMS((char *name)); + /* * For Unix FANCY_FANCY curses we interpose * our own functions to add or subtract the diff --git a/src/LYEditmap.c b/src/LYEditmap.c index 881ffbc6..44ae1cbb 100644 --- a/src/LYEditmap.c +++ b/src/LYEditmap.c @@ -32,7 +32,7 @@ PUBLIC int escape_bound = 0; /* User wanted Escape to perform actions? */ /* * See LYStrings.h for the LYE definitions. */ -PRIVATE char DefaultEditBinding[KEYMAP_SIZE-1]={ +PRIVATE LYEditCode DefaultEditBinding[KEYMAP_SIZE-1]={ LYE_NOP, LYE_BOL, LYE_DELPW, LYE_ABORT, /* nul ^A ^B ^C */ @@ -278,7 +278,7 @@ LYE_NOP, LYE_NOP, LYE_NOP, LYE_NOP, /* Why the difference for tab? - kw */ #ifdef EXP_ALT_BINDINGS -PRIVATE char BetterEditBinding[KEYMAP_SIZE-1]={ +PRIVATE LYEditCode BetterEditBinding[KEYMAP_SIZE-1]={ LYE_NOP, LYE_BOL, LYE_BACK, LYE_ABORT, /* nul ^A ^B ^C */ @@ -536,7 +536,7 @@ LYE_NOP, LYE_NOP, LYE_NOP, LYE_NOP, /* M-bs,M-del=delete-prev-word, M-d=delete-next-word, */ /* M-b=BACKW, M-f=FORWW, */ -PRIVATE char BashlikeEditBinding[KEYMAP_SIZE-1]={ +PRIVATE LYEditCode BashlikeEditBinding[KEYMAP_SIZE-1]={ LYE_SETMARK, LYE_BOL, LYE_BACK, LYE_ABORT, /* nul ^A ^B ^C */ @@ -928,7 +928,7 @@ PRIVATE short *Mod3Binding = Mod1Binding; * Add the array name to LYLineEditors */ -PUBLIC char * LYLineEditors[]={ +PUBLIC LYEditCode * LYLineEditors[]={ DefaultEditBinding, /* You can't please everyone, so you ... DW */ #ifdef EXP_ALT_BINDINGS BetterEditBinding, /* No, you certainly can't ... /ked 10/27/98*/ @@ -1062,7 +1062,7 @@ PUBLIC BOOL LYRemapEditBinding ARGS3( return FALSE; /* cannot do, doesn't fit in a char - kw */ if (select_edi > 0) { if ((unsigned int)select_edi < TABLESIZE(LYLineEditors)) { - LYLineEditors[select_edi - 1][c] = (char) lec; + LYLineEditors[select_edi - 1][c] = (LYEditCode) lec; success = TRUE; } } else { @@ -1070,7 +1070,7 @@ PUBLIC BOOL LYRemapEditBinding ARGS3( success = TRUE; if (select_edi < 0 && j + 1 + select_edi == 0) continue; - LYLineEditors[j][c] = (char) lec; + LYLineEditors[j][c] = (LYEditCode) lec; } } } @@ -1128,6 +1128,7 @@ PUBLIC int LYEditKeyForAction ARGS2( { int editaction, i, c; int mod1found = -1, mod2found = -1, mod3found = -1; + if (pmodkey) *pmodkey = -1; for (i = FIRST_I; i >= 0; i = NEXT_I(i,KEYMAP_SIZE-2)) { diff --git a/src/LYForms.c b/src/LYForms.c index b47b1146..9fd54d06 100644 --- a/src/LYForms.c +++ b/src/LYForms.c @@ -33,7 +33,7 @@ PRIVATE int form_getstr PARAMS(( /* * Returns an array of pointers to the given list - */ + */ PRIVATE char ** options_list ARGS1( OptionType *, opt_ptr) { @@ -110,7 +110,7 @@ PUBLIC int change_form_link_ex ARGS8( if (form->disabled == YES) { int dummy; - dummy = LYhandlePopupList(form->num_value, + dummy = LYhandlePopupList(form->num_value, form_link->ly, form_link->lx, (CONST char **)my_data, @@ -128,7 +128,7 @@ PUBLIC int change_form_link_ex ARGS8( break; } OrigNumValue = form->num_value; - form->num_value = LYhandlePopupList(form->num_value, + form->num_value = LYhandlePopupList(form->num_value, form_link->ly, form_link->lx, (CONST char **)my_data, @@ -661,7 +661,18 @@ again: if (action == LYE_ABORT) { return(DO_NOTHING); } - if (LKC_TO_LAC(keymap,ch) == LYK_REFRESH) + if (action == LYE_STOP) { +#ifdef TEXTFIELDS_MAY_NEED_ACTIVATION + textfields_need_activation = TRUE; + break; +#else +#ifdef ENHANCED_LINEEDIT + if (MyEdit.mark >= 0) + MyEdit.mark = -1 - MyEdit.strlen; /* Disable. */ +#endif +#endif + } + if (action == LYE_NOP && LKC_TO_LAC(keymap,ch) == LYK_REFRESH) break; #ifdef SH_EX /* ASATAKU emacskey hack 1997/08/26 (Tue) 09:19:23 */ diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h index e282eb87..0900f6d3 100644 --- a/src/LYGlobalDefs.h +++ b/src/LYGlobalDefs.h @@ -448,6 +448,7 @@ extern int connect_timeout; #ifdef TEXTFIELDS_MAY_NEED_ACTIVATION extern BOOL textfields_need_activation; +extern BOOL global_textfields_need_activation; #ifdef INACTIVE_INPUT_STYLE_VH extern BOOL textinput_redrawn; #endif diff --git a/src/LYHash.c b/src/LYHash.c index 5ca59b80..13d2e6a1 100644 --- a/src/LYHash.c +++ b/src/LYHash.c @@ -13,24 +13,24 @@ #define HASH_SIZE CSHASHSIZE #define HASH_OF(h, v) ((int)((h) * 3 + UCH(v)) % HASH_SIZE) -PUBLIC int hash_code ARGS1 (char*, string) +PUBLIC int hash_code ARGS1 (CONST char*, string) { int hash; - unsigned char *p; + CONST char *p; - for (p = (unsigned char *)string, hash = 0; *p; p++) + for (p = string, hash = 0; *p; p++) hash = HASH_OF(hash,*p); return hash; } -PUBLIC int hash_code_lowercase_on_fly ARGS1 (char*, string) +PUBLIC int hash_code_lowercase_on_fly ARGS1 (CONST char*, string) { int hash; - unsigned char *p; + CONST char *p; - for (p = (unsigned char *)string, hash = 0; *p; p++) - hash = HASH_OF(hash,tolower(*(char *)p)); + for (p = string, hash = 0; *p; p++) + hash = HASH_OF(hash,tolower(*p)); return hash; } @@ -40,13 +40,13 @@ PUBLIC int hash_code_aggregate_char ARGS2 (char, c,int,hash) return HASH_OF(hash,c); } -PUBLIC int hash_code_aggregate_lower_str ARGS2 (char*, string,int,hash_was) +PUBLIC int hash_code_aggregate_lower_str ARGS2 (CONST char*, string,int,hash_was) { int hash; - unsigned char *p; + CONST char *p; - for (p = (unsigned char *)string, hash = hash_was ; *p; p++) - hash = HASH_OF(hash,tolower(*(char *)p)); + for (p = string, hash = hash_was ; *p; p++) + hash = HASH_OF(hash,tolower(*p)); return hash; } diff --git a/src/LYHash.h b/src/LYHash.h index 5e019da3..b6453fc8 100644 --- a/src/LYHash.h +++ b/src/LYHash.h @@ -23,15 +23,15 @@ typedef struct _hashbucket bucket; #define NOSTYLE -1 extern bucket hashStyles[CSHASHSIZE]; -extern int hash_code PARAMS((char* string)); +extern int hash_code PARAMS((CONST char* string)); extern bucket special_bucket;/*it's used when OMIT_SCN_KEEPING is 1 in HTML.c and LYCurses.c. */ extern bucket nostyle_bucket;/*initialized properly - to be used in CTRACE when NOSTYLE is passed as 'style' to curses_w_style */ -extern int hash_code_lowercase_on_fly PARAMS((char* string)); +extern int hash_code_lowercase_on_fly PARAMS((CONST char* string)); extern int hash_code_aggregate_char PARAMS((char c,int hash)); -extern int hash_code_aggregate_lower_str PARAMS((char* c,int hash_was)); +extern int hash_code_aggregate_lower_str PARAMS((CONST char* c, int hash_was)); extern int s_a; extern int s_aedit; diff --git a/src/LYKeymap.c b/src/LYKeymap.c index e365e6d7..0508710c 100644 --- a/src/LYKeymap.c +++ b/src/LYKeymap.c @@ -1003,6 +1003,7 @@ PRIVATE struct emap ekmap[] = { {"CHAR", LYE_CHAR, "Insert printable char"}, {"ENTER", LYE_ENTER, "Input complete, return char/lynxkeycode"}, {"TAB", LYE_TAB, "Input complete, return TAB"}, + {"STOP", LYE_STOP, "Input deactivated"}, {"ABORT", LYE_ABORT, "Input cancelled"}, {"PASS", LYE_FORM_PASS, "In fields: input complete, or Do Nothing"}, diff --git a/src/LYMain.c b/src/LYMain.c index 6d09793e..2a7abe38 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -473,6 +473,7 @@ PUBLIC BOOL force_empty_hrefless_a = FALSE; #ifdef TEXTFIELDS_MAY_NEED_ACTIVATION PUBLIC BOOL textfields_need_activation = FALSE; +PUBLIC BOOL global_textfields_need_activation = FALSE; #endif PUBLIC BOOLEAN textfield_prompt_at_left_edge = FALSE; @@ -1109,6 +1110,7 @@ PUBLIC int main ARGS2( FREE(temp); } } + #ifdef VMS LYLowerCase(lynx_temp_space); if (strchr(lynx_temp_space, '/') != NULL) { @@ -1128,8 +1130,12 @@ PUBLIC int main ARGS2( #else LYAddPathSep(&lynx_temp_space); #endif /* VMS */ + if ((HTStat(lynx_temp_space, &dir_info) < 0 - && mkdir(lynx_temp_space, 0700) < 0) +#ifdef UNIX + && mkdir(lynx_temp_space, 0700) < 0 +#endif + ) || !S_ISDIR(dir_info.st_mode)) { fprintf(stderr, "%s: %s\n", lynx_temp_space, @@ -3612,7 +3618,7 @@ treated '>' as a co-terminator for double-quotes and tags" ), #ifdef TEXTFIELDS_MAY_NEED_ACTIVATION PARSE_SET( - "tna", 4|SET_ARG, &textfields_need_activation, + "tna", 4|SET_ARG, &global_textfields_need_activation, "turn on \"Textfields Need Activation\" mode" ), #endif @@ -3811,7 +3817,7 @@ PRIVATE int arg_eqs_parse ARGS3( break; case '-': #if OPTNAME_ALLOW_DASHES - if (isalpha(b[1])) { + if (isalpha(UCH(b[1]))) { result = 0; break; } diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c index 07a03944..6ed06b29 100644 --- a/src/LYMainLoop.c +++ b/src/LYMainLoop.c @@ -644,7 +644,7 @@ PRIVATE BOOL do_check_recall ARGS7( LYAddHtmlSep0(user_input_buffer); } else if (len == 2 && user_input_buffer[1] == ':') { - if (isalpha(user_input_buffer[0])) { + if (isalpha(UCH(user_input_buffer[0]))) { LYAddHtmlSep0(user_input_buffer); } else { HTUserMsg2(WWW_ILLEGAL_URL_MESSAGE, user_input_buffer); @@ -958,8 +958,9 @@ PRIVATE int handle_LYK_ACTIVATE ARGS6( F_TEXTLIKE(links[curdoc.link].form->type)) { textinput_activated = TRUE; - if (textfields_need_activation) - show_main_statusline(links[curdoc.link], FOR_INPUT); + show_main_statusline(links[curdoc.link], FOR_INPUT); + textfields_need_activation = global_textfields_need_activation; + return 0; } #endif @@ -5453,6 +5454,9 @@ try_again: #ifdef USE_PRETTYSRC psrc_first_tag = TRUE; #endif +#ifdef TEXTFIELDS_MAY_NEED_ACTIVATION + textfields_need_activation = global_textfields_need_activation; +#endif FREE(LYRequestReferer); /* * Don't send Referer if we have to load a document again @@ -6626,6 +6630,7 @@ try_again: #ifdef TEXTFIELDS_MAY_NEED_ACTIVATION if (textfields_need_activation) { textinput_activated = TRUE; + textfields_need_activation = global_textfields_need_activation; #ifdef INACTIVE_INPUT_STYLE_VH textinput_redrawn = TRUE; #endif diff --git a/src/LYNews.c b/src/LYNews.c index 50900b80..c9b13506 100644 --- a/src/LYNews.c +++ b/src/LYNews.c @@ -240,11 +240,11 @@ PUBLIC char *LYNewsPost ARGS2( CJKinput[0] = '\0'; switch(kanji_code) { case EUC: - TO_EUC(kp, CJKinput); + TO_EUC((CONST unsigned char *)kp, CJKinput); kp = CJKinput; break; case SJIS: - TO_SJIS(kp, CJKinput); + TO_SJIS((CONST unsigned char *)kp, CJKinput); kp = CJKinput; break; default: diff --git a/src/LYOptions.c b/src/LYOptions.c index 62412036..bf157c3c 100644 --- a/src/LYOptions.c +++ b/src/LYOptions.c @@ -3127,7 +3127,7 @@ PRIVATE char *NewSecureValue NOARGS FREE(secure_value); if ((secure_value = malloc(80)) != 0) { #if defined(RAND_MAX) - long key = my_rand(); + long key = lynx_rand(); #else long key = (long)secure_value + (long)time(0); #endif diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index 5f4668b9..814da7e4 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -400,6 +400,17 @@ PUBLIC int check_color ARGS2( CTRACE((tfp, "=> ERR_COLOR\n")); return ERR_COLOR; } + +PUBLIC CONST char *lookup_color ARGS1( + int, code) +{ + unsigned n; + for (n = 0; n < 16; n++) { + if ((int) ColorCode(n) == code) + return Color_Strings[n]; + } + return "default"; +} #endif /* USE_COLOR_STYLE || USE_COLOR_TABLE */ #if defined(USE_COLOR_TABLE) @@ -1614,7 +1625,7 @@ static Config_Type Config_Table [] = PARSE_STR("system_mail_flags", CONF_STR, &system_mail_flags), PARSE_SET("tagsoup", CONF_BOOL, &Old_DTD), #ifdef TEXTFIELDS_MAY_NEED_ACTIVATION - PARSE_SET("textfields_need_activation", CONF_BOOL, &textfields_need_activation), + PARSE_SET("textfields_need_activation", CONF_BOOL, &global_textfields_need_activation), #endif #if defined(_WINDOWS) PARSE_INT("timeout", CONF_INT, &lynx_timeout), diff --git a/src/LYReadCFG.h b/src/LYReadCFG.h index 07733e1b..2fc893ad 100644 --- a/src/LYReadCFG.h +++ b/src/LYReadCFG.h @@ -46,6 +46,7 @@ extern int lynx_default_colors NOPARAMS; #endif extern int check_color PARAMS((char * color, int the_default)); +extern CONST char * lookup_color PARAMS((int code)); #endif extern void read_cfg PARAMS((char *cfg_filename, char *parent_filename, int nesting_level, FILE *fp0)); diff --git a/src/LYStrings.c b/src/LYStrings.c index c8f46d23..93de4326 100644 --- a/src/LYStrings.c +++ b/src/LYStrings.c @@ -170,13 +170,14 @@ PUBLIC int fancy_mouse ARGS3( getmouse(&event); if ((event.bstate & (BUTTON1_CLICKED - | BUTTON1_DOUBLE_CLICKED - | BUTTON1_TRIPLE_CLICKED)) - && (event.x >= getbegx(win) - && (event.x < (getbegx(win) + getmaxx(win))))) { + | BUTTON1_DOUBLE_CLICKED + | BUTTON1_TRIPLE_CLICKED))) { int mypos = event.y - getbegy(win); int delta = mypos - row; + if ((event.x < getbegx(win) || event.x >= (getbegx(win) + getmaxx(win))) + && !(event.bstate & (BUTTON_ALT | BUTTON_SHIFT | BUTTON_CTRL))) + return LYK_QUIT; /* User clicked outside, wants to quit? */ if (mypos+1 == getmaxy(win)) { /* At the decorative border: scroll forward */ if (event.bstate & BUTTON1_TRIPLE_CLICKED) @@ -4721,6 +4722,22 @@ again: CTRACE((tfp, "LYgetstr LYE_ABORT\n")); return(-1); + case LYE_STOP: + /* + * Deactivate. + */ + CTRACE((tfp, "LYgetstr LYE_STOP\n")); +#ifdef TEXTFIELDS_MAY_NEED_ACTIVATION + textfields_need_activation = TRUE; + return(-1); +#else +#ifdef ENHANCED_LINEEDIT + if (Mark >= 0) + Mark = -1 - Mark; /* Disable it */ +#endif +#endif + break; + case LYE_LKCMD: /* * Used only in form_getstr() for invoking diff --git a/src/LYStrings.h b/src/LYStrings.h index eefff4e0..77d813e1 100644 --- a/src/LYStrings.h +++ b/src/LYStrings.h @@ -211,7 +211,8 @@ typedef struct _EditFieldData { #define LYE_CHAR (LYE_NOP +1) /* Insert printable char */ #define LYE_ENTER (LYE_CHAR +1) /* Input complete, return char/lynxkeycode */ #define LYE_TAB (LYE_ENTER +1) /* Input complete, return TAB */ -#define LYE_ABORT (LYE_TAB +1) /* Input cancelled */ +#define LYE_STOP (LYE_TAB +1) /* Input complete, deactivate */ +#define LYE_ABORT (LYE_STOP +1) /* Input cancelled */ #define LYE_FORM_PASS (LYE_ABORT +1) /* In form fields: input complete, return char / lynxkeycode; @@ -327,9 +328,11 @@ extern int LYhandlePopupList PARAMS(( BOOLEAN for_mouse, BOOLEAN numbered)); +typedef unsigned char LYEditCode; + extern int current_lineedit; extern char * LYLineeditNames[]; -extern char * LYLineEditors[]; +extern LYEditCode * LYLineEditors[]; extern CONST char * LYLineeditHelpURLs[]; extern CONST char * LYLineeditHelpURL NOPARAMS; diff --git a/src/LYStyle.c b/src/LYStyle.c index 09226d1a..60c8e195 100644 --- a/src/LYStyle.c +++ b/src/LYStyle.c @@ -1,6 +1,6 @@ /* character level styles for Lynx * (c) 1996 Rob Partington -- donated to the Lyncei (if they want it :-) - * @Id: LYStyle.c 1.41 Thu, 08 Feb 2001 18:50:00 -0800 dickey @ + * @Id: LYStyle.c 1.42 Mon, 12 Feb 2001 17:33:21 -0800 dickey @ */ #include <HTUtils.h> #include <HTML.h> @@ -49,20 +49,6 @@ PUBLIC BOOL force_current_tag_style = FALSE; PUBLIC char* forced_classname; PUBLIC BOOL force_classname; -/* definitions for the mono attributes we can use */ -static int ncursesMono[7] = { - A_NORMAL, A_BOLD, A_REVERSE, A_UNDERLINE, A_STANDOUT, A_BLINK, A_DIM -}; - -/* - * If these strings don't match the meanings of the above attributes, - * you'll confuse the hell out of people, so make them the same. - RP - */ -static char *Mono_Strings[7] = -{ - "normal", "bold", "reverse", "underline", "standout", "blink", "dim" -}; - /* Remember the hash codes for common elements */ PUBLIC int s_a = NOSTYLE; PUBLIC int s_aedit = NOSTYLE; @@ -96,7 +82,6 @@ PRIVATE unsigned char our_pairs[2][MAX_COLOR][MAX_COLOR]; /* icky parsing of the style options */ PRIVATE void parse_attributes ARGS5(char*,mono,char*,fg,char*,bg,int,style,char*,element) { - int i; int mA = 0; short fA = default_fg; short bA = default_bg; @@ -105,13 +90,7 @@ PRIVATE void parse_attributes ARGS5(char*,mono,char*,fg,char*,bg,int,style,char* CTRACE((tfp, "CSS(PA):style d=%d / h=%d, e=%s\n", style, newstyle,element)); - for (i = 0; i < (int)TABLESIZE(Mono_Strings); i++) - { - if (!strcasecomp(Mono_Strings[i], mono)) - { - mA = ncursesMono[i]; - } - } + mA = string_to_attr(mono); if (!mA) { /* * Not found directly yet, see whether we have a combination @@ -122,13 +101,7 @@ PRIVATE void parse_attributes ARGS5(char*,mono,char*,fg,char*,bg,int,style,char* char *cp = strchr(mono, csep); while (cp) { *cp = '\0'; - for (i = 0; i < (int)TABLESIZE(Mono_Strings); i++) - { - if (!strcasecomp(Mono_Strings[i], cp0)) - { - mA |= ncursesMono[i]; - } - } + mA |= string_to_attr(cp0); if (!csep) break; *cp = csep; @@ -187,7 +160,7 @@ PRIVATE void parse_attributes ARGS5(char*,mono,char*,fg,char*,bg,int,style,char* && curPair < 255) our_pairs[cA == A_BOLD][fA][bA] = curPair + 1; } - CTRACE((tfp, "CSS(CURPAIR):%d\n", colorPairs)); + CTRACE((tfp, "CSS(CURPAIR):%d\n", curPair)); if (style < DSTYLE_ELEMENTS) setStyle(style, COLOR_PAIR(curPair)|cA, cA, mA); setHashStyle(newstyle, COLOR_PAIR(curPair)|cA, cA, mA, element); diff --git a/src/LYUtils.c b/src/LYUtils.c index cf1e2845..61a746bf 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -119,7 +119,7 @@ extern int BSDselect PARAMS((int nfds, fd_set * readfds, fd_set * writefds, * it no longer applies, since it will reuse that filename at a later time. */ #ifdef EXP_RAND_TEMPNAME -#if defined(RAND_MAX) +#if defined(LYNX_RAND_MAX) #define USE_RAND_TEMPNAME 1 #define MAX_TEMPNAME 10000 #ifndef BITS_PER_CHAR @@ -296,7 +296,7 @@ PUBLIC void highlight ARGS3( CTRACE((tfp, "STYLE.highlight.on: @(%d,%d).\n", LYP, LXP)); } LYmove(LYP, LXP); - LynxChangeStyle(s, STACK_ON, 0); + LynxChangeStyle(s, STACK_ON); #endif } @@ -355,7 +355,7 @@ PUBLIC void highlight ARGS3( CTRACE((tfp, "STYLE.highlight.line2: @(%d,%d), style=%d.\n", links[cur].ly + 1, links[cur].hightext2_offset, flag == ON ? s_alink : s_a)); - LynxChangeStyle(flag == ON ? s_alink : s_a, ABS_ON, 0); + LynxChangeStyle(flag == ON ? s_alink : s_a, ABS_ON); #endif for (i = 0; (tmp[0] = links[cur].hightext2[i]) != '\0' && @@ -2114,7 +2114,7 @@ PUBLIC void statusline ARGS1( { int a=(strncmp(buffer, ALERT_FORMAT, ALERT_PREFIX_LEN) || !hashStyles[s_alert].name) ? s_status : s_alert; - LynxChangeStyle (a, STACK_ON, 1); + LynxChangeStyle (a, STACK_ON); LYaddstr(buffer); wbkgdset(LYwin, ((lynx_has_color && LYShowColor >= SHOW_COLOR_ON) @@ -2127,7 +2127,7 @@ PUBLIC void statusline ARGS1( wbkgdset(LYwin, hashStyles[s_normal].color | ' '); else wbkgdset(LYwin, displayStyles[DSTYLE_NORMAL].color | ' '); - LynxChangeStyle (a, STACK_OFF, 0); + LynxChangeStyle (a, STACK_OFF); } #endif } @@ -2511,7 +2511,7 @@ PUBLIC BOOLEAN LYisAbsPath ARGS1( BOOLEAN result; #if defined(DOSPATH) || defined(__EMX__) result = (BOOL) (LYIsPathSep(path[0]) - || (isalpha(path[0]) + || (isalpha(UCH(path[0])) && (path[1] == ':') && LYIsPathSep(path[2]))); #else @@ -2529,7 +2529,7 @@ PUBLIC BOOLEAN LYisRootPath ARGS1( { #if defined(DOSPATH) || defined(__EMX__) if (strlen(path) == 3 - && isalpha(path[0]) + && isalpha(UCH(path[0])) && path[1] == ':' && LYIsPathSep(path[2])) return TRUE; @@ -3892,11 +3892,11 @@ PRIVATE int fmt_tempname ARGS3( * Prefer a random value rather than a counter. */ #ifdef USE_RAND_TEMPNAME +#define SIZE_TEMPNAME ((MAX_TEMPNAME / BITS_PER_CHAR) + 1) if (first) { - my_srand((unsigned)((long)time((time_t *)0) + (long)result)); + lynx_srand((unsigned)((long)time((time_t *)0) + (long)result)); first = FALSE; - used_tempname = typecallocn(unsigned char, - (MAX_TEMPNAME / BITS_PER_CHAR) + 1); + used_tempname = typecallocn(unsigned char, SIZE_TEMPNAME); if (used_tempname == 0) outofmem(__FILE__, "fmt_tempname"); } @@ -3908,7 +3908,8 @@ PRIVATE int fmt_tempname ARGS3( */ counter = MAX_TEMPNAME; while (names_used < MAX_TEMPNAME) { - counter = ( (float)MAX_TEMPNAME * my_rand() ) / RAND_MAX + 1; + counter = ( (float)MAX_TEMPNAME * lynx_rand() ) / LYNX_RAND_MAX + 1; + counter %= SIZE_TEMPNAME; /* just in case... */ /* * Avoid reusing a temporary name, since there are places in the code * which can refer to a temporary filename even after it has been @@ -4748,7 +4749,7 @@ have_VMS_URL: p = (char *)Home_Dir(); q = temp2 ? temp2 : temp; - if (strlen(q) == 3 && isalpha(q[0]) && q[1] == ':') { + if (strlen(q) == 3 && isalpha(UCH(q[0])) && q[1] == ':') { sprintf(buff, "'%s' not exist, Goto LynxHome '%s'.", q, p); _statusline(buff); diff --git a/src/LYexit.c b/src/LYexit.c index 9eafb3da..fbc13160 100644 --- a/src/LYexit.c +++ b/src/LYexit.c @@ -116,11 +116,11 @@ PUBLIC void LYexit ARGS1( (void) signal(SIGSEGV, SIG_IGN); (void) signal(SIGILL, SIG_IGN); - /* - * Flush all messages. - FM - */ - fflush(stderr); - fflush(stdout); + /* + * Flush all messages. - FM + */ + fflush(stderr); + fflush(stdout); /* * Deal with curses, if on, and clean up. - FM diff --git a/src/makefile.in b/src/makefile.in index bfdaf1cb..f76c6bef 100644 --- a/src/makefile.in +++ b/src/makefile.in @@ -105,7 +105,7 @@ lint: $(LINT) $(LINTOPTS) $(CPP_OPTS) *.c > $(top_builddir)/lint.lynx clean: - rm -f lynx$x core *.core *.leaks *.[oi] *.bak + rm -f lynx$x core *.core *.leaks *.[oi] *.bak tags TAGS cd chrtrans && $(MAKE) clean distclean: clean |