diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/GridText.c | 14 | ||||
-rw-r--r-- | src/GridText.h | 6 | ||||
-rw-r--r-- | src/HTAlert.c | 16 | ||||
-rw-r--r-- | src/HTFWriter.c | 14 | ||||
-rw-r--r-- | src/HTFont.h | 4 | ||||
-rw-r--r-- | src/HTForms.h | 32 | ||||
-rw-r--r-- | src/HTML.c | 30 | ||||
-rw-r--r-- | src/LYCgi.c | 26 | ||||
-rw-r--r-- | src/LYCharSets.c | 2 | ||||
-rw-r--r-- | src/LYCharSets.h | 2 | ||||
-rw-r--r-- | src/LYCharUtils.c | 14 | ||||
-rw-r--r-- | src/LYCookie.c | 8 | ||||
-rw-r--r-- | src/LYCurses.c | 24 | ||||
-rw-r--r-- | src/LYGetFile.c | 2 | ||||
-rw-r--r-- | src/LYKeymap.c | 4 | ||||
-rw-r--r-- | src/LYList.c | 2 | ||||
-rw-r--r-- | src/LYLocal.c | 20 | ||||
-rw-r--r-- | src/LYMail.c | 2 | ||||
-rw-r--r-- | src/LYMail.h | 6 | ||||
-rw-r--r-- | src/LYMainLoop.c | 30 | ||||
-rw-r--r-- | src/LYOptions.c | 6 | ||||
-rw-r--r-- | src/LYPrint.c | 39 | ||||
-rw-r--r-- | src/LYStrings.c | 4 | ||||
-rw-r--r-- | src/LYStrings.h | 6 | ||||
-rw-r--r-- | src/LYStyle.c | 4 | ||||
-rw-r--r-- | src/LYStyle.h | 2 | ||||
-rw-r--r-- | src/LYUtils.c | 4 | ||||
-rw-r--r-- | src/UCAux.c | 4 | ||||
-rw-r--r-- | src/UCdomap.c | 46 | ||||
-rw-r--r-- | src/UCdomap.h | 8 | ||||
-rw-r--r-- | src/chrtrans/def7_uni.tbl | 6 |
31 files changed, 218 insertions, 169 deletions
diff --git a/src/GridText.c b/src/GridText.c index 301d2a18..77d23ac1 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -5018,8 +5018,8 @@ PUBLIC void www_user_search ARGS3( } PUBLIC void user_message ARGS2( - char *, message, - char *, argument) + CONST char *, message, + CONST char *, argument) { char *temp = NULL; char temp_arg[256]; @@ -5962,7 +5962,7 @@ PUBLIC int HText_beginInput ARGS3( TextAnchor * a = (TextAnchor *) calloc(1, sizeof(*a)); FormInfo * f = (FormInfo *) calloc(1, sizeof(*f)); - char *cp_option = NULL; + CONST char *cp_option = NULL; char *IValue = NULL; unsigned char *tmp = NULL; int i, j; @@ -6633,7 +6633,7 @@ PUBLIC void HText_SubmitForm ARGS4( StrAllocCat(escaped1, MultipartContentType); StrAllocCat(escaped1, "\r\n\r\n"); } else { - escaped1 = HTEscape(form_ptr->name,URL_XALPHAS); + escaped1 = HTEscapeSP(form_ptr->name,URL_XALPHAS); } /* @@ -6772,7 +6772,7 @@ PUBLIC void HText_SubmitForm ARGS4( StrAllocCat(escaped1, MultipartContentType); StrAllocCat(escaped1, "\r\n\r\n"); } else { - escaped1 = HTEscape(form_ptr->name, URL_XALPHAS); + escaped1 = HTEscapeSP(form_ptr->name, URL_XALPHAS); } /* * Be sure to use the submit option value. @@ -6900,7 +6900,7 @@ PUBLIC void HText_SubmitForm ARGS4( StrAllocCat(escaped1, MultipartContentType); StrAllocCat(escaped1, "\r\n\r\n"); } else { - escaped1 = HTEscape(form_ptr->name, URL_XALPHAS); + escaped1 = HTEscapeSP(form_ptr->name, URL_XALPHAS); } sprintf(&query[strlen(query)], "%s%s%s%s%s", @@ -6982,7 +6982,7 @@ PUBLIC void HText_SubmitForm ARGS4( StrAllocCat(escaped1, MultipartContentType); StrAllocCat(escaped1, "\r\n\r\n"); } else { - escaped1 = HTEscape(form_ptr->name, URL_XALPHAS); + escaped1 = HTEscapeSP(form_ptr->name, URL_XALPHAS); } /* diff --git a/src/GridText.h b/src/GridText.h index fbd8455d..0e6080e6 100644 --- a/src/GridText.h +++ b/src/GridText.h @@ -14,7 +14,9 @@ #define LY_UNDERLINE_END_CHAR '\004' #define LY_BOLD_START_CHAR '\005' #define LY_BOLD_END_CHAR '\006' -#define LY_SOFT_HYPHEN '\007' +#ifndef LY_SOFT_HYPHEN +#define LY_SOFT_HYPHEN ((char)7) +#endif /* !LY_SOFT_HYPHEN */ #define IsSpecialAttrChar(a) ((a > '\002') && (a < '\010')) extern int HTCurSelectGroupType; @@ -163,7 +165,7 @@ extern HTList * search_queries; /* Previous isindex and whereis queries */ extern void HTSearchQueries_free NOPARAMS; extern void HTAddSearchQuery PARAMS((char *query)); -extern void user_message PARAMS((char * message, char * argument)); +extern void user_message PARAMS((CONST char * message, CONST char * argument)); #define _user_message(msg, arg) mustshow = TRUE, user_message(msg, arg) diff --git a/src/HTAlert.c b/src/HTAlert.c index 93fb0fed..a83014db 100644 --- a/src/HTAlert.c +++ b/src/HTAlert.c @@ -32,13 +32,13 @@ PUBLIC void HTAlert ARGS1( CONST char *, Msg) { if (TRACE) { - fprintf(stderr, "\nAlert!: %s", (char *)Msg); + fprintf(stderr, "\nAlert!: %s", Msg); fflush(stderr); - _user_message("Alert!: %s", (char *)Msg); + _user_message("Alert!: %s", Msg); fprintf(stderr, "\n\n"); fflush(stderr); } else - _user_message("Alert!: %s", (char *)Msg); + _user_message("Alert!: %s", Msg); sleep(AlertSecs); } @@ -50,9 +50,9 @@ PUBLIC void HTProgress ARGS1( CONST char *, Msg) { if (TRACE) - fprintf(stderr, "%s\n", (char *)Msg); + fprintf(stderr, "%s\n", Msg); else - statusline((char *)Msg); + statusline(Msg); } /* Seek confirmation. HTConfirm() @@ -68,7 +68,7 @@ PUBLIC BOOL HTConfirm ARGS1(CONST char *, Msg) extern BOOLEAN HadVMSInterrupt; #endif /* VMS */ - _user_message("%s (y/n) ", (char *)Msg); + _user_message("%s (y/n) ", Msg); while (1) { c = LYgetch(); @@ -99,7 +99,7 @@ PUBLIC char * HTPrompt ARGS2( Tmp[0] = '\0'; Tmp[199] = '\0'; - _statusline((char *)Msg); + _statusline(Msg); if (deflt) strncpy(Tmp, deflt, 199); @@ -124,7 +124,7 @@ PUBLIC char * HTPromptPassword ARGS1( pw[0] = '\0'; if (!dump_output_immediately) { - _statusline(Msg ? (char *)Msg : PASSWORD_PROMPT); + _statusline(Msg ? Msg : PASSWORD_PROMPT); LYgetstr(pw, HIDDEN, sizeof(pw), NORECALL); /* hidden */ StrAllocCopy(result, pw); } else { diff --git a/src/HTFWriter.c b/src/HTFWriter.c index a5dd12a5..3c3e45aa 100644 --- a/src/HTFWriter.c +++ b/src/HTFWriter.c @@ -237,15 +237,17 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) } FREE(path); #ifdef EXP_CHARTRANS - /* - * Lock the chartrans info we may possibly have, - * so HTCharsetFormat() will not apply the default - * for local files. - KW - */ if (!skip_loadfile) { + /* + * Lock the chartrans info we may possibly have, + * so HTCharsetFormat() will not apply the default + * for local files. - KW + */ if (HTAnchor_getUCLYhndl(me->anchor, UCT_STAGE_PARSER) < 0 ) { - /* If not yet set - kw */ + /* + * If not yet set - KW + */ HTAnchor_copyUCInfoStage(me->anchor, UCT_STAGE_PARSER, UCT_STAGE_MIME, diff --git a/src/HTFont.h b/src/HTFont.h index 9ab44fd5..61ece860 100644 --- a/src/HTFont.h +++ b/src/HTFont.h @@ -8,8 +8,12 @@ typedef long int HTMLFont; /* For now */ +#ifndef HT_NON_BREAK_SPACE #define HT_NON_BREAK_SPACE ((char)1) /* For now */ +#endif /* !HT_NON_BREAK_SPACE */ +#ifndef HT_EM_SPACE #define HT_EM_SPACE ((char)2) /* For now */ +#endif /* !HT_EM_SPACE */ #define HT_FONT 0 diff --git a/src/HTForms.h b/src/HTForms.h index c152f0a9..9f2503b0 100644 --- a/src/HTForms.h +++ b/src/HTForms.h @@ -15,25 +15,25 @@ extern int change_form_link PARAMS((struct link *form_link, int mode, * HTML.c and Gridtext.c in HText_beginInput() */ typedef struct _InputFieldData { - char *accept; - char *align; + CONST char *accept; + CONST char *align; int checked; - char *class; + CONST char *class; int disabled; - char *error; - char *height; - char *id; - char *lang; - char *max; - char *maxlength; - char *md; - char *min; - char *name; - char *size; - char *src; - char *type; + CONST char *error; + CONST char *height; + CONST char *id; + CONST char *lang; + CONST char *max; + CONST char *maxlength; + CONST char *md; + CONST char *min; + CONST char *name; + CONST char *size; + CONST char *src; + CONST char *type; char *value; - char *width; + CONST char *width; } InputFieldData; /* The OptionType structure is for a linked list of option entries diff --git a/src/HTML.c b/src/HTML.c index ebe3162e..eb09a0f9 100644 --- a/src/HTML.c +++ b/src/HTML.c @@ -520,7 +520,7 @@ char prevailing_class[TEMPSTRINGSIZE]; int hcode; #endif -#define CHECK_ID(code) LYCheckForID(me, present, (CONST char **)value, (int)code) +#define CHECK_ID(code) LYCheckForID(me, present, value, (int)code) /* Start Element ** ------------- @@ -529,7 +529,7 @@ PRIVATE void HTML_start_element ARGS5( HTStructured *, me, int, element_number, CONST BOOL*, present, - char **, value, + CONST char **, value, char **, include) { char *alt_string = NULL; @@ -595,14 +595,14 @@ PRIVATE void HTML_start_element ARGS5( fprintf(stderr, " (undefined) %s\n", myHash); if (rp) { - int hcode; + int hcd; *rp='\0'; /* trim the class */ - hcode=hash_code(myHash); - fprintf(stderr, "CSS:%s -> %d", myHash, hcode); - if (hashStyles[hcode].code!=hcode) + hcd = hash_code(myHash); + fprintf(stderr, "CSS:%s -> %d", myHash, hcd); + if (hashStyles[hcd].code!=hcd) fprintf(stderr, " (undefined) %s\n", myHash); else - fprintf(stderr, " ca=%d\n", hashStyles[hcode].color); + fprintf(stderr, " ca=%d\n", hashStyles[hcd].color); } } else @@ -4193,9 +4193,9 @@ PRIVATE void HTML_start_element ARGS5( if (current_char_set) { LYExpandString((char **)&value[HTML_BUTTON_VALUE]); } - LYUnEscapeEntities(value[HTML_BUTTON_VALUE], + LYUnEscapeEntities((char *)value[HTML_BUTTON_VALUE], me->UsePlainSpace, me->HiddenValue); - I.value = value[HTML_BUTTON_VALUE]; + I.value = (char *)value[HTML_BUTTON_VALUE]; /* * Convert any newlines or tabs to spaces, * and trim any lead or trailing spaces. - FM @@ -4513,12 +4513,12 @@ PRIVATE void HTML_start_element ARGS5( (char **)&value[HTML_INPUT_ALT] : (char **)&value[HTML_INPUT_VALUE])); LYUnEscapeEntities(((UseALTasVALUE == TRUE) ? - value[HTML_INPUT_ALT] : - value[HTML_INPUT_VALUE]), + (char *)value[HTML_INPUT_ALT] : + (char *)value[HTML_INPUT_VALUE]), me->UsePlainSpace, me->HiddenValue); I.value = ((UseALTasVALUE == TRUE) ? - value[HTML_INPUT_ALT] : - value[HTML_INPUT_VALUE]); + (char *)value[HTML_INPUT_ALT] : + (char *)value[HTML_INPUT_VALUE]); if (me->UsePlainSpace == TRUE) { /* * Convert any newlines or tabs to spaces, @@ -5016,7 +5016,7 @@ PRIVATE void HTML_start_element ARGS5( LYUseDefaultRawMode = TRUE; HTMLSetCharacterHandling(current_char_set); } - LYUnEscapeEntities(value[HTML_OPTION_VALUE], + LYUnEscapeEntities((char *)value[HTML_OPTION_VALUE], me->UsePlainSpace, me->HiddenValue); if (CurrentCharSet) { current_char_set = CurrentCharSet; @@ -5026,7 +5026,7 @@ PRIVATE void HTML_start_element ARGS5( HTCJK = CurrentHTCJK; } - I.value = value[HTML_OPTION_VALUE]; + I.value = (char *)value[HTML_OPTION_VALUE]; } if (me->select_disabled || diff --git a/src/LYCgi.c b/src/LYCgi.c index 44a85bd4..86d2db58 100644 --- a/src/LYCgi.c +++ b/src/LYCgi.c @@ -271,6 +271,12 @@ PRIVATE int LYLoadCGI ARGS4( strcmp(arg, HTLoadedDocumentURL()) && HText_AreDifferent(anAnchor, arg) && HTLoadedDocumentBookmark()) { + /* + * If we are reloading a lynxcgi document that had already been + * loaded, the various checks above should allow it even if + * no_bookmark_exec is TRUE an we are not now coming from a + * bookmark page. - kw + */ _statusline(BOOKMARK_EXEC_DISABLED); sleep(MessageSecs); status = HT_NOT_LOADED; @@ -281,6 +287,12 @@ PRIVATE int LYLoadCGI ARGS4( HText_AreDifferent(anAnchor, arg) && !exec_ok(HTLoadedDocumentURL(), pgm, CGI_PATH)) { /* exec_ok gives out msg. */ + /* + * If we are reloading a lynxcgi document that had already been + * loaded, the various checks above should allow it even if + * exec_ok() would reject it because we are not now coming from + * a document with a URL allowed by TRUSTED_LYNXCGI rules. - kw + */ status = HT_NOT_LOADED; } else { @@ -380,8 +392,18 @@ PRIVATE int LYLoadCGI ARGS4( while (wait(&wstatus) != pid) ; /* do nothing */ #else - waitpid(pid, &wstatus, 0); /* wait for child */ -#endif + while (-1 == waitpid(pid, &wstatus, 0)) { /* wait for child */ +#ifdef EINTR + if (errno == EINTR) + continue; +#endif /* EINTR */ +#ifdef ERESTARTSYS + if (errno == ERESTARTSYS) + continue; +#endif /* ERESTARTSYS */ + break; + } +#endif /* HAVE_TYPE_UNIONWAIT && !HAVE_WAITPID */ if (anAnchor->post_data) { close(fd1[1]); } diff --git a/src/LYCharSets.c b/src/LYCharSets.c index b7c84b9d..44e9cbaa 100644 --- a/src/LYCharSets.c +++ b/src/LYCharSets.c @@ -2069,7 +2069,7 @@ PUBLIC char ** LYCharSets[MAXCHARSETS]={ * Add the name that the user will see below. * The order of LYCharSets and char_set_names MUST be the same */ -PUBLIC char * LYchar_set_names[MAXCHARSETSP]={ +PUBLIC CONST char * LYchar_set_names[MAXCHARSETSP]={ "ISO Latin 1 ", "ISO Latin 2 ", "Other ISO Latin ", diff --git a/src/LYCharSets.h b/src/LYCharSets.h index f6e0f8a5..48a0c53a 100644 --- a/src/LYCharSets.h +++ b/src/LYCharSets.h @@ -4,7 +4,7 @@ /* LYchar_set_name[current_char_set] points to the currently active set */ extern int current_char_set; -extern char *LYchar_set_names[]; +extern CONST char *LYchar_set_names[]; extern char ** LYCharSets[]; diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c index d7729cf4..3f55f204 100644 --- a/src/LYCharUtils.c +++ b/src/LYCharUtils.c @@ -798,7 +798,7 @@ PUBLIC void LYZero_OL_Counter ARGS1( #ifdef EXP_CHARTRANS /* -** This function is used by the HTML Structured object. - kw +** This function is used by the HTML Structured object. - KW */ PUBLIC void LYGetChartransInfo ARGS1( HTStructured *, me) @@ -1379,9 +1379,9 @@ PUBLIC char * LYUnEscapeEntities ARGS3( p++; } else if (!hidden && *p == 10 && q != str && *(q-1) == 13) { /* - * If this is not a hidden string, and the current char - * is the LF ('\n') of a CRLF pair, drop the CR ('\r'). - kw - */ + ** If this is not a hidden string, and the current char is + ** the LF ('\n') of a CRLF pair, drop the CR ('\r'). - KW + */ *(q-1) = *p++; } else { *q++ = *p++; @@ -2005,7 +2005,7 @@ PUBLIC void LYHandleMETA ARGS4( UCT_STAGE_HTEXT, UCT_SETBY_DEFAULT); } - if (p_in->enc != UCT_ENC_CJK && + if ((p_in->enc != UCT_ENC_CJK) && (p_in->codepoints & UCT_CP_SUBSETOF_LAT1)) { HTCJK = NOCJK; } else if (chndl == current_char_set) { @@ -2778,7 +2778,7 @@ PUBLIC void LYCheckForContentBase ARGS1( { char *cp = NULL; BOOL present[HTML_BASE_ATTRIBUTES]; - char *value[HTML_BASE_ATTRIBUTES]; + CONST char *value[HTML_BASE_ATTRIBUTES]; int i; if (!(me && me->node_anchor)) @@ -2831,7 +2831,7 @@ PUBLIC void LYCheckForContentBase ARGS1( for (i = 0; i < HTML_BASE_ATTRIBUTES; i++) present[i] = NO; present[HTML_BASE_HREF] = YES; - value[HTML_BASE_HREF] = cp; + value[HTML_BASE_HREF] = (CONST char *)cp; (*me->isa->start_element)(me, HTML_BASE, present, value, 0); FREE(cp); } diff --git a/src/LYCookie.c b/src/LYCookie.c index 67ddd131..284df163 100644 --- a/src/LYCookie.c +++ b/src/LYCookie.c @@ -121,7 +121,7 @@ PRIVATE void MemAllocCopy ARGS3( temp = (char *)calloc(1, ((end - start) + 1)); if (temp == NULL) outofmem(__FILE__, "MemAllocCopy"); - LYstrncpy(temp, (char *)start, (end - start)); + LYstrncpy(temp, start, (end - start)); HTSACopy(dest, temp); FREE(temp); } @@ -238,7 +238,7 @@ PRIVATE BOOLEAN port_matches ARGS2( int, port, CONST char *, list) { - char *number = (char *)list; + CONST char *number = list; if (!(number && isdigit(*number))) return(FALSE); @@ -897,7 +897,7 @@ PRIVATE void LYProcessSetCookies ARGS6( value = (char *)calloc(1, value_len + 1); if (value == NULL) outofmem(__FILE__, "LYProcessSetCookies"); - LYstrncpy(value, (char *)value_start, value_len); + LYstrncpy(value, value_start, value_len); } if (len == 6 && !strncasecomp(attr_start, "secure", 6)) { if (value == NULL) { @@ -1395,7 +1395,7 @@ PRIVATE void LYProcessSetCookies ARGS6( value = (char *)calloc(1, value_len + 1); if (value == NULL) outofmem(__FILE__, "LYProcessSetCookie"); - LYstrncpy(value, (char *)value_start, value_len); + LYstrncpy(value, value_start, value_len); } if (len == 6 && !strncasecomp(attr_start, "secure", 6)) { if (value == NULL) { diff --git a/src/LYCurses.c b/src/LYCurses.c index f609100e..c3fc98ae 100644 --- a/src/LYCurses.c +++ b/src/LYCurses.c @@ -38,7 +38,7 @@ extern int _NOSHARE(COLS); #endif #if defined(COLOR_CURSES) -int lynx_uses_color = 0; +int lynx_has_color = 0; #endif /* @@ -211,7 +211,7 @@ PRIVATE int LYAttrset ARGS3(WINDOW*,win,int,color,int,mono) { if (TRACE) fprintf(stderr, "CSS:LYAttrset (%d, %d)\n", color, mono); - if (lynx_uses_color && LYShowColor >= SHOW_COLOR_ON && color > -1) + if (lynx_has_color && LYShowColor >= SHOW_COLOR_ON && color > -1) { wattrset(win,color); #if 0 @@ -393,7 +393,7 @@ PRIVATE struct { */ PRIVATE void LYsetWAttr ARGS1(WINDOW *, win) { - if (lynx_uses_color && LYShowColor >= SHOW_COLOR_ON) { + if (lynx_has_color && LYShowColor >= SHOW_COLOR_ON) { int code = 0; int attr = A_NORMAL; int offs = 1; @@ -489,7 +489,7 @@ PUBLIC int lynx_chg_color ARGS3( PUBLIC void lynx_set_color ARGS1(int, a) { - if (lynx_uses_color && LYShowColor >= SHOW_COLOR_ON) { + if (lynx_has_color && LYShowColor >= SHOW_COLOR_ON) { attrset(lynx_color_cfg[a].attr | COLOR_PAIR(a+1)); } } @@ -504,12 +504,12 @@ PUBLIC void lynx_standout ARGS1(int, flag) PRIVATE void lynx_init_colors NOARGS { - lynx_uses_color = FALSE; + lynx_has_color = FALSE; if (has_colors()) { int n, m; - lynx_uses_color = TRUE; + lynx_has_color = TRUE; start_color(); for (n = 0; n < sizeof(lynx_color_cfg)/sizeof(lynx_color_cfg[0]); n++) { @@ -704,8 +704,8 @@ PUBLIC void start_curses NOARGS #endif #ifdef USE_COLOR_STYLE - lynx_uses_color = has_colors(); - if (lynx_uses_color) + lynx_has_color = has_colors(); + if (lynx_has_color) start_color(); parse_userstyles(); #endif @@ -1602,7 +1602,7 @@ PUBLIC void lynx_start_link_color ARGS2( start_underline (); #endif /* USE_SLANG */ #if defined(FANCY_CURSES) && defined(COLOR_CURSES) - if (lynx_uses_color && LYShowColor >= SHOW_COLOR_ON) + if (lynx_has_color && LYShowColor >= SHOW_COLOR_ON) start_underline (); #endif /* USE_SLANG */ } else { @@ -1630,7 +1630,7 @@ PUBLIC void lynx_stop_link_color ARGS2( stop_underline (); #endif /* USE_SLANG */ #if defined(FANCY_CURSES) && defined(COLOR_CURSES) - if (lynx_uses_color && LYShowColor >= SHOW_COLOR_ON) + if (lynx_has_color && LYShowColor >= SHOW_COLOR_ON) stop_underline (); #endif /* USE_SLANG */ } else { @@ -1663,7 +1663,7 @@ PUBLIC void lynx_start_target_color NOARGS PUBLIC void lynx_start_status_color NOARGS { #if USE_COLOR_TABLE && defined(COLOR_CURSES) - if (lynx_uses_color && LYShowColor >= SHOW_COLOR_ON) + if (lynx_has_color && LYShowColor >= SHOW_COLOR_ON) lynx_set_color (2); else #endif @@ -1673,7 +1673,7 @@ PUBLIC void lynx_start_status_color NOARGS PUBLIC void lynx_stop_status_color NOARGS { #if USE_COLOR_TABLE && defined(COLOR_CURSES) - if (lynx_uses_color && LYShowColor >= SHOW_COLOR_ON) + if (lynx_has_color && LYShowColor >= SHOW_COLOR_ON) lynx_set_color (0); else #endif diff --git a/src/LYGetFile.c b/src/LYGetFile.c index bea7d19a..17c3e31f 100644 --- a/src/LYGetFile.c +++ b/src/LYGetFile.c @@ -472,7 +472,7 @@ Try_Redirected_URL: ((HTMainAnchor && !LYUserSpecifiedURL) ? (char *)HTMainAnchor->address : (char *)doc->address), - (char *)title); + title); } return(NULLFILE); diff --git a/src/LYKeymap.c b/src/LYKeymap.c index d3dee733..1ffddd5e 100644 --- a/src/LYKeymap.c +++ b/src/LYKeymap.c @@ -520,7 +520,7 @@ PRIVATE char *pretty ARGS1 (int, c) sprintf(buf, "> "); else if (c == 0177) sprintf(buf, "<delete> "); - else if (c > ' ' && c < 0377) + else if (c > ' ' && c <= 0377) sprintf(buf, "%c", c); else if (c < ' ') sprintf(buf, "^%c", c|0100); @@ -589,7 +589,7 @@ PRIVATE int LYLoadKeymap ARGS4 ( } for (i = 1; i < sizeof(keymap); i++) { /* LYK_PIPE not implemented yet */ - if (!isalpha(i-1) && + if ((i > 127 || i <= ' ' || !isalpha(i-1)) && strcmp(revmap[(unsigned char)keymap[i]].name, "PIPE")) { print_binding(target, buf, i); } diff --git a/src/LYList.c b/src/LYList.c index 2dc43fe0..c9a4faa7 100644 --- a/src/LYList.c +++ b/src/LYList.c @@ -260,7 +260,7 @@ PUBLIC void printlist ARGS2( address = HTAnchor_address(dest); fprintf(fp, "%4d. %s%s\n", cnt, ((HTAnchor*)parent != dest) && title ? "in " : "", - (char *)(title ? title : address)); + (title ? title : address)); FREE(address); #ifdef VMS if (HadVMSInterrupt) diff --git a/src/LYLocal.c b/src/LYLocal.c index a458ebe5..c7b914d5 100644 --- a/src/LYLocal.c +++ b/src/LYLocal.c @@ -378,7 +378,7 @@ PRIVATE BOOLEAN modify_tagged ARGS1( */ if (!strncmp(tmpbuf, "~/", 2)) { char *cp1 = NULL; - StrAllocCopy(cp1, (char *)Home_Dir()); + StrAllocCopy(cp1, Home_Dir()); StrAllocCat(cp1, (tmpbuf + 1)); if (strlen(cp1) > (sizeof(tmpbuf) - 1)) { sprintf(tmpbuf, "%s", "Path too long"); @@ -622,8 +622,7 @@ PRIVATE BOOLEAN modify_location ARGS1( * Allow ~/ references to the home directory. */ if (!strncmp(tmpbuf,"~/",2)) { - cp = (char *)Home_Dir(); - strcpy(newpath, cp); + strcpy(newpath, Home_Dir()); strcat(newpath, (tmpbuf + 1)); strcpy(tmpbuf, newpath); } @@ -2228,17 +2227,18 @@ PUBLIC int LYExecv ARGS3( while (wait(&wstatus) != pid) ; /* do nothing */ #else - while (-1 == waitpid (pid, &wstatus, 0)) /* wait for child */ - { + while (-1 == waitpid(pid, &wstatus, 0)) { /* wait for child */ #ifdef EINTR - if (errno == EINTR) continue; -#endif + if (errno == EINTR) + continue; +#endif /* EINTR */ #ifdef ERESTARTSYS - if (errno == ERESTARTSYS) continue; -#endif + if (errno == ERESTARTSYS) + continue; +#endif /* ERESTARTSYS */ break; } -#endif +#endif /* HAVE_TYPE_UNIONWAIT && !HAVE_WAITPID */ if (WEXITSTATUS(wstatus) != 0 || WTERMSIG(wstatus) > 0) { /* error return */ sprintf(tmpbuf, "Probable failure to %s due to system error!", diff --git a/src/LYMail.c b/src/LYMail.c index 028c43bb..59d8deb6 100644 --- a/src/LYMail.c +++ b/src/LYMail.c @@ -478,7 +478,7 @@ PUBLIC void mailmsg ARGS4(int,cur, char *,owner_address, PUBLIC void reply_by_mail ARGS3( char *, mail_address, char *, filename, - char *, title) + CONST char *, title) { char user_input[1000]; FILE *fd, *fp; diff --git a/src/LYMail.h b/src/LYMail.h index ce2d9aed..52e49ff6 100644 --- a/src/LYMail.h +++ b/src/LYMail.h @@ -19,8 +19,8 @@ extern void mailmsg PARAMS(( char * filename, char * linkname)); extern void reply_by_mail PARAMS(( - char * mail_address, - char * filename, - char * title)); + char * mail_address, + char * filename, + CONST char * title)); #endif /* LYMAIL_H */ diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c index d2215e02..1e7dfdc5 100644 --- a/src/LYMainLoop.c +++ b/src/LYMainLoop.c @@ -173,8 +173,7 @@ int mainloop NOARGS int i; #ifdef DIRED_SUPPORT - char *tp; - char tmpbuf[1024]; + char *tp = NULL; struct stat dir_info; extern char LYPermitFileURL[]; extern char LYDiredFileURL[]; @@ -3650,21 +3649,25 @@ check_goto_URL: if (nlinks > 0) { cp = links[curdoc.link].lname; if (is_url(cp) == FILE_URL_TYPE) { - tp = cp; - if (!strncmp(tp, "file://localhost", 16)) - tp += 16; - else if (!strncmp(tp, "file:", 5)) - tp += 5; - strcpy(tmpbuf, tp); - HTUnEscape(tmpbuf); - if (stat(tmpbuf, &dir_info) == -1) { + if (!strncmp(tp, "file://localhost", 16)) { + /* + * This is the only case that should occur. - kw + */ + StrAllocCopy(tp, cp + 16); + } else if (!strncmp(tp, "file:", 5)) { + StrAllocCopy(tp, cp + 5); + } else { + StrAllocCopy(tp, cp); + } + HTUnEscape(tp); + if (stat(tp, &dir_info) == -1) { _statusline(NO_STATUS); sleep(AlertSecs); } else { if (((dir_info.st_mode) & S_IFMT) == S_IFREG) { - strcpy(tmpbuf, cp); - HTUnEscapeSome(tmpbuf, "/"); - if (edit_current_file(tmpbuf, + StrAllocCopy(tp, cp); + HTUnEscapeSome(tp, "/"); + if (edit_current_file(tp, curdoc.link, Newline)) { HTuncache_current_document(); StrAllocCopy(newdoc.address, @@ -3690,6 +3693,7 @@ check_goto_URL: } } } + FREE(tp); } } } else diff --git a/src/LYOptions.c b/src/LYOptions.c index f73e58ff..80c840fa 100644 --- a/src/LYOptions.c +++ b/src/LYOptions.c @@ -89,7 +89,7 @@ PRIVATE void option_user_message ARGS2( * Use _user_message() set to output on the bottom line. */ LYStatusLine = (LYlines - 1); - _user_message((char *)message, argument); + _user_message(message, argument); LYStatusLine = -1; } @@ -758,11 +758,11 @@ draw_options: if (!LYSelectPopups) { current_char_set = boolean_choice(current_char_set, L_CHARSET, -1, - LYchar_set_names); + (char **)LYchar_set_names); } else { current_char_set = popup_choice(current_char_set, L_CHARSET, -1, - LYchar_set_names, + (char **)LYchar_set_names, 0, FALSE); #if defined(VMS) || defined(USE_SLANG) move(L_CHARSET, COL_OPTION_VALUES); diff --git a/src/LYPrint.c b/src/LYPrint.c index d6f6e0a1..d6d444ce 100644 --- a/src/LYPrint.c +++ b/src/LYPrint.c @@ -80,12 +80,11 @@ PUBLIC int printfile ARGS1( HTFormat format; HTAtom *encoding; BOOL use_mime, use_cte, use_type; - char *disp_charset; + CONST char *disp_charset; static BOOLEAN first_mail_preparsed = TRUE; + char *envbuffer = NULL; #ifdef VMS extern BOOLEAN HadVMSInterrupt; -#else - char *envbuffer = NULL; /* WebSter Print Mods -jkt */ #endif /* VMS */ /* @@ -1030,26 +1029,40 @@ PUBLIC int printfile ARGS1( if (TRACE) fprintf(stderr, "command: %s\n", buffer); printf(PRINTING_FILE); - -#ifndef VMS - /* Begin WebSter Print Mods - jkt */ +#ifdef VMS + /* + * Set document's title as a VMS logical. - FM + */ + StrAllocCopy(envbuffer, HText_getTitle()); + if (!(envbuffer && *envbuffer)) + StrAllocCopy(envbuffer, "No Title"); + Define_VMSLogical("LYNX_PRINT_TITLE", envbuffer); +#else + /* + * Set document's title as an environment variable. - JKT + */ StrAllocCopy(envbuffer, "LYNX_PRINT_TITLE="); StrAllocCat(envbuffer, HText_getTitle()); putenv(envbuffer); - /* End WebSter Print Mods - jkt */ -#endif /* !VMS */ - +#endif /* VMS */ fflush(stdout); system(buffer); - fflush(stdout); -#ifndef VMS - signal(SIGINT, cleanup_sig); +#ifdef VMS /* - * Remove LYNX_PRINT_TITLE value from environment - kw + * Remove LYNX_PRINT_TITLE logical. - FM + */ + Define_VMSLogical("LYNX_PRINT_TITLE", ""); +#else + /* + * Remove LYNX_PRINT_TITLE value from environment. - KW */ envbuffer[17] = '\0'; /* truncate after '=' */ putenv(envbuffer); +#endif /* VMS */ FREE(envbuffer); + fflush(stdout); +#ifndef VMS + signal(SIGINT, cleanup_sig); #endif /* !VMS */ sleep(MessageSecs); start_curses(); diff --git a/src/LYStrings.c b/src/LYStrings.c index aac67203..dd07fe98 100644 --- a/src/LYStrings.c +++ b/src/LYStrings.c @@ -98,7 +98,7 @@ PRIVATE int set_clicked_link ARGS2(int,x,int,y) */ PUBLIC char *LYstrncpy ARGS3( char *, dst, - char *, src, + CONST char *, src, int, n) { char *val; @@ -125,7 +125,7 @@ PUBLIC char *LYstrncpy ARGS3( * src string is copied until either end of string or max number of * either bytes or glyphs (mbcs sequences) (currently only UTF8). */ -PUBLIC char * LYmbcsstrncpy ARGS5(char *,dst, char *,src, int,n_bytes, +PUBLIC char * LYmbcsstrncpy ARGS5(char *,dst, CONST char *,src, int,n_bytes, int,n_glyphs, int,utf_flag) { char *val = dst; diff --git a/src/LYStrings.h b/src/LYStrings.h index 7124a0b9..6432f475 100644 --- a/src/LYStrings.h +++ b/src/LYStrings.h @@ -7,7 +7,7 @@ extern char *strstr(); #endif /* __STRICT_BSD__ */ extern int get_mouse_link NOPARAMS; -extern char * LYstrncpy PARAMS((char *dst, char *src, int n)); +extern char * LYstrncpy PARAMS((char *dst, CONST char *src, int n)); extern int LYgetch NOPARAMS; extern int LYgetstr PARAMS((char *inputline, int hidden, int bufsize, int recall)); @@ -33,7 +33,7 @@ extern int LYmbcsstrlen PARAMS(( BOOL utf_flag)); extern char * LYmbcsstrncpy PARAMS(( char * dst, - char * src, + CONST char * src, int n_bytes, int n_glyphs, int enc)); @@ -65,7 +65,7 @@ extern char * SNACat PARAMS((char **dest, CONST char *src, int n)); #define SELECT_KEY 267 /* 0x10B */ #define INSERT_KEY 268 /* 0x10C */ #define REMOVE_KEY 269 /* 0x10D */ -#define DO_NOTHING 270 /* 0x00E */ +#define DO_NOTHING 270 /* 0x10E */ #define VISIBLE 0 #define HIDDEN 1 diff --git a/src/LYStyle.c b/src/LYStyle.c index 0d9d0724..8e36c09d 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,v 1.2 1997/09/17 23:34:13 tom Exp $ + * $Id: LYStyle.c,v 1.3 1997/09/19 01:14:00 klaus Exp $ */ #include "HTUtils.h" #include "HTML.h" @@ -123,7 +123,7 @@ PRIVATE void parse_attributes ARGS5(char*,mono,char*,fg,char*,bg,int,style,char* * If we have colour, and space to create a new colour attribute, * and we have a valid colour description, then add this style */ - if (lynx_uses_color && colorPairs < COLOR_PAIRS-1 && fA!=-1) + if (lynx_has_color && colorPairs < COLOR_PAIRS-1 && fA!=-1) { colorPairs++; init_pair(colorPairs, fA, bA); diff --git a/src/LYStyle.h b/src/LYStyle.h index 02eab3d9..8ec3c52c 100644 --- a/src/LYStyle.h +++ b/src/LYStyle.h @@ -12,7 +12,7 @@ extern CONST SGML_dtd HTML_dtd; extern HTCharStyle displayStyles[DSTYLE_ELEMENTS]; /* Can we do colour? - RP */ -extern int lynx_uses_color; +extern int lynx_has_color; /* Set all the buckets in the hash table to be empty */ extern void style_initialiseHashTable NOPARAMS; diff --git a/src/LYUtils.c b/src/LYUtils.c index a4b5225a..c2d6a13a 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -1892,7 +1892,7 @@ PUBLIC void statusline ARGS1( int a=(strncmp(buffer, "Alert", 5) || !hashStyles[s_alert].name ? s_status : s_alert); LynxChangeStyle (a, ABS_ON, 1); addstr(buffer); - wbkgdset(stdscr, (lynx_uses_color + wbkgdset(stdscr, (lynx_has_color ? hashStyles[a].color : hashStyles[a].mono) | ' '); clrtoeol(); @@ -4654,7 +4654,7 @@ PUBLIC void LYDoCSI ARGS3( CONST char *, comment, char **, csi) { - char *cp = (char *)comment; + CONST char *cp = comment; if (cp == NULL) return; diff --git a/src/UCAux.c b/src/UCAux.c index 401280a5..bb95e915 100644 --- a/src/UCAux.c +++ b/src/UCAux.c @@ -44,8 +44,8 @@ PUBLIC BOOL UCCanTranslateFromTo ARGS2( return (LYCharSet_UC[from].UChndl >= 0); } { - char * fromname = LYCharSet_UC[from].MIMEname; - char * toname = LYCharSet_UC[to].MIMEname; + CONST char * fromname = LYCharSet_UC[from].MIMEname; + CONST char * toname = LYCharSet_UC[to].MIMEname; if (!strcmp(fromname, "x-transparent") || !strcmp(toname, "x-transparent")) { return YES; diff --git a/src/UCdomap.c b/src/UCdomap.c index 68b82403..548096d5 100644 --- a/src/UCdomap.c +++ b/src/UCdomap.c @@ -52,8 +52,8 @@ #include "[.chrtrans]cp1250_uni.h" #include "[.chrtrans]cp1251_uni.h" #include "[.chrtrans]cp1252_uni.h" -#include "[.chrtrans]utf8_uni.h" #include "[.chrtrans]viscii_uni.h" +#include "[.chrtrans]utf8_uni.h" #include "[.chrtrans]rfc_suni.h" #include "[.chrtrans]mnemonic_suni.h" #ifdef NOTDEFINED @@ -314,7 +314,7 @@ PRIVATE int UC_MapGN PARAMS(( int UChndl, int update_flag)); PRIVATE int UC_FindGN_byMIME PARAMS(( - char * UC_MIMEcharset)); + CONST char * UC_MIMEcharset)); PRIVATE void UCreset_allocated_LYCharSets NOPARAMS; PRIVATE void UCfree_allocated_LYCharSets NOPARAMS; PRIVATE char ** UC_setup_LYCharSets_repl PARAMS(( @@ -322,8 +322,8 @@ PRIVATE char ** UC_setup_LYCharSets_repl PARAMS(( int lowest8)); PRIVATE int UC_Register_with_LYCharSets PARAMS(( int s, - char * UC_MIMEcharset, - char * UC_LYNXcharset, + CONST char * UC_MIMEcharset, + CONST char * UC_LYNXcharset, int lowest_eightbit)); PRIVATE void UCcleanup_mem NOPARAMS; @@ -1064,21 +1064,23 @@ PUBLIC long int UCTransToUni ARGS2( ch_iu = (unsigned char)ch_in; #ifndef UC_NO_SHORTCUTS - if (charset_in == 0) - return ch_iu; - if ((unsigned char)ch_in < 128 && (unsigned char)ch_in >= 32) - return ch_iu; + if (charset_in == 0) + return ch_iu; + if ((unsigned char)ch_in < 128 && (unsigned char)ch_in >= 32) + return ch_iu; #endif /* UC_NO_SHORTCUTS */ if (charset_in < 0) return -11; - if ((unsigned char)ch_in < 32 && - LYCharSet_UC[charset_in].enc != UCT_ENC_8BIT_C0) - /* don't translate C0 chars except for specific charsets */ - return ch_iu; - if ((UChndl_in = LYCharSet_UC[charset_in].UChndl) < 0) - return -11; - if (!UCInfo[UChndl_in].num_uni) - return -11; + if ((unsigned char)ch_in < 32 && + LYCharSet_UC[charset_in].enc != UCT_ENC_8BIT_C0) + /* + * Don't translate C0 chars except for specific charsets. + */ + return ch_iu; + if ((UChndl_in = LYCharSet_UC[charset_in].UChndl) < 0) + return -11; + if (!UCInfo[UChndl_in].num_uni) + return -11; if ((Gn = UCInfo[UChndl_in].GN) < 0) { Gn = UC_MapGN(UChndl_in,1); } @@ -1219,7 +1221,7 @@ if (buflen<2) } PRIVATE int UC_FindGN_byMIME ARGS1( - char *, UC_MIMEcharset) + CONST char *, UC_MIMEcharset) { int i; @@ -1500,8 +1502,8 @@ PRIVATE char ** UC_setup_LYCharSets_repl ARGS2( */ PRIVATE int UC_Register_with_LYCharSets ARGS4( int, s, - char *, UC_MIMEcharset, - char *, UC_LYNXcharset, + CONST char *, UC_MIMEcharset, + CONST char *, UC_LYNXcharset, int, lowest_eightbit) { int i, LYhndl,found; @@ -1555,7 +1557,7 @@ PRIVATE int UC_Register_with_LYCharSets ARGS4( * Hmm, try to be conservative here. */ LYchar_set_names[LYhndl] = UC_LYNXcharset; - LYchar_set_names[LYhndl+1] = (char *) 0; + LYchar_set_names[LYhndl+1] = NULL; /* * Terminating NULL may be looked for by Lynx code. */ @@ -1596,8 +1598,8 @@ PRIVATE int UC_Register_with_LYCharSets ARGS4( * is done here yet. */ PUBLIC void UC_Charset_Setup ARGS8( - char *, UC_MIMEcharset, - char *, UC_LYNXcharset, + CONST char *, UC_MIMEcharset, + CONST char *, UC_LYNXcharset, u8 *, unicount, u16 *, unitable, int, nnuni, diff --git a/src/UCdomap.h b/src/UCdomap.h index 7ddd835a..8c941464 100644 --- a/src/UCdomap.h +++ b/src/UCdomap.h @@ -23,8 +23,8 @@ UC[A-Z]* to be exported to other parts of Lynx. -kw */ extern void UC_Charset_Setup PARAMS(( - char * UC_MIMEcharset, - char * UC_LYNXcharset, + CONST char * UC_MIMEcharset, + CONST char * UC_LYNXcharset, u8 * unicount, u16 * unitable, int nnuni, @@ -37,8 +37,8 @@ char *UC_GNsetMIMEnames[4] = int UC_GNhandles[4] = {-1, -1, -1, -1}; struct UC_charset { - char *MIMEname; - char *LYNXname; + CONST char *MIMEname; + CONST char *LYNXname; u8* unicount; u16* unitable; int num_uni; diff --git a/src/chrtrans/def7_uni.tbl b/src/chrtrans/def7_uni.tbl index bba7cc12..a2b5a4b2 100644 --- a/src/chrtrans/def7_uni.tbl +++ b/src/chrtrans/def7_uni.tbl @@ -3,7 +3,7 @@ # character set. #The MIME name of this charset. -M us-ascii +Mus-ascii # Shall this become the "default" translation table? YES! # There has to be exactly one table marked as "default". @@ -498,7 +498,7 @@ U+0481:c3 U+0490:G3 U+0491:g3 -# These may may Yiddish slightly more readable, until we have +# These may make Yiddish slightly more readable, until we have # something better. 0x69 U+05b4 # i @@ -939,7 +939,7 @@ U+1358:mYa U+1359:rYa U+135A:fYa # ETHIOPIC SPACE U+1360 mapped to ASCII space -0x20 U+1360 +0x20 U+1360 0x3a U+1361 #:: U+1362::: 0x2c U+1363 #:, |