From 422b94378f762167eddba4f1874260f057d184bb Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Thu, 28 Nov 2013 11:57:39 -0500 Subject: snapshot of project "lynx", label v2-8-8dev_16x --- src/GridText.c | 18 ++--- src/HTAlert.c | 4 +- src/HTFWriter.c | 14 ++-- src/HTInit.c | 14 ++-- src/HTML.c | 24 +++---- src/LYBookmark.c | 4 +- src/LYCgi.c | 6 +- src/LYCharUtils.c | 26 +++---- src/LYCookie.c | 14 ++-- src/LYCurses.c | 16 +++-- src/LYEdit.c | 6 +- src/LYEditmap.c | 4 +- src/LYExtern.c | 18 ++--- src/LYGetFile.c | 34 ++++----- src/LYJump.c | 12 ++-- src/LYKeymap.c | 6 +- src/LYLocal.c | 18 ++--- src/LYMail.c | 38 +++++----- src/LYMain.c | 26 +++---- src/LYMainLoop.c | 22 +++--- src/LYMap.c | 6 +- src/LYNews.c | 6 +- src/LYOptions.c | 13 +++- src/LYPrettySrc.c | 4 +- src/LYPrint.c | 10 +-- src/LYReadCFG.c | 42 ++++++----- src/LYSession.c | 20 +++--- src/LYStrings.c | 20 +++--- src/LYStyle.c | 143 ++++++++++++------------------------ src/LYUpload.c | 4 +- src/LYUtils.c | 187 ++++++++++++++++++++++++++++++++++-------------- src/LYUtils.h | 5 +- src/LYexit.c | 41 ++++++----- src/LYrcFile.c | 8 +-- src/UCAuto.c | 12 ++-- src/chrtrans/makeuctb.c | 6 +- 36 files changed, 448 insertions(+), 403 deletions(-) (limited to 'src') diff --git a/src/GridText.c b/src/GridText.c index 7dce2483..6a172ebf 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -1,5 +1,5 @@ /* - * $LynxId: GridText.c,v 1.273 2013/10/13 20:23:07 tom Exp $ + * $LynxId: GridText.c,v 1.274 2013/11/28 11:16:50 tom Exp $ * * Character grid hypertext object * =============================== @@ -7657,7 +7657,7 @@ int do_www_search(DocInfo *doc) /* * Load the default query buffer */ - if ((cp = strchr(doc->address, '?')) != NULL) { + if ((cp = StrChr(doc->address, '?')) != NULL) { /* * This is an index from a previous search. * Use its query as the default. @@ -7799,7 +7799,7 @@ int do_www_search(DocInfo *doc) /* * Show the URL with the new query. */ - if ((cp = strchr(doc->address, '?')) != NULL) + if ((cp = StrChr(doc->address, '?')) != NULL) *cp = '\0'; StrAllocCopy(tmpaddress, doc->address); StrAllocCat(tmpaddress, "?"); @@ -10495,7 +10495,7 @@ static double get_trans_q(int cs_from, if (!givenmime || !(*givenmime)) return 0.0; - if ((p = strchr(givenmime, ';')) != NULL) { + if ((p = StrChr(givenmime, ';')) != NULL) { *p++ = '\0'; } if (!strcmp(givenmime, "*")) @@ -11624,7 +11624,7 @@ int HText_SubmitForm(FormInfo * submit_item, DocInfo *doc, * default. -FM */ if (Boundary) { - *(strchr(escaped1, '=') + 1) = '\0'; + *(StrChr(escaped1, '=') + 1) = '\0'; HTBprintf(&my_query, "%s\"%s.x\"\r\n\r\n0\r\n--%s\r\n%s\"%s.y\"\r\n\r\n0", escaped1, @@ -12517,7 +12517,7 @@ static int increment_tagged_htline(HTLine *ht, TextAnchor *a, int *lx_val, val += incr; sprintf(lx, "%d", val); new_n = (int) strlen(lx); - if ((r = strchr(ht->next->data, ']')) == 0) { + if ((r = StrChr(ht->next->data, ']')) == 0) { r = ""; } strcat(lx, r); @@ -12995,7 +12995,7 @@ static int finish_ExtEditForm(LinkInfo * form_link, TextAnchor *start_anchor, } line[len0] = '\0'; - if ((cp = strchr(lp, '\n')) != 0) + if ((cp = StrChr(lp, '\n')) != 0) len = (int) (cp - lp); else len = (int) strlen(lp); @@ -13003,7 +13003,7 @@ static int finish_ExtEditForm(LinkInfo * form_link, TextAnchor *start_anchor, if (wanted_fieldlen_wrap < 0 && !wrapalert && len0 + len >= display_size && - (cp = strchr(lp, ' ')) != NULL && + (cp = StrChr(lp, ' ')) != NULL && (cp - lp) < display_size - 1) { LYFixCursesOn("ask for confirmation:"); @@ -13637,7 +13637,7 @@ int HText_InsertFile(LinkInfo * form_link) while (*lp) { - if ((cp = strchr(lp, '\n')) != 0) + if ((cp = StrChr(lp, '\n')) != 0) len = (int) (cp - lp); else len = (int) strlen(lp); diff --git a/src/HTAlert.c b/src/HTAlert.c index 59569d4e..34ddfa9f 100644 --- a/src/HTAlert.c +++ b/src/HTAlert.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTAlert.c,v 1.100 2013/10/12 14:52:24 tom Exp $ + * $LynxId: HTAlert.c,v 1.101 2013/11/28 11:17:04 tom Exp $ * * Displaying messages and getting input for Lynx Browser * ========================================================== @@ -940,7 +940,7 @@ BOOL HTConfirmCookie(domain_entry * de, const char *server, char *p = gettext("Y/N/A/V"); /* placeholder for comment */ const char *s = "YNAV\007\003"; /* see ADVANCED_COOKIE_CONFIRMATION */ - if (strchr(s, ch) == 0 + if (StrChr(s, ch) == 0 && isalpha(ch) && (p = strrchr(prompt, L_PAREN)) != 0) { diff --git a/src/HTFWriter.c b/src/HTFWriter.c index be2b63be..b893ea22 100644 --- a/src/HTFWriter.c +++ b/src/HTFWriter.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTFWriter.c,v 1.105 2013/07/21 00:41:24 tom Exp $ + * $LynxId: HTFWriter.c,v 1.106 2013/11/28 11:17:04 tom Exp $ * * FILE WRITER HTFWrite.h * =========== @@ -665,7 +665,7 @@ HTStream *HTSaveAndExecute(HTPresentation *pres, LYStrNCpy(view_fname, anchor->address + 17, sizeof(fnam) - 5); HTUnEscape(view_fname); - if (strchr(view_fname, ':') == NULL) { + if (StrChr(view_fname, ':') == NULL) { fnam[0] = windows_drive[0]; fnam[1] = windows_drive[1]; fnam[2] = '/'; @@ -683,7 +683,7 @@ HTStream *HTSaveAndExecute(HTPresentation *pres, } cp++; } - if (strchr(view_fname, ' ')) + if (StrChr(view_fname, ' ')) view_fname = quote_pathname(view_fname); StrAllocCopy(me->viewer_command, pres->command); @@ -803,7 +803,7 @@ HTStream *HTSaveToFile(HTPresentation *pres, return (NULL); } - if (((cp = strchr(pres->rep->name, ';')) != NULL) && + if (((cp = StrChr(pres->rep->name, ';')) != NULL) && strstr((cp + 1), "charset") != NULL) { _user_message(MSG_DOWNLOAD_OR_CANCEL, pres->rep->name); } else if (*(pres->rep->name) != '\0') { @@ -1090,7 +1090,7 @@ HTStream *HTCompressed(HTPresentation *pres, } if (can_present == FALSE || /* no presentation mapping */ uncompress_mask == NULL || /* not gzip or compress */ - strchr(anchor->content_type, ';') || /* wrong charset */ + StrChr(anchor->content_type, ';') || /* wrong charset */ HTOutputFormat == HTAtom_for("www/download") || /* download */ !strcasecomp(pres->rep_out->name, "www/download") || /* download */ (traversal && /* only handle html or plain text for traversals */ @@ -1100,7 +1100,7 @@ HTStream *HTCompressed(HTPresentation *pres, * Cast the Content-Encoding to a Content-Type and pass it back to be * handled as that type. - FM */ - if (strchr(anchor->content_encoding, '/') == NULL) { + if (StrChr(anchor->content_encoding, '/') == NULL) { /* * Use "x-" prefix, none of the types we are likely to construct * here are official. That is we generate "application/x-gzip" and @@ -1164,7 +1164,7 @@ HTStream *HTCompressed(HTPresentation *pres, HTFileSuffix(HTAtom_for(anchor->content_type), NULL)) && *suffix == '.') { #if defined(VMS) || defined(FNAMES_8_3) - if (strchr(suffix + 1, '.') == NULL) + if (StrChr(suffix + 1, '.') == NULL) #endif middle = suffix + 1; } diff --git a/src/HTInit.c b/src/HTInit.c index ecefe149..cb6b80e4 100644 --- a/src/HTInit.c +++ b/src/HTInit.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTInit.c,v 1.84 2013/05/05 19:49:29 tom Exp $ + * $LynxId: HTInit.c,v 1.85 2013/11/28 11:17:21 tom Exp $ * * Configuration-specific Initialization HTInit.c * ---------------------------------------- @@ -382,7 +382,7 @@ static int ProcessMailcapEntry(FILE *fp, struct MailcapEntry *mc, AcceptMedia me FREE(rawentry); return (0); } - s = strchr(rawentry, ';'); + s = StrChr(rawentry, ';'); if (s == NULL) { CTrace((tfp, "ProcessMailcapEntry: Ignoring invalid mailcap entry: %s\n", @@ -423,7 +423,7 @@ static int ProcessMailcapEntry(FILE *fp, struct MailcapEntry *mc, AcceptMedia me t = GetCommand(s, &mallocd_string); arg = mallocd_string; - eq = strchr(arg, '='); + eq = StrChr(arg, '='); if (eq) { *eq++ = '\0'; eq = LYSkipBlanks(eq); @@ -518,7 +518,7 @@ static const char *LYSkipToken(const char *s) { static const char tspecials[] = "\"()<>@,;:\\/[]?.="; - while (*s != '\0' && !WHITE(*s) && strchr(tspecials, *s) == 0) { + while (*s != '\0' && !WHITE(*s) && StrChr(tspecials, *s) == 0) { ++s; } return s; @@ -573,7 +573,7 @@ static char *LYGetContentType(const char *name, if (params != 0) { if (name != 0) { size_t length = strlen(name); - const char *test = strchr(params, ';'); /* skip type/subtype */ + const char *test = StrChr(params, ';'); /* skip type/subtype */ const char *next; while (test != 0) { @@ -639,7 +639,7 @@ BOOL LYMailcapUsesPctS(const char *controlstring) result = TRUE; break; case L_CURL: - next = strchr(from, R_CURL); + next = StrChr(from, R_CURL); if (next != 0) { from = next; break; @@ -705,7 +705,7 @@ static int BuildCommand(HTChunk *cmd, } break; case L_CURL: - next = strchr(from, R_CURL); + next = StrChr(from, R_CURL); if (next != 0) { if (params != 0) { ++from; diff --git a/src/HTML.c b/src/HTML.c index 025d39e8..ed83b825 100644 --- a/src/HTML.c +++ b/src/HTML.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTML.c,v 1.163 2013/10/13 14:24:33 tom Exp $ + * $LynxId: HTML.c,v 1.164 2013/11/28 11:17:39 tom Exp $ * * Structured stream to Rich hypertext converter * ============================================ @@ -1042,9 +1042,9 @@ static int HTML_start_element(HTStructured * me, int element_number, char q = '"'; /*0 in dquotes, 1 - in quotes, 2 mixed */ - char kind = (char) (!strchr(value[i], '"') ? + char kind = (char) (!StrChr(value[i], '"') ? 0 : - !strchr(value[i], '\'') ? + !StrChr(value[i], '\'') ? q = '\'', 1 : 2); @@ -1272,7 +1272,7 @@ static int HTML_start_element(HTStructured * me, int element_number, */ temp = HTParse(base, "", PARSE_PATH + PARSE_PUNCTUATION); if (*temp != '\0') { - char *p = strchr(temp, '?'); + char *p = StrChr(temp, '?'); if (p) *p = '\0'; @@ -3540,7 +3540,7 @@ static int HTML_start_element(HTStructured * me, int element_number, * LYSeekFragAREAinCur is set. - FM && KW */ StrAllocCopy(me->map_address, me->node_anchor->address); - if ((cp = strchr(me->map_address, '#')) != NULL) + if ((cp = StrChr(me->map_address, '#')) != NULL) *cp = '\0'; StrAllocCat(me->map_address, "#"); StrAllocCat(me->map_address, id_string); @@ -4395,7 +4395,7 @@ static int HTML_start_element(HTStructured * me, int element_number, if (!(present && present[HTML_BUTTON_NAME] && value[HTML_BUTTON_NAME])) { I.name = ""; - } else if (strchr(value[HTML_BUTTON_NAME], '&') == NULL) { + } else if (StrChr(value[HTML_BUTTON_NAME], '&') == NULL) { I.name = value[HTML_BUTTON_NAME]; } else { StrAllocCopy(I_name, value[HTML_BUTTON_NAME]); @@ -4637,7 +4637,7 @@ static int HTML_start_element(HTStructured * me, int element_number, if (!(present && present[HTML_INPUT_NAME] && non_empty(value[HTML_INPUT_NAME]))) { I.name = ""; - } else if (strchr(value[HTML_INPUT_NAME], '&') == NULL) { + } else if (StrChr(value[HTML_INPUT_NAME], '&') == NULL) { I.name = value[HTML_INPUT_NAME]; } else { StrAllocCopy(I_name, value[HTML_INPUT_NAME]); @@ -4989,7 +4989,7 @@ static int HTML_start_element(HTStructured * me, int element_number, value[HTML_TEXTAREA_NAME]) { StrAllocCopy(me->textarea_name, value[HTML_TEXTAREA_NAME]); me->textarea_name_cs = ATTR_CS_IN; - if (strchr(value[HTML_TEXTAREA_NAME], '&') != NULL) { + if (StrChr(value[HTML_TEXTAREA_NAME], '&') != NULL) { UNESCAPE_FIELDNAME_TO_STD(&me->textarea_name); } } else { @@ -6304,7 +6304,7 @@ static int HTML_end_element(HTStructured * me, int element_number, HTChunkTerminate(&me->object); data = me->object.data; - while ((cp = strchr(data, '<')) != NULL) { + while ((cp = StrChr(data, '<')) != NULL) { /* * Look for nested OBJECTs. This procedure could get tripped * up if invalid comments are present in the content, or if an @@ -6892,7 +6892,7 @@ static int HTML_end_element(HTStructured * me, int element_number, /* * Load the first text line, or set up for all blank rows. - FM */ - if ((cp = strchr(data, '\n')) != NULL) { + if ((cp = StrChr(data, '\n')) != NULL) { *cp = '\0'; StrAllocCopy(temp, data); *cp = '\n'; @@ -6925,7 +6925,7 @@ static int HTML_end_element(HTStructured * me, int element_number, if (*data == '\n') { FREE(temp); data++; - } else if ((cp = strchr(data, '\n')) != NULL) { + } else if ((cp = StrChr(data, '\n')) != NULL) { *cp = '\0'; StrAllocCopy(temp, data); *cp = '\n'; @@ -6958,7 +6958,7 @@ static int HTML_end_element(HTStructured * me, int element_number, if (*data == '\n') { FREE(temp); data++; - } else if ((cp = strchr(data, '\n')) != NULL) { + } else if ((cp = StrChr(data, '\n')) != NULL) { *cp = '\0'; StrAllocCopy(temp, data); *cp = '\n'; diff --git a/src/LYBookmark.c b/src/LYBookmark.c index b5425f4c..d1a624ec 100644 --- a/src/LYBookmark.c +++ b/src/LYBookmark.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYBookmark.c,v 1.75 2013/10/12 14:51:18 tom Exp $ + * $LynxId: LYBookmark.c,v 1.76 2013/11/28 11:17:59 tom Exp $ */ #include #include @@ -40,7 +40,7 @@ int LYMBM2index(int ch) { if ((ch = TOUPPER(ch)) > 0) { const char *letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - const char *result = strchr(letters, ch); + const char *result = StrChr(letters, ch); if (result != 0 && (result - letters) <= MBM_V_MAXFILES) diff --git a/src/LYCgi.c b/src/LYCgi.c index d65f7827..caa6b6d4 100644 --- a/src/LYCgi.c +++ b/src/LYCgi.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYCgi.c,v 1.65 2013/01/04 09:44:59 tom Exp $ + * $LynxId: LYCgi.c,v 1.67 2013/11/28 11:35:56 tom Exp $ * Lynx CGI support LYCgi.c * ================ * @@ -117,7 +117,7 @@ static void add_environment_value(const char *env_value) assert(env != NULL); } - env[envc++] = (char *) env_value; + env[envc++] = DeConst(env_value); env[envc] = NULL; /* Make sure it is always properly terminated */ } @@ -213,7 +213,7 @@ static int LYLoadCGI(const char *arg, } else { StrAllocCopy(pgm, arg + 8); } - if ((cp = strchr(pgm, '?')) != NULL) { /* Need to terminate executable */ + if ((cp = StrChr(pgm, '?')) != NULL) { /* Need to terminate executable */ *cp++ = '\0'; pgm_args = cp; } diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c index ded061b2..01d6a4b6 100644 --- a/src/LYCharUtils.c +++ b/src/LYCharUtils.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYCharUtils.c,v 1.126 2013/10/19 19:12:09 tom Exp $ + * $LynxId: LYCharUtils.c,v 1.127 2013/11/28 11:17:59 tom Exp $ * * Functions associated with LYCharSets.c and the Lynx version of HTML.c - FM * ========================================================================== @@ -51,7 +51,7 @@ static size_t count_char(const char *value, int ch) const char *found; size_t result = 0; - while ((*value != '\0') && (found = strchr(value, ch)) != NULL) { + while ((*value != '\0') && (found = StrChr(value, ch)) != NULL) { ++result; value = (found + 1); } @@ -223,7 +223,7 @@ static BOOL MustEntify(const char *source) BOOL result; #ifdef CJK_EX - if (IS_CJK_TTY && strchr(source, '\033') != 0) { + if (IS_CJK_TTY && StrChr(source, '\033') != 0) { result = TRUE; } else #endif @@ -352,7 +352,7 @@ char *LYFindEndOfComment(char *str) */ return cp; - if ((cp1 = strchr(cp, '>')) == NULL) + if ((cp1 = StrChr(cp, '>')) == NULL) /* * We don't have an end character, so return the beginning of the * string. - FM @@ -508,7 +508,7 @@ void LYFillLocalFileURL(char **href, * Check for pathological cases - current dir has chars which MUST BE * URL-escaped - kw */ - if (strchr(temp2, '%') != NULL || strchr(temp2, '#') != NULL) { + if (StrChr(temp2, '%') != NULL || StrChr(temp2, '#') != NULL) { FREE(temp); temp = HTEscape(temp2, URL_PATH); StrAllocCat(*href, temp); @@ -1152,7 +1152,7 @@ char **LYUCFullyTranslateString(char **str, /* * Save malloc/calloc overhead in simple case - kw */ - if (do_ent && hidden && (stype != st_URL) && (strchr(*str, '&') == NULL)) + if (do_ent && hidden && (stype != st_URL) && (StrChr(*str, '&') == NULL)) do_ent = FALSE; /* Can't do, caller should figure out what to do... */ @@ -1923,7 +1923,7 @@ char *LYParseTagParam(char *from, char *string = from; do { - if ((string = strchr(string, ';')) == NULL) + if ((string = StrChr(string, ';')) == NULL) return NULL; while (*string != '\0' && (*string == ';' || isspace(UCH(*string)))) { string++; @@ -2426,7 +2426,7 @@ void LYHandleMETA(HTStructured * me, const BOOL *present, not that it matters much. avoid setting it here. - kw */ if (track_internal_links && (StrNCmp(href, "http", 4) == 0) && - (cp = strchr(href, '#')) != NULL) { + (cp = StrChr(href, '#')) != NULL) { StrAllocCopy(id_string, cp); *cp = '\0'; } @@ -2493,7 +2493,7 @@ void LYHandleMETA(HTStructured * me, const BOOL *present, if (*cp != '\0') { StrAllocCopy(me->node_anchor->SugFname, cp); if (*me->node_anchor->SugFname == '"') { - if ((cp = strchr((me->node_anchor->SugFname + 1), + if ((cp = StrChr((me->node_anchor->SugFname + 1), '"')) != NULL) { *(cp + 1) = '\0'; HTMIME_TrimDoubleQuotes(me->node_anchor->SugFname); @@ -2694,7 +2694,7 @@ void LYHandleSELECT(HTStructured * me, const BOOL *present, if (!(present && present[HTML_SELECT_NAME] && non_empty(value[HTML_SELECT_NAME]))) { StrAllocCopy(name, ""); - } else if (strchr(value[HTML_SELECT_NAME], '&') == NULL) { + } else if (StrChr(value[HTML_SELECT_NAME], '&') == NULL) { StrAllocCopy(name, value[HTML_SELECT_NAME]); } else { StrAllocCopy(name, value[HTML_SELECT_NAME]); @@ -2894,12 +2894,12 @@ int LYLegitimizeHREF(HTStructured * me, char **href, * it may actually have blanks in the name. * Try to accommodate. See also HTParse(). */ - if (LYRemoveNewlines(p) || strchr(p, '\t') != 0) { + if (LYRemoveNewlines(p) || StrChr(p, '\t') != 0) { LYRemoveBlanks(p); /* a compromise... */ } if (pound != NULL) { - p = strchr(p, '\0'); + p = StrChr(p, '\0'); *pound = '#'; /* restore */ convert_to_spaces(pound, FALSE); if (p < pound) @@ -3300,7 +3300,7 @@ BOOLEAN LYCommentHacks(HTParentAnchor *anchor, FREE(messageid); return FALSE; } - if ((p = strchr(messageid, '@')) == NULL || p[1] == '\0') { + if ((p = StrChr(messageid, '@')) == NULL || p[1] == '\0') { FREE(messageid); return FALSE; } diff --git a/src/LYCookie.c b/src/LYCookie.c index 9b89a9f4..04ee12fd 100644 --- a/src/LYCookie.c +++ b/src/LYCookie.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYCookie.c,v 1.127 2011/06/11 12:35:50 tom Exp $ + * $LynxId: LYCookie.c,v 1.128 2013/11/28 11:18:12 tom Exp $ * * Lynx Cookie Support LYCookie.c * =================== @@ -215,7 +215,7 @@ static void LYCookieJar_free(void) static BOOLEAN has_embedded_dot(char *value) { BOOLEAN result = NO; - char *first_dot = strchr(value, '.'); + char *first_dot = StrChr(value, '.'); if (first_dot != NULL && first_dot[1] != '\0') { result = YES; @@ -438,7 +438,7 @@ static void store_cookie(cookie * co, const char *hostname, /* * The hostname does not contain a dot. */ - if (strchr(hostname, '.') == NULL) { + if (StrChr(hostname, '.') == NULL) { CTrace((tfp, "store_cookie: Rejecting because '%s' has no dot.\n", hostname)); freeCookie(co); @@ -500,7 +500,7 @@ static void store_cookie(cookie * co, const char *hostname, * INVCHECK_QUERY. */ ptr = ((hostname + strlen(hostname)) - strlen(co->domain)); - if (strchr(hostname, '.') < ptr) { + if (StrChr(hostname, '.') < ptr) { invcheck_behaviour_t invcheck_bv = (de ? de->invcheck_bv : DEFAULT_INVCHECK_BV); @@ -982,7 +982,7 @@ static unsigned parse_attribute(unsigned flags, */ if (value[0] != '.' && value[0] != '\0' && value[1] != '\0' && strcasecomp(value, hostname)) { - char *ptr = strchr(value, '.'); + char *ptr = StrChr(value, '.'); if (ptr != NULL && ptr[1] != '\0') { ptr = value; @@ -1779,7 +1779,7 @@ void LYSetCookie(const char *SetCookie, * cookie(s) only if LYSetCookies is TRUE. - FM */ if (((hostname = HTParse(address, "", PARSE_HOST)) != NULL) && - (ptr = strchr(hostname, ':')) != NULL) { + (ptr = StrChr(hostname, ':')) != NULL) { /* * Replace default port number. */ @@ -1798,7 +1798,7 @@ void LYSetCookie(const char *SetCookie, * Trim off any parameters to provide something that we can compare * against the cookie's path for verifying if it has the proper prefix. */ - if ((ptr = strchr(path, '?')) != NULL) { + if ((ptr = StrChr(path, '?')) != NULL) { CTrace((tfp, "discarding params \"%s\" in request URI\n", ptr)); *ptr = '\0'; } diff --git a/src/LYCurses.c b/src/LYCurses.c index 1f9c7a00..c4c5e0f4 100644 --- a/src/LYCurses.c +++ b/src/LYCurses.c @@ -1,4 +1,4 @@ -/* $LynxId: LYCurses.c,v 1.177 2013/10/20 16:24:43 tom Exp $ */ +/* $LynxId: LYCurses.c,v 1.178 2013/11/28 11:52:34 tom Exp $ */ #include #include @@ -1750,13 +1750,15 @@ void stop_curses(void) /* ifdef's for non-Unix curses or slang */ #if defined(__MINGW32__) - chtype bb; + { + chtype bb; - bb = getbkgd(stdscr); - bkgdset(0); - clear(); - refresh(); - bkgdset(bb); + bb = getbkgd(stdscr); + bkgdset(0); + clear(); + refresh(); + bkgdset(bb); + } #if defined(PDCURSES) endwin(); #endif /* PDCURSES */ diff --git a/src/LYEdit.c b/src/LYEdit.c index 0b1780bb..ee0b8329 100644 --- a/src/LYEdit.c +++ b/src/LYEdit.c @@ -1,4 +1,4 @@ -/* $LynxId: LYEdit.c,v 1.41 2010/09/24 00:07:26 tom Exp $ */ +/* $LynxId: LYEdit.c,v 1.42 2013/11/28 11:18:19 tom Exp $ */ #include #include #include @@ -119,7 +119,7 @@ int edit_current_file(char *newfile, if (StrNCmp(newfile, "file://localhost/", 16) == 0) colon = newfile + 16; else - colon = strchr(newfile, ':'); + colon = StrChr(newfile, ':'); StrAllocCopy(filename, (colon + 1)); HTUnEscape(filename); if (!LYCanReadFile(filename)) { @@ -230,7 +230,7 @@ void edit_temporary_file(char *filename, #endif else { #ifdef _WINDOWS - if (strchr(editor, ' ')) + if (StrChr(editor, ' ')) HTAddXpand(&command, format, params++, HTDOS_short_name(editor)); else HTAddXpand(&command, format, params++, editor); diff --git a/src/LYEditmap.c b/src/LYEditmap.c index 7786f508..653f7080 100644 --- a/src/LYEditmap.c +++ b/src/LYEditmap.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYEditmap.c,v 1.71 2013/10/20 20:03:24 tom Exp $ + * $LynxId: LYEditmap.c,v 1.72 2013/11/28 11:18:33 tom Exp $ * * LYEditMap.c * Keybindings for line and form editing. @@ -1695,7 +1695,7 @@ static void checkEditMap(LYEditConfig * table) if (Non_Empty(what)) { sprintf(comment, "\t/* %s%s */", what, - ((strchr(what, '_') != 0) + ((StrChr(what, '_') != 0) ? "" : "_KEY")); } else { diff --git a/src/LYExtern.c b/src/LYExtern.c index f0a7c84d..846b652c 100644 --- a/src/LYExtern.c +++ b/src/LYExtern.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYExtern.c,v 1.52 2013/05/04 13:01:06 tom Exp $ + * $LynxId: LYExtern.c,v 1.53 2013/11/28 11:18:33 tom Exp $ * External application support. This feature allows lynx to pass a given URL to an external program. @@ -78,7 +78,7 @@ static void delete_danger_characters(char *src) char *dst; for (dst = src; *src != '\0'; src++) { - if (strchr("<>|%\"", *src) == NULL) { + if (StrChr("<>|%\"", *src) == NULL) { *dst = *src; dst++; } @@ -99,14 +99,14 @@ static char *escapeParameter(CONST char *parameter) char *needs_escaped_NT = "%&^"; for (i = 0; i < last; ++i) { - if (strchr(needs_encoded, parameter[i]) != NULL) { + if (StrChr(needs_encoded, parameter[i]) != NULL) { ++encoded; } if (system_is_NT) { - if (strchr(needs_escaped_NT, parameter[i]) != NULL) { + if (StrChr(needs_escaped_NT, parameter[i]) != NULL) { ++escaped; } - } else if (strchr(needs_escaped, parameter[i]) != NULL) { + } else if (StrChr(needs_escaped, parameter[i]) != NULL) { ++escaped; } } @@ -117,18 +117,18 @@ static char *escapeParameter(CONST char *parameter) n = 0; for (i = 0; i < last; i++) { - if (strchr(needs_encoded, parameter[i]) != NULL) { + if (StrChr(needs_encoded, parameter[i]) != NULL) { sprintf(result + n, "%%%02X", (unsigned char) parameter[i]); n += 3; continue; } if (system_is_NT) { - if (strchr(needs_escaped_NT, parameter[i]) != NULL) { + if (StrChr(needs_escaped_NT, parameter[i]) != NULL) { result[n++] = '^'; result[n++] = parameter[i]; continue; } - } else if (strchr(needs_escaped, parameter[i]) != NULL) { + } else if (StrChr(needs_escaped, parameter[i]) != NULL) { result[n++] = '%'; /* parameter[i] is '%' */ result[n++] = parameter[i]; continue; @@ -197,7 +197,7 @@ static char *format_command(char *command, p = param + 17; delete_danger_characters(p); *e_buff = 0; - if (strchr(p, ':') == NULL) { + if (StrChr(p, ':') == NULL) { sprintf(e_buff, "%.3s/", windows_drive); } strncat(e_buff, p, sizeof(e_buff) - strlen(e_buff) - 1); diff --git a/src/LYGetFile.c b/src/LYGetFile.c index 866d780e..af926301 100644 --- a/src/LYGetFile.c +++ b/src/LYGetFile.c @@ -1,4 +1,4 @@ -/* $LynxId: LYGetFile.c,v 1.91 2013/10/19 01:08:57 tom Exp $ */ +/* $LynxId: LYGetFile.c,v 1.92 2013/11/28 11:18:56 tom Exp $ */ #include #include #include /* Anchor class */ @@ -144,7 +144,7 @@ int getfile(DocInfo *doc, int *target) strlen(temp) > 3) { char *cp1; - if ((cp1 = strchr(temp, '@')) == NULL) + if ((cp1 = StrChr(temp, '@')) == NULL) cp1 = temp; if ((cp = strrchr(cp1, ':')) != NULL) { long int value; @@ -382,8 +382,8 @@ int getfile(DocInfo *doc, int *target) LYNoRefererForThis = TRUE; } if (LYNoRefererForThis == FALSE && - (cp = strchr(ref_url, '?')) != NULL && - strchr(cp, '=') != NULL) { + (cp = StrChr(ref_url, '?')) != NULL && + StrChr(cp, '=') != NULL) { /* * Don't send a Referer header if the URL is the reply from a * form with method GET, in case the content has personal data @@ -544,7 +544,7 @@ int getfile(DocInfo *doc, int *target) title = ""; } } - cp = strchr(doc->address, ':') + 1; + cp = StrChr(doc->address, ':') + 1; reply_by_mail(cp, ((HTMainAnchor && !LYUserSpecifiedURL) ? (char *) HTMainAnchor->address @@ -589,7 +589,7 @@ int getfile(DocInfo *doc, int *target) if (!telnet_ok) { HTUserMsg(TELNET_DISABLED); return (NULLFILE); - } else if (no_telnet_port && strchr(doc->address + 7, ':')) { + } else if (no_telnet_port && StrChr(doc->address + 7, ':')) { HTUserMsg(TELNET_PORT_SPECS_DISABLED); return (NULLFILE); /* @@ -660,7 +660,7 @@ int getfile(DocInfo *doc, int *target) * already attached then do this. Otherwise just load it! */ } else if (url_type == INDEX_GOPHER_URL_TYPE && - strchr(doc->address, '?') == NULL) { + StrChr(doc->address, '?') == NULL) { int status; /* @@ -718,7 +718,7 @@ int getfile(DocInfo *doc, int *target) /* * If tuple's Path=GET%20/... convert to an http URL. */ - if ((cp = strchr(doc->address + 9, '/')) != NULL && + if ((cp = StrChr(doc->address + 9, '/')) != NULL && 0 == StrNCmp(++cp, "hGET%20/", 8)) { StrAllocCopy(tmp, "http://"); CTRACE((tfp, "getfile: URL '%s'\n", @@ -728,7 +728,7 @@ int getfile(DocInfo *doc, int *target) /* * If the port is defaulted, it should stay 70. */ - if (strchr(tmp + 6, ':') == NULL) { + if (StrChr(tmp + 6, ':') == NULL) { StrAllocCat(tmp, "70/"); tmp[strlen(tmp) - 4] = ':'; } @@ -1340,7 +1340,7 @@ void add_trusted(char *str, first = FALSE; } - path = strchr(src, '\t'); + path = StrChr(src, '\t'); if (path) { *path++ = '\0'; after_tab = path; @@ -1398,11 +1398,11 @@ BOOLEAN exec_ok(const char *source, /* * Security: reject on relative path. */ - if ((cp = strchr(linktext, '[')) != NULL) { + if ((cp = StrChr(linktext, '[')) != NULL) { char *cp1; - if (((cp1 = strchr(cp, '-')) != NULL) && - strchr(cp1, ']') != NULL) { + if (((cp1 = StrChr(cp, '-')) != NULL) && + StrChr(cp1, ']') != NULL) { while (cp1[1] == '-') cp1++; if (cp1[1] == ']' || @@ -1429,7 +1429,7 @@ BOOLEAN exec_ok(const char *source, else allowed_extra_chars = " _-:./@~$+=\t"; for (cp = linktext; *cp != '\0'; cp++) { - if (!isalnum(UCH(*cp)) && !strchr(allowed_extra_chars, *cp)) { + if (!isalnum(UCH(*cp)) && !StrChr(allowed_extra_chars, *cp)) { char *buf = 0; HTSprintf0(&buf, @@ -1516,7 +1516,7 @@ static int fix_httplike_urls(DocInfo *doc, UrlTypes type) } else if (type == NCFTP_URL_TYPE) { char *path = NULL; char *first = doc->address; - char *second = strchr(first, ':'); + char *second = StrChr(first, ':'); CTRACE((tfp, "fix_httplike_urls: URL '%s'\n", doc->address)); if (second == 0) @@ -1541,7 +1541,7 @@ static int fix_httplike_urls(DocInfo *doc, UrlTypes type) } if (type == HTTP_URL_TYPE || type == HTTPS_URL_TYPE) { - if ((slash - 2) != strchr(doc->address, ':')) { + if ((slash - 2) != StrChr(doc->address, ':')) { /* * Turns out we were not looking at the right slash after all, * there must have been more than one "://" which is valid at @@ -1550,7 +1550,7 @@ static int fix_httplike_urls(DocInfo *doc, UrlTypes type) */ return (0); } - if (strchr(doc->address, '?')) { + if (StrChr(doc->address, '?')) { /* * If there is a question mark that appears to be part of the * hostname, don't append anything either. Leave it to HTParse diff --git a/src/LYJump.c b/src/LYJump.c index 70886b8a..ebe09d61 100644 --- a/src/LYJump.c +++ b/src/LYJump.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYJump.c,v 1.48 2013/10/13 20:23:07 tom Exp $ + * $LynxId: LYJump.c,v 1.49 2013/11/28 11:19:08 tom Exp $ */ #include #include @@ -258,7 +258,7 @@ char *LYJump(int key) return NULL; } #ifdef PERMIT_GOTO_FROM_JUMP - if (strchr(bp, ':') || strchr(bp, '/')) { + if (StrChr(bp, ':') || StrChr(bp, '/')) { char *temp = NULL; LYJumpFileURL = FALSE; @@ -448,7 +448,7 @@ static unsigned LYRead_Jumpfile(struct JumpTable *jtp) /* quick scan for approximate number of entries */ nel = 0; cp = mp; - while ((cp = strchr(cp, '\n')) != NULL) { + while ((cp = StrChr(cp, '\n')) != NULL) { nel++; cp++; } @@ -463,7 +463,7 @@ static unsigned LYRead_Jumpfile(struct JumpTable *jtp) cp = jtp->mp = mp; for (i = 0; i < nel;) { if (StrNCmp(cp, "