diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2013-11-28 11:57:39 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2013-11-28 11:57:39 -0500 |
commit | 422b94378f762167eddba4f1874260f057d184bb (patch) | |
tree | c5284628f5b15a0ac0d857fb8bcb60a5797bf0ce /WWW | |
parent | 44b428bb55ea5ccb0739bcca2131934a676b6344 (diff) | |
download | lynx-snapshots-422b94378f762167eddba4f1874260f057d184bb.tar.gz |
snapshot of project "lynx", label v2-8-8dev_16x
Diffstat (limited to 'WWW')
25 files changed, 237 insertions, 214 deletions
diff --git a/WWW/Library/Implementation/HTAABrow.c b/WWW/Library/Implementation/HTAABrow.c index 8e8a375a..f1d3c313 100644 --- a/WWW/Library/Implementation/HTAABrow.c +++ b/WWW/Library/Implementation/HTAABrow.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTAABrow.c,v 1.39 2013/07/21 00:14:39 tom Exp $ + * $LynxId: HTAABrow.c,v 1.40 2013/11/28 11:11:05 tom Exp $ * * MODULE HTAABrow.c * BROWSER SIDE ACCESS AUTHORIZATION MODULE @@ -1079,7 +1079,7 @@ BOOL HTAA_shouldRetryWithAuth(char *start_of_headers, while (NULL != (line = HTAA_getUnfoldedLine()) && *line != '\0') { CTRACE((tfp, "%s\n", line)); - if (strchr(line, ':')) { /* Valid header line */ + if (StrChr(line, ':')) { /* Valid header line */ char *p = line; char *fieldname = HTNextField(&p); diff --git a/WWW/Library/Implementation/HTAAProt.c b/WWW/Library/Implementation/HTAAProt.c index 45f654a3..03243815 100644 --- a/WWW/Library/Implementation/HTAAProt.c +++ b/WWW/Library/Implementation/HTAAProt.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTAAProt.c,v 1.32 2010/04/29 09:30:57 tom Exp $ + * $LynxId: HTAAProt.c,v 1.33 2013/11/28 11:11:05 tom Exp $ * * MODULE HTAAProt.c * PROTECTION FILE PARSING MODULE @@ -169,7 +169,7 @@ static void HTAA_setIds(HTAAProt *prot, const char *ids) char *point; StrAllocCopy(local_copy, ids); - point = strchr(local_copy, '.'); + point = StrChr(local_copy, '.'); if (point) { *(point++) = (char) 0; StrAllocCopy(prot->gid_name, point); diff --git a/WWW/Library/Implementation/HTAccess.c b/WWW/Library/Implementation/HTAccess.c index cfb5a450..be142e83 100644 --- a/WWW/Library/Implementation/HTAccess.c +++ b/WWW/Library/Implementation/HTAccess.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTAccess.c,v 1.78 2013/04/30 22:59:03 tom Exp $ + * $LynxId: HTAccess.c,v 1.79 2013/11/28 11:11:05 tom Exp $ * * Access Manager HTAccess.c * ============== @@ -267,7 +267,7 @@ BOOL override_proxy(const char *addr) FREE(host); return NO; } - Host = (((at = strchr(host, '@')) != NULL) ? (at + 1) : host); + Host = (((at = StrChr(host, '@')) != NULL) ? (at + 1) : host); if ((acc_method = HTParse(addr, "", PARSE_ACCESS))) { if (!strcmp("file", acc_method) && @@ -1310,7 +1310,7 @@ BOOL HTSearch(const char *keywords, } } /* Loop over string */ *q = '\0'; /* Terminate escaped string */ - u = strchr(address, '?'); /* Find old search string */ + u = StrChr(address, '?'); /* Find old search string */ if (u != NULL) *u = '\0'; /* Chop old search off */ diff --git a/WWW/Library/Implementation/HTAnchor.c b/WWW/Library/Implementation/HTAnchor.c index 1b160691..616b69c4 100644 --- a/WWW/Library/Implementation/HTAnchor.c +++ b/WWW/Library/Implementation/HTAnchor.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTAnchor.c,v 1.75 2013/10/02 23:24:34 tom Exp $ + * $LynxId: HTAnchor.c,v 1.76 2013/11/28 11:34:24 tom Exp $ * * Hypertext "Anchor" Object HTAnchor.c * ========================== @@ -239,7 +239,7 @@ static HTChildAnchor *HTAnchor_findNamedChild(HTParentAnchor0 *parent, */ HTChildAnchor sample; - sample.tag = (char *) tag; /* for compare_anchors() only */ + sample.tag = DeConst(tag); /* for compare_anchors() only */ child = (HTChildAnchor *) HTBTree_search(parent->children, &sample); if (child != NULL) { @@ -511,7 +511,7 @@ HTParentAnchor *HTAnchor_findSimpleAddress(const char *url) { DocAddress urldoc; - urldoc.address = (char *) url; /* ignore warning, it IS treated like const - kw */ + urldoc.address = DeConst(url); /* ignore warning, it IS treated like const - kw */ urldoc.post_data = NULL; urldoc.post_content_type = NULL; urldoc.bookmark = NULL; diff --git a/WWW/Library/Implementation/HTAtom.c b/WWW/Library/Implementation/HTAtom.c index d01455ca..3a96ba4e 100644 --- a/WWW/Library/Implementation/HTAtom.c +++ b/WWW/Library/Implementation/HTAtom.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTAtom.c,v 1.18 2010/09/25 11:43:12 tom Exp $ + * $LynxId: HTAtom.c,v 1.19 2013/11/28 11:11:05 tom Exp $ * * Atoms: Names to numbers HTAtom.c * ======================= @@ -146,7 +146,7 @@ static BOOL mime_match(const char *name, StrAllocCopy(n1, name); /* These also free the ones */ StrAllocCopy(t1, templ); /* from previous call. */ - if (!(n2 = strchr(n1, '/')) || !(t2 = strchr(t1, '/'))) + if (!(n2 = StrChr(n1, '/')) || !(t2 = StrChr(t1, '/'))) return NO; *(n2++) = (char) 0; diff --git a/WWW/Library/Implementation/HTDOS.c b/WWW/Library/Implementation/HTDOS.c index 582a7626..84bff793 100644 --- a/WWW/Library/Implementation/HTDOS.c +++ b/WWW/Library/Implementation/HTDOS.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTDOS.c,v 1.39 2011/06/04 18:45:09 tom Exp $ + * $LynxId: HTDOS.c,v 1.40 2013/11/28 11:11:05 tom Exp $ * DOS specific routines */ @@ -170,7 +170,7 @@ char *HTDOS_short_name(const char *path) char *ret; DWORD r; - if (strchr(path, '/')) + if (StrChr(path, '/')) path = HTDOS_name(path); r = GetShortPathName(path, sbuf, sizeof sbuf); if (r >= sizeof(sbuf) || r == 0) { diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c index 5653cd69..3bab9ba3 100644 --- a/WWW/Library/Implementation/HTFTP.c +++ b/WWW/Library/Implementation/HTFTP.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTFTP.c,v 1.124 2013/10/11 09:21:37 tom Exp $ + * $LynxId: HTFTP.c,v 1.125 2013/11/28 11:11:05 tom Exp $ * * File Transfer Protocol (FTP) Client * for a WorldWideWeb browser @@ -324,7 +324,7 @@ char *HTVMS_name(const char *nn, char *r; strcpy(nodename, nn); - r = strchr(nodename, '.'); /* Mismatch */ + r = StrChr(nodename, '.'); /* Mismatch */ if (r) *r = '\0'; /* Chop domain */ strcat(nodename, "::"); /* Try decnet anyway */ @@ -333,7 +333,7 @@ char *HTVMS_name(const char *nn, } } - second = strchr(filename + 1, '/'); /* 2nd slash */ + second = StrChr(filename + 1, '/'); /* 2nd slash */ last = strrchr(filename, '/'); /* last slash */ if (!second) { /* Only one slash */ @@ -350,7 +350,7 @@ char *HTVMS_name(const char *nn, HTSprintf0(&vmsname, "%s%s:[%s]%s", nodename, filename + 1, second + 1, last + 1); *second = *last = '/'; /* restore filename */ - if ((p = strchr(vmsname, '[')) != 0) { + if ((p = StrChr(vmsname, '[')) != 0) { while (*p != '\0' && *p != ']') { if (*p == '/') *p = '.'; /* Convert dir sep. to dots */ @@ -689,7 +689,7 @@ static void get_ftp_pwd(eServerType *ServerType, BOOLEAN *UseList) if (status < 0) { return; } else { - cp = strchr(response_text + 5, '"'); + cp = StrChr(response_text + 5, '"'); if (cp) *cp = '\0'; if (*ServerType == TCPC_SERVER) { @@ -845,7 +845,7 @@ static int get_connection(const char *arg, username = p1; *p2 = '\0'; /* terminate */ p1 = p2 + 1; /* point to host */ - pw = strchr(username, ':'); + pw = StrChr(username, ':'); if (pw != NULL) { *pw++ = '\0'; password = HTUnEscape(pw); @@ -971,7 +971,7 @@ static int get_connection(const char *arg, the_address = "WWWuser"; StrAllocCopy(user, the_address); - if ((cp = strchr(user, '@')) != NULL) { + if ((cp = StrChr(user, '@')) != NULL) { *cp++ = '\0'; if (*cp == '\0') host = HTHostName(); @@ -985,7 +985,7 @@ static int get_connection(const char *arg, * If host is not fully qualified, suppress it * as ftp.uu.net prefers a blank to a bad name */ - if (!(host) || strchr(host, '.') == NULL) + if (!(host) || StrChr(host, '.') == NULL) host = ""; HTSprintf0(&command, "PASS %s@%s%c%c", user, host, CR, LF); @@ -1664,7 +1664,7 @@ static void parse_ls_line(char *line, /* * Extract the file-permissions, as a string. */ - if ((cp = strchr(line, ' ')) != 0) { + if ((cp = StrChr(line, ' ')) != 0) { if ((cp - line) == 10) { *cp = '\0'; StrAllocCopy(entry->file_mode, line); @@ -1687,7 +1687,7 @@ static void parse_ls_line(char *line, */ while (isspace(UCH(*cp))) ++cp; - if ((next = strchr(cp, ' ')) != 0) + if ((next = StrChr(cp, ' ')) != 0) *next = '\0'; if (*cp != '\0') StrAllocCopy(entry->file_user, cp); @@ -1698,7 +1698,7 @@ static void parse_ls_line(char *line, cp = (next + 1); while (isspace(UCH(*cp))) ++cp; - if ((next = strchr(cp, ' ')) != 0) + if ((next = StrChr(cp, ' ')) != 0) *next = '\0'; if (*cp != '\0') StrAllocCopy(entry->file_group, cp); @@ -1827,7 +1827,7 @@ static void parse_vms_dir_entry(char *line, /* Get rid of blank lines, and information lines. Valid lines have the ';' * version number token. */ - if (!strlen(line) || (cp = strchr(line, ';')) == NULL) { + if (!strlen(line) || (cp = StrChr(line, ';')) == NULL) { entry_info->display = FALSE; return; } @@ -1866,7 +1866,7 @@ static void parse_vms_dir_entry(char *line, /* Convert any tabs in rest of line to spaces. */ cps = cp - 1; - while ((cps = strchr(cps + 1, '\t')) != NULL) + while ((cps = StrChr(cps + 1, '\t')) != NULL) *cps = ' '; /* Collapse serial spaces. */ @@ -1887,7 +1887,7 @@ static void parse_vms_dir_entry(char *line, } /* Track down the date. */ - if ((cpd = strchr(cp, '-')) != NULL && + if ((cpd = StrChr(cp, '-')) != NULL && strlen(cpd) > 9 && isdigit(UCH(*(cpd - 1))) && isalpha(UCH(*(cpd + 1))) && *(cpd + 4) == '-') { @@ -1914,7 +1914,7 @@ static void parse_vms_dir_entry(char *line, } /* Track down the size */ - if ((cpd = strchr(cp, '/')) != NULL) { + if ((cpd = StrChr(cp, '/')) != NULL) { /* Appears be in used/allocated format */ cps = cpd; while (isdigit(UCH(*(cps - 1)))) @@ -2153,7 +2153,7 @@ static void parse_cms_dir_entry(char *line, cps = LYSkipNonBlanks(cp); *cps++ = '\0'; StrAllocCopy(entry_info->filename, cp); - if (strchr(entry_info->filename, '.') != NULL) + if (StrChr(entry_info->filename, '.') != NULL) /* If we already have a dot, we did an NLST. */ return; cp = LYSkipBlanks(cps); @@ -2220,7 +2220,7 @@ static void parse_cms_dir_entry(char *line, /* Track down the date. */ cpd = cps; if (((cps < end) && - (cps = strchr(cpd, ':')) != NULL) && + (cps = StrChr(cpd, ':')) != NULL) && (cps < (end - 3) && isdigit(UCH(*(cps + 1))) && isdigit(UCH(*(cps + 2))) && *(cps + 3) == ':')) { cps += 3; @@ -2301,7 +2301,7 @@ static EntryInfo *parse_dir_entry(char *entry, len = (int) strlen(entry); if (!len || entry[0] == ' ' || (len >= 24 && entry[23] != ' ') || - (len < 24 && strchr(entry, ' '))) { + (len < 24 && StrChr(entry, ' '))) { server_type = UNIX_SERVER; CTRACE((tfp, "HTFTP: Falling back to treating as Unix server.\n")); @@ -3564,7 +3564,7 @@ int HTFTPLoad(const char *name, char *cp2 = NULL; char *fn = NULL; - if ((cp2 = strchr((filename + 1), '/')) != NULL) { + if ((cp2 = StrChr((filename + 1), '/')) != NULL) { *cp2 = '\0'; } status = send_cmd_1("PWD"); @@ -3667,8 +3667,8 @@ int HTFTPLoad(const char *name, BOOL found_tilde = FALSE; /* Accept only Unix-style filename */ - if (strchr(filename, ':') != NULL || - strchr(filename, '[') != NULL) { + if (StrChr(filename, ':') != NULL || + StrChr(filename, '[') != NULL) { FREE(fname); init_help_message_cache(); /* to free memory */ NETCLOSE(control->socket); @@ -3696,7 +3696,7 @@ int HTFTPLoad(const char *name, if (status != 2) { char *dotslash = 0; - if ((cp1 = strchr(cp, '[')) != NULL) { + if ((cp1 = StrChr(cp, '[')) != NULL) { *cp1++ = '\0'; status = send_cwd(cp); if (status != 2) { @@ -3724,9 +3724,9 @@ int HTFTPLoad(const char *name, return ((status < 0) ? status : -status); } } - } else if ((cp1 = strchr(cp, ':')) != NULL && - strchr(cp, '[') == NULL && - strchr(cp, ']') == NULL) { + } else if ((cp1 = StrChr(cp, ':')) != NULL && + StrChr(cp, '[') == NULL && + StrChr(cp, ']') == NULL) { cp1++; if (*cp1 != '\0') { int cplen = (int) (cp1 - cp); @@ -3787,13 +3787,13 @@ int HTFTPLoad(const char *name, return ((status < 0) ? status : -status); } /* Go to the VMS account's top directory */ - if ((cp = strchr(response_text, '[')) != NULL && + if ((cp = StrChr(response_text, '[')) != NULL && (cp1 = strrchr(response_text, ']')) != NULL) { char *tmp = 0; unsigned len = 4; StrAllocCopy(tmp, cp); - if ((cp2 = strchr(cp, '.')) != NULL && cp2 < cp1) { + if ((cp2 = StrChr(cp, '.')) != NULL && cp2 < cp1) { len += (cp2 - cp); } else { len += (cp1 - cp); @@ -3839,7 +3839,7 @@ int HTFTPLoad(const char *name, } CTRACE((tfp, "check '%s' to translate x/y/ to [.x.y]\n", filename)); if (!included_device && - (cp = strchr(filename, '/')) != NULL && + (cp = StrChr(filename, '/')) != NULL && (cp1 = strrchr(cp, '/')) != NULL && (cp1 - cp) > 1) { char *tmp = 0; @@ -3878,10 +3878,10 @@ int HTFTPLoad(const char *name, */ if ((strlen(filename) == 1 && *filename == '/') || ((0 == strncasecomp((filename + 1), "vmsysu:", 7)) && - (cp = strchr((filename + 1), '.')) != NULL && - strchr(cp, '/') == NULL) || + (cp = StrChr((filename + 1), '.')) != NULL && + StrChr(cp, '/') == NULL) || (0 == strncasecomp(filename + 1, "anonymou.", 9) && - strchr(filename + 1, '/') == NULL)) { + StrChr(filename + 1, '/') == NULL)) { if (filename[1] != '\0') { status = send_cwd(filename + 1); if (status != 2) { @@ -3911,7 +3911,7 @@ int HTFTPLoad(const char *name, filename++; /* Otherwise, go to appropriate directory and adjust filename */ - while ((cp = strchr(filename, '/')) != NULL) { + while ((cp = StrChr(filename, '/')) != NULL) { *cp++ = '\0'; status = send_cwd(filename); if (status == 2) { diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c index 9a1c7120..8882ba77 100644 --- a/WWW/Library/Implementation/HTFile.c +++ b/WWW/Library/Implementation/HTFile.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTFile.c,v 1.136 2013/05/01 10:48:11 tom Exp $ + * $LynxId: HTFile.c,v 1.139 2013/11/28 11:33:56 tom Exp $ * * File Access HTFile.c * =========== @@ -816,8 +816,8 @@ const char *HTFileSuffix(HTAtom *rep, has more dots or asterisks after that, for these systems - kw */ (!suff->suffix || !suff->suffix[0] || suff->suffix[0] != '.' || - (strchr(suff->suffix + 1, '.') == NULL && - strchr(suff->suffix + 1, '*') == NULL)) && + (StrChr(suff->suffix + 1, '.') == NULL && + StrChr(suff->suffix + 1, '*') == NULL)) && #endif ((trivial_enc && IsUnityEnc(suff->encoding)) || (!trivial_enc && !IsUnityEnc(suff->encoding) && @@ -851,7 +851,7 @@ const char *HTFileSuffix(HTAtom *rep, static const char *VMS_trim_version(const char *filename) { const char *result = filename; - const char *version = strchr(filename, ';'); + const char *version = StrChr(filename, ';'); if (version != 0) { static char *stripped; @@ -944,7 +944,7 @@ HTFormat HTFileFormat(const char *filename, /* defaults tree */ - suff = (strchr(filename, '.') + suff = (StrChr(filename, '.') ? (unknown_suffix.rep ? &unknown_suffix : &no_suffix) @@ -980,7 +980,7 @@ HTFormat HTCharsetFormat(HTFormat format, FREE(anchor->charset); StrAllocCopy(cp, format->name); LYLowerCase(cp); - if (((cp1 = strchr(cp, ';')) != NULL) && + if (((cp1 = StrChr(cp, ';')) != NULL) && (cp2 = strstr(cp1, "charset")) != NULL) { CTRACE((tfp, "HTCharsetFormat: Extended MIME Content-Type is %s\n", format->name)); @@ -1247,22 +1247,22 @@ CompressFileType HTCompressFileType(const char *filename, if ((len > 4) && !strcasecomp((ftype - 3), "bz2") - && strchr(dots, ftype[-4]) != 0) { + && StrChr(dots, ftype[-4]) != 0) { result = cftBzip2; ftype -= 4; } else if ((len > 3) && !strcasecomp((ftype - 2), "gz") - && strchr(dots, ftype[-3]) != 0) { + && StrChr(dots, ftype[-3]) != 0) { result = cftGzip; ftype -= 3; } else if ((len > 3) && !strcasecomp((ftype - 2), "zz") - && strchr(dots, ftype[-3]) != 0) { + && StrChr(dots, ftype[-3]) != 0) { result = cftDeflate; ftype -= 3; } else if ((len > 2) && !strcmp((ftype - 1), "Z") - && strchr(dots, ftype[-2]) != 0) { + && StrChr(dots, ftype[-2]) != 0) { result = cftCompress; ftype -= 2; } @@ -1663,10 +1663,10 @@ BOOL HTDirTitles(HTStructured * target, HTParentAnchor *anchor, PUTC('\n'); #endif /* DIRED_SUPPORT */ if (((0 == strncasecomp(printable, "vmsysu:", 7)) && - (cp = strchr(printable, '.')) != NULL && - strchr(cp, '/') == NULL) || + (cp = StrChr(printable, '.')) != NULL && + StrChr(cp, '/') == NULL) || (0 == strncasecomp(printable, "anonymou.", 9) && - strchr(printable, '/') == NULL)) { + StrChr(printable, '/') == NULL)) { FREE(printable); FREE(path); return (need_parent_link); @@ -1831,7 +1831,7 @@ static const char *file_type(const char *path) while (*path == '.') ++path; - type = strchr(path, '.'); + type = StrChr(path, '.'); if (type == NULL) type = ""; return type; @@ -2318,17 +2318,37 @@ static BOOL isGzipStream(FILE *fp) return result; } +/* + * Strictly speaking, DEFLATE has no header bytes. But decode what we can, + * (to eliminate the one "reserved" pattern) and provide a trace. See RFC-1951 + * discussion of BFINAL and BTYPE. + */ static BOOL isDeflateStream(FILE *fp) { char buffer[3]; - BOOL result; + BOOL result = FALSE; - if (sniffStream(fp, buffer, sizeof(buffer)) - && !MemCmp(buffer, "\170\234", sizeof(buffer) - 1)) { - result = TRUE; - } else { - CTRACE((tfp, "not a deflate-stream\n")); - result = FALSE; + if (sniffStream(fp, buffer, sizeof(buffer))) { + int bit1 = ((buffer[0] >> 0) & 1); + int bit2 = ((buffer[0] >> 1) & 1); + int bit3 = ((buffer[0] >> 2) & 1); + int btype = ((bit3 << 1) + bit2); + + if (!MemCmp(buffer, "\170\234", sizeof(buffer) - 1)) { + result = TRUE; + CTRACE((tfp, "isDeflate: assume zlib-wrapped deflate\n")); + } else if (btype == 3) { + CTRACE((tfp, "isDeflate: not a deflate-stream\n")); + } else { + CTRACE((tfp, "isDeflate: %send block, %s compression\n", + (bit1 ? "" : "non-"), + (btype == 0 + ? "no" + : (btype == 1 + ? "static Huffman" + : "dynamic Huffman")))); + result = TRUE; + } } return result; } @@ -2394,7 +2414,7 @@ static int decompressAndParse(HTParentAnchor *anchor, * Assume that the file is in Unix-style syntax if it contains a '/' after * the leading one. @@ */ - localname = (strchr(localname + 1, '/') + localname = (StrChr(localname + 1, '/') ? HTVMS_name(nodename, localname) : localname + 1); #endif /* VMS */ @@ -3244,7 +3264,7 @@ void HTInitProgramPaths(BOOL init) } test = HTGetProgramPath(code); if (test != NULL && test != path) { - free((char *) test); + free(DeConst(test)); } if (init) { HTSetProgramPath(code, path); diff --git a/WWW/Library/Implementation/HTFinger.c b/WWW/Library/Implementation/HTFinger.c index ebf18db7..566761a0 100644 --- a/WWW/Library/Implementation/HTFinger.c +++ b/WWW/Library/Implementation/HTFinger.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTFinger.c,v 1.30 2013/01/04 21:40:19 tom Exp $ + * $LynxId: HTFinger.c,v 1.31 2013/11/28 11:27:50 tom Exp $ * * FINGER ACCESS HTFinger.c * ============= @@ -219,7 +219,7 @@ static int response(char *command, else { StrAllocCopy(href, l); start_anchor(strtok(href, " \r\n\t,>)\"")); - while (*l && !strchr(" \r\n\t,>)\"", *l)) + while (*l && !StrChr(" \r\n\t,>)\"", *l)) PUTC(*l++); END(HTML_A); FREE(href); @@ -289,7 +289,7 @@ int HTLoadFinger(const char *arg, if (param == 0) { HTAlert(COULD_NOT_LOAD_DATA); return HT_NOT_LOADED; - } else if ((slash = strchr(sitename, '/')) != NULL) { + } else if ((slash = StrChr(sitename, '/')) != NULL) { *slash++ = '\0'; HTUnEscape(slash); if (IsGopherURL) { @@ -301,7 +301,7 @@ int HTLoadFinger(const char *arg, } } - if ((at_sign = strchr(sitename, '@')) != NULL) { + if ((at_sign = StrChr(sitename, '@')) != NULL) { if (IsGopherURL) { HTAlert(COULD_NOT_LOAD_DATA); return HT_NOT_LOADED; /* FAIL */ @@ -345,7 +345,7 @@ int HTLoadFinger(const char *arg, } else if (at_sign) { HTSprintf0(&command, "%s%c%c", username, CR, LF); } else if (*username == '/') { - if ((slash = strchr((username + 1), '/')) != NULL) { + if ((slash = StrChr((username + 1), '/')) != NULL) { *slash = ' '; } HTSprintf0(&command, "%s%c%c", username, CR, LF); @@ -360,7 +360,7 @@ int HTLoadFinger(const char *arg, } else if ((*username == 'w' || *username == 'W') && *(username + 1) == '\0') { HTSprintf0(&command, "/%s%c%c", username, CR, LF); - } else if ((slash = strchr(username, '/')) != NULL) { + } else if ((slash = StrChr(username, '/')) != NULL) { *slash++ = '\0'; if (*slash == 'w' || *slash == 'W') { HTSprintf0(&command, "/w %s%c%c", username, CR, LF); diff --git a/WWW/Library/Implementation/HTFormat.c b/WWW/Library/Implementation/HTFormat.c index 94a7bfd7..f0a667c5 100644 --- a/WWW/Library/Implementation/HTFormat.c +++ b/WWW/Library/Implementation/HTFormat.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTFormat.c,v 1.81 2013/10/01 23:43:39 tom Exp $ + * $LynxId: HTFormat.c,v 1.82 2013/11/28 11:12:32 tom Exp $ * * Manage different file formats HTFormat.c * ============================= @@ -328,7 +328,7 @@ int HTGetSSLCharacter(void *handle) */ static int half_match(char *trial_type, char *target) { - char *cp = strchr(trial_type, '/'); + char *cp = StrChr(trial_type, '/'); /* if no '/' or no '*' */ if (!cp || *(cp + 1) != '*') diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c index cf51b023..665006a4 100644 --- a/WWW/Library/Implementation/HTGopher.c +++ b/WWW/Library/Implementation/HTGopher.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTGopher.c,v 1.60 2013/05/01 22:20:13 tom Exp $ + * $LynxId: HTGopher.c,v 1.61 2013/11/28 11:12:32 tom Exp $ * * GOPHER ACCESS HTGopher.c * ============= @@ -284,7 +284,7 @@ static void parse_menu(const char *arg GCC_UNUSED, if (gtype && *p) { name = p; - selector = strchr(name, TAB); + selector = StrChr(name, TAB); if (selector) { *selector++ = '\0'; /* Terminate name */ /* @@ -296,15 +296,15 @@ static void parse_menu(const char *arg GCC_UNUSED, if (gtype == GOPHER_TEXT && (*selector == GOPHER_BINARY || *selector == GOPHER_PCBINARY)) gtype = *selector; - host = strchr(selector, TAB); + host = StrChr(selector, TAB); if (host) { *host++ = '\0'; /* Terminate selector */ - port = strchr(host, TAB); + port = StrChr(host, TAB); if (port) { char *junk; port[0] = ':'; /* delimit host a la W3 */ - junk = strchr(port, TAB); + junk = StrChr(port, TAB); if (junk) *junk = '\0'; /* Chop port */ if ((port[1] == '0') && (!port[2])) @@ -532,9 +532,9 @@ static void parse_cso(const char *arg, * Find the second_colon. */ second_colon = NULL; - first_colon = strchr(p, ':'); + first_colon = StrChr(p, ':'); if (first_colon != NULL) { - second_colon = strchr(first_colon + 1, ':'); + second_colon = StrChr(first_colon + 1, ':'); } if (second_colon != NULL) { /* error check */ @@ -1366,7 +1366,7 @@ static int generate_cso_report(HTStream *Target) StrAllocCopy(href, l); StrAllocCat(buf, strtok(href, " \r\n\t,>)\"")); StrAllocCat(buf, "\">"); - while (*l && !strchr(" \r\n\t,>)\"", *l)) { + while (*l && !StrChr(" \r\n\t,>)\"", *l)) { HTSprintf(&buf, "%c", *l++); } StrAllocCat(buf, "</a>"); @@ -1410,7 +1410,7 @@ static int generate_cso_report(HTStream *Target) StrAllocCopy(href, l); StrAllocCat(buf, strtok(href, " \r\n\t,>)\"")); StrAllocCat(buf, "\">"); - while (*l && !strchr(" \r\n\t,>)\"", *l)) { + while (*l && !StrChr(" \r\n\t,>)\"", *l)) { HTSprintf(&buf, "%c", *l++); } StrAllocCat(buf, "</a>"); @@ -1761,7 +1761,7 @@ static int HTLoadGopher(const char *arg, * Search is allowed. */ HTAnchor_setIndex(anAnchor, anAnchor->address); - query = strchr(selector, '?'); /* Look for search string */ + query = StrChr(selector, '?'); /* Look for search string */ if (!query || !query[1]) { /* No search required */ target = HTML_new(anAnchor, format_out, sink); targetClass = *target->isa; @@ -1796,7 +1796,7 @@ static int HTLoadGopher(const char *arg, /* * Search is allowed. */ - query = strchr(selector, '?'); /* Look for search string */ + query = StrChr(selector, '?'); /* Look for search string */ if (!query || !query[1]) { /* No search required */ target = HTML_new(anAnchor, format_out, sink); targetClass = *target->isa; diff --git a/WWW/Library/Implementation/HTGroup.c b/WWW/Library/Implementation/HTGroup.c index 34c8b32e..e2e39791 100644 --- a/WWW/Library/Implementation/HTGroup.c +++ b/WWW/Library/Implementation/HTGroup.c @@ -531,9 +531,9 @@ static BOOL ip_number_match(const char *ctemplate, for (cnt = 0; cnt < 4; cnt++) { if (!tcur || !icur || !part_match(tcur, icur)) return NO; - if (NULL != (tcur = strchr(tcur, '.'))) + if (NULL != (tcur = StrChr(tcur, '.'))) tcur++; - if (NULL != (icur = strchr(icur, '.'))) + if (NULL != (icur = StrChr(icur, '.'))) icur++; } return YES; diff --git a/WWW/Library/Implementation/HTMIME.c b/WWW/Library/Implementation/HTMIME.c index 66bdd567..702326a6 100644 --- a/WWW/Library/Implementation/HTMIME.c +++ b/WWW/Library/Implementation/HTMIME.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTMIME.c,v 1.87 2013/05/05 20:07:25 tom Exp $ + * $LynxId: HTMIME.c,v 1.88 2013/11/28 11:12:52 tom Exp $ * * MIME Message Parse HTMIME.c * ================== @@ -278,7 +278,7 @@ static int pumpData(HTStream *me) me->format = HTAtom_for(me->value); } - if (strchr(HTAtom_name(me->format), ';') != NULL) { + if (StrChr(HTAtom_name(me->format), ';') != NULL) { char *cp = NULL, *cp1, *cp2, *cp3 = NULL, *cp4; CTRACE((tfp, "HTMIME: Extended MIME Content-Type is %s\n", @@ -294,7 +294,7 @@ static int pumpData(HTStream *me) * charset parameter we check. - FM */ LYLowerCase(cp); - if ((cp1 = strchr(cp, ';')) != NULL) { + if ((cp1 = StrChr(cp, ';')) != NULL) { BOOL chartrans_ok = NO; if ((cp2 = strstr(cp1, "charset")) != NULL) { @@ -727,7 +727,7 @@ static int dispatchField(HTStream *me) break; StrAllocCopy(me->anchor->SugFname, cp); if (*me->anchor->SugFname == '"') { - if ((cp = strchr((me->anchor->SugFname + 1), + if ((cp = StrChr((me->anchor->SugFname + 1), '"')) != NULL) { *(cp + 1) = '\0'; HTMIME_TrimDoubleQuotes(me->anchor->SugFname); @@ -2331,7 +2331,7 @@ static void HTmmdec_base64(char **t, count = 3; for (j = 0; j <= count; j++) { - if (!(p = strchr(HTmm64, s[j]))) { + if (!(p = StrChr(HTmm64, s[j]))) { FREE(buf); return; } @@ -2368,13 +2368,13 @@ static void HTmmdec_quote(char **t, for (bp = buf; *s;) { if (*s == '=') { cval = 0; - if (s[1] && (p = strchr(HTmmquote, s[1]))) { + if (s[1] && (p = StrChr(HTmmquote, s[1]))) { cval = (char) (cval + (char) (p - HTmmquote)); } else { *bp++ = *s++; continue; } - if (s[2] && (p = strchr(HTmmquote, s[2]))) { + if (s[2] && (p = StrChr(HTmmquote, s[2]))) { cval = (char) (cval << 4); cval = (char) (cval + (p - HTmmquote)); *bp++ = cval; @@ -2477,7 +2477,7 @@ int HTrjis(char **t, char *buf = NULL; int kanji = 0; - if (strchr(s, CH_ESC) || !strchr(s, '$')) { + if (StrChr(s, CH_ESC) || !StrChr(s, '$')) { if (s != *t) StrAllocCopy(*t, s); return 1; diff --git a/WWW/Library/Implementation/HTMLGen.c b/WWW/Library/Implementation/HTMLGen.c index b345c9d3..60d77469 100644 --- a/WWW/Library/Implementation/HTMLGen.c +++ b/WWW/Library/Implementation/HTMLGen.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTMLGen.c,v 1.39 2013/05/03 20:53:46 tom Exp $ + * $LynxId: HTMLGen.c,v 1.40 2013/11/28 11:13:46 tom Exp $ * * HTML Generator * ============== @@ -214,7 +214,7 @@ static void HTMLGen_put_character(HTStructured * me, int c) char *p; strcpy(delims, ",;:."); /* @@ english bias */ - p = strchr(delims, me->write_pointer[-2]); + p = StrChr(delims, me->write_pointer[-2]); if (p) new_cleanness = (int) (p - delims + 6); if (!me->in_attrval) @@ -417,11 +417,11 @@ static int HTMLGen_start_element(HTStructured * me, int element_number, if (value[i]) { me->preformatted = was_preformatted; me->in_attrval = YES; - if (strchr(value[i], '"') == NULL) { + if (StrChr(value[i], '"') == NULL) { HTMLGen_put_string(me, "=\""); HTMLGen_put_string(me, value[i]); HTMLGen_put_character(me, '"'); - } else if (strchr(value[i], '\'') == NULL) { + } else if (StrChr(value[i], '\'') == NULL) { HTMLGen_put_string(me, "='"); HTMLGen_put_string(me, value[i]); HTMLGen_put_character(me, '\''); diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c index b4ea9291..669f3a99 100644 --- a/WWW/Library/Implementation/HTNews.c +++ b/WWW/Library/Implementation/HTNews.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTNews.c,v 1.69 2011/06/11 12:10:55 tom Exp $ + * $LynxId: HTNews.c,v 1.70 2013/11/28 11:13:46 tom Exp $ * * NEWS ACCESS HTNews.c * =========== @@ -253,7 +253,7 @@ static BOOL initialize(void) char server_name[MAXHOSTNAMELEN + 1]; if (fgets(server_name, (int) sizeof server_name, fp) != NULL) { - char *p = strchr(server_name, '\n'); + char *p = StrChr(server_name, '\n'); if (p != NULL) *p = '\0'; @@ -666,7 +666,7 @@ static char *author_address(char *email) } if ((p = strrchr(address, '(')) && - (e = strrchr(address, ')')) && (at = strchr(address, '@'))) { + (e = strrchr(address, ')')) && (at = StrChr(address, '@'))) { if (e > p && at < e) { *p = '\0'; /* Chop off everything after the ')' */ return HTStrip(address); /* Remove leading and trailing spaces */ @@ -856,8 +856,8 @@ static BOOLEAN valid_header(char *line) * Just check for initial letter, colon, and space to make sure we discard * only invalid headers. */ - colon = strchr(line, ':'); - space = strchr(line, ' '); + colon = StrChr(line, ':'); + space = StrChr(line, ' '); if (isalpha(UCH(line[0])) && colon && space == colon + 1) return (TRUE); @@ -902,7 +902,7 @@ static void post_article(char *postfile) buf[0] = '\0'; sprintf(crlf, "%c%c", CR, LF); while (fgets(line, (int) sizeof(line) - 2, fd) != NULL) { - if ((cp = strchr(line, '\n')) != NULL) + if ((cp = StrChr(line, '\n')) != NULL) *cp = '\0'; if (line[0] == '.') { /* @@ -1100,32 +1100,32 @@ static int read_article(HTParentAnchor *thisanchor) break; /* End of Header? */ } else if (match(full_line, "SUBJECT:")) { - StrAllocCopy(subject, HTStrip(strchr(full_line, ':') + 1)); + StrAllocCopy(subject, HTStrip(StrChr(full_line, ':') + 1)); decode_mime(&subject); } else if (match(full_line, "DATE:")) { - StrAllocCopy(date, HTStrip(strchr(full_line, ':') + 1)); + StrAllocCopy(date, HTStrip(StrChr(full_line, ':') + 1)); } else if (match(full_line, "ORGANIZATION:")) { StrAllocCopy(organization, - HTStrip(strchr(full_line, ':') + 1)); + HTStrip(StrChr(full_line, ':') + 1)); decode_mime(&organization); } else if (match(full_line, "FROM:")) { - StrAllocCopy(from, HTStrip(strchr(full_line, ':') + 1)); + StrAllocCopy(from, HTStrip(StrChr(full_line, ':') + 1)); decode_mime(&from); } else if (match(full_line, "REPLY-TO:")) { - StrAllocCopy(replyto, HTStrip(strchr(full_line, ':') + 1)); + StrAllocCopy(replyto, HTStrip(StrChr(full_line, ':') + 1)); decode_mime(&replyto); } else if (match(full_line, "NEWSGROUPS:")) { - StrAllocCopy(newsgroups, HTStrip(strchr(full_line, ':') + 1)); + StrAllocCopy(newsgroups, HTStrip(StrChr(full_line, ':') + 1)); } else if (match(full_line, "REFERENCES:")) { - StrAllocCopy(references, HTStrip(strchr(full_line, ':') + 1)); + StrAllocCopy(references, HTStrip(StrChr(full_line, ':') + 1)); } else if (match(full_line, "FOLLOWUP-TO:")) { - StrAllocCopy(followupto, HTStrip(strchr(full_line, ':') + 1)); + StrAllocCopy(followupto, HTStrip(StrChr(full_line, ':') + 1)); } else if (match(full_line, "MESSAGE-ID:")) { char *msgid = HTStrip(full_line + 11); @@ -1159,7 +1159,7 @@ static int read_article(HTParentAnchor *thisanchor) StrAllocCopy(temp, author_address(replyto ? replyto : from)); StrAllocCopy(href, STR_MAILTO_URL); - if (strchr(temp, '%') || strchr(temp, '?')) { + if (StrChr(temp, '%') || StrChr(temp, '?')) { cp = HTEscape(temp, URL_XPALPHAS); StrAllocCat(href, cp); FREE(cp); @@ -1247,16 +1247,16 @@ static int read_article(HTParentAnchor *thisanchor) /* sanitize some headers - kw */ if (newsgroups && - ((cp = strchr(newsgroups, '/')) || - (cp = strchr(newsgroups, '(')))) { + ((cp = StrChr(newsgroups, '/')) || + (cp = StrChr(newsgroups, '(')))) { *cp = '\0'; } if (newsgroups && !*newsgroups) { FREE(newsgroups); } if (followupto && - ((cp = strchr(followupto, '/')) || - (cp = strchr(followupto, '(')))) { + ((cp = StrChr(followupto, '/')) || + (cp = StrChr(followupto, '(')))) { *cp = '\0'; } if (followupto && !*followupto) { @@ -1313,10 +1313,10 @@ static int read_article(HTParentAnchor *thisanchor) if (*href == 'n' && (ccp = HTAnchor_messageID(thisanchor)) && *ccp) { StrAllocCat(href, ";ref="); - if (strchr(ccp, '<') || strchr(ccp, '&') || - strchr(ccp, ' ') || strchr(ccp, ':') || - strchr(ccp, '/') || strchr(ccp, '%') || - strchr(ccp, ';')) { + if (StrChr(ccp, '<') || StrChr(ccp, '&') || + StrChr(ccp, ' ') || StrChr(ccp, ':') || + StrChr(ccp, '/') || StrChr(ccp, '%') || + StrChr(ccp, ';')) { char *cp1 = HTEscape(ccp, URL_XPALPHAS); StrAllocCat(href, cp1); @@ -1332,7 +1332,7 @@ static int read_article(HTParentAnchor *thisanchor) END(HTML_B); PUTC(' '); start_anchor(href); - if (strchr((followupto ? followupto : newsgroups), ',')) { + if (StrChr((followupto ? followupto : newsgroups), ',')) { PUTS("newsgroups"); } else { PUTS("newsgroup"); @@ -1474,7 +1474,7 @@ static int read_article(HTParentAnchor *thisanchor) } else { StrAllocCopy(href, l); start_anchor(strtok(href, " \r\n\t,>)\"")); - while (*l && !strchr(" \r\n\t,>)\"", *l)) + while (*l && !StrChr(" \r\n\t,>)\"", *l)) PUTC(*l++); END(HTML_A); FREE(href); @@ -1513,7 +1513,7 @@ static int read_article(HTParentAnchor *thisanchor) else { StrAllocCopy(href, l); start_anchor(strtok(href, " \r\n\t,>)\"")); - while (*l && !strchr(" \r\n\t,>)\"", *l)) + while (*l && !StrChr(" \r\n\t,>)\"", *l)) PUTC(*l++); END(HTML_A); FREE(href); @@ -1629,8 +1629,8 @@ static int read_list(char *arg) } else if (WHITE(ch)) { ch = LF; /* May treat as line without description */ skip_this_line = YES; /* ...and ignore until LF */ - } else if (strchr(line, ' ') == NULL && - strchr(line, '\t') == NULL) { + } else if (StrChr(line, ' ') == NULL && + StrChr(line, '\t') == NULL) { /* No separator found */ CTRACE((tfp, "HTNews..... group name too long, discarding.\n")); skip_this_line = YES; /* ignore whole line */ @@ -1857,7 +1857,7 @@ static int read_group(const char *groupName, /* * Normal lines are scanned for references to articles. */ - char *space = strchr(line, ' '); + char *space = StrChr(line, ' '); if (space++) write_anchor(space, space); @@ -1983,7 +1983,7 @@ static int read_group(const char *groupName, if (match(line, "FROM:")) { char *p2; - StrAllocCopy(author, strchr(line, ':') + 1); + StrAllocCopy(author, StrChr(line, ':') + 1); decode_mime(&author); p2 = author + strlen(author) - 1; if (*p2 == LF) @@ -1995,7 +1995,7 @@ static int read_group(const char *groupName, case 'D': if (LYListNewsDates && match(line, "DATE:")) { StrAllocCopy(date, - HTStrip(strchr(line, ':') + 1)); + HTStrip(StrChr(line, ':') + 1)); } break; @@ -2199,13 +2199,13 @@ static int HTLoadNews(const char *arg, strstr(arg, "newsreply:") != NULL); group_wanted = (BOOL) ((!(spost_wanted || sreply_wanted || post_wanted || reply_wanted) && - strchr(arg, '@') == NULL) && - (strchr(arg, '*') == NULL)); + StrChr(arg, '@') == NULL) && + (StrChr(arg, '*') == NULL)); list_wanted = (BOOL) ((!(spost_wanted || sreply_wanted || post_wanted || reply_wanted || group_wanted) && - strchr(arg, '@') == NULL) && - (strchr(arg, '*') != NULL)); + StrChr(arg, '@') == NULL) && + (StrChr(arg, '*') != NULL)); #ifndef USE_SSL if (!strncasecomp(arg, "snewspost:", 10) || @@ -2273,7 +2273,7 @@ static int HTLoadNews(const char *arg, !strcmp((arg + 5), "//") || !strcmp((arg + 5), "///"))) || ((!StrNCmp((arg + 5), "//", 2)) && - (!(cp = strchr((arg + 7), '/')) || *(cp + 1) == '\0'))) { + (!(cp = StrChr((arg + 7), '/')) || *(cp + 1) == '\0'))) { p1 = "*"; group_wanted = FALSE; list_wanted = TRUE; @@ -2307,7 +2307,7 @@ static int HTLoadNews(const char *arg, !strcmp((arg + 6), "//") || !strcmp((arg + 6), "///"))) || ((!StrNCmp((arg + 6), "//", 2)) && - (!(cp = strchr((arg + 8), '/')) || *(cp + 1) == '\0'))) { + (!(cp = StrChr((arg + 8), '/')) || *(cp + 1) == '\0'))) { p1 = "*"; group_wanted = FALSE; list_wanted = TRUE; @@ -2343,7 +2343,7 @@ static int HTLoadNews(const char *arg, !strcmp((arg + 6), "/") || !strcmp((arg + 6), "//")) || ((*(arg + 6) == '/') && - (!(cp = strchr((arg + 7), '/')) || *(cp + 1) == '\0'))) { + (!(cp = StrChr((arg + 7), '/')) || *(cp + 1) == '\0'))) { p1 = "*"; group_wanted = FALSE; list_wanted = TRUE; @@ -2446,7 +2446,7 @@ static int HTLoadNews(const char *arg, } SnipIn(command, "XGTITLE %.*s", 11, p1); } else if (group_wanted) { - char *slash = strchr(p1, '/'); + char *slash = StrChr(p1, '/'); first = 0; last = 0; @@ -2462,7 +2462,7 @@ static int HTLoadNews(const char *arg, *slash = '/'; (void) sscanf(slash + 1, "%d-%d", &first, &last); if ((first > 0) && (isdigit(UCH(*(slash + 1)))) && - (strchr(slash + 1, '-') == NULL || first == last)) { + (StrChr(slash + 1, '-') == NULL || first == last)) { /* * We got a number greater than 0, which will be loaded as * first, and either no range or the range computes to @@ -2483,8 +2483,8 @@ static int HTLoadNews(const char *arg, } SnipIn(command, "GROUP %.*s", 9, groupName); } else { - size_t add_open = (size_t) (strchr(p1, '<') == 0); - size_t add_close = (size_t) (strchr(p1, '>') == 0); + size_t add_open = (size_t) (StrChr(p1, '<') == 0); + size_t add_close = (size_t) (StrChr(p1, '>') == 0); if (strlen(p1) + add_open + add_close >= 252) { FREE(ProxyHost); diff --git a/WWW/Library/Implementation/HTParse.c b/WWW/Library/Implementation/HTParse.c index 0338dfd4..34ce64b1 100644 --- a/WWW/Library/Implementation/HTParse.c +++ b/WWW/Library/Implementation/HTParse.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTParse.c,v 1.70 2012/02/09 19:57:37 tom Exp $ + * $LynxId: HTParse.c,v 1.71 2013/11/28 11:14:12 tom Exp $ * * Parse HyperText Document Address HTParse.c * ================================ @@ -138,12 +138,12 @@ static void scan(char *name, if (p[1] == '/') { parts->host = (p + 2); /* host has been specified */ *p = '\0'; /* Terminate access */ - p = strchr(parts->host, '/'); /* look for end of host name if any */ + p = StrChr(parts->host, '/'); /* look for end of host name if any */ if (p != NULL) { *p = '\0'; /* Terminate host */ parts->absolute = (p + 1); /* Root has been found */ } else { - p = strchr(parts->host, '?'); + p = StrChr(parts->host, '?'); if (p != NULL) { *p = '\0'; /* Terminate host */ parts->search = (p + 1); @@ -161,7 +161,7 @@ static void scan(char *name, * Check schemes that commonly have unescaped hashes. */ if (parts->access && parts->anchor && - /* optimize */ strchr("lnsdLNSD", *parts->access) != NULL) { + /* optimize */ StrChr("lnsdLNSD", *parts->access) != NULL) { if ((!parts->host && strcasecomp(parts->access, "lynxcgi")) || !strcasecomp(parts->access, "nntp") || !strcasecomp(parts->access, "snews") || @@ -193,7 +193,7 @@ static void scan(char *name, static char *strchr_or_end(char *string, int ch) { - char *result = strchr(string, ch); + char *result = StrChr(string, ch); if (result == 0) { result = string + strlen(string); @@ -483,7 +483,7 @@ char *HTParse(const char *aName, char *p2, *h; int portnumber; - if ((p2 = strchr(result, '@')) != NULL) + if ((p2 = StrChr(result, '@')) != NULL) tail = (p2 + 1); p2 = HTParsePort(result, &portnumber); if (p2 != NULL && acc_method != NULL) { @@ -627,7 +627,7 @@ char *HTParse(const char *aName, } /* otherwise fall through to RFC 1808 part 4 step 6 */ else { - p = strchr(tail, '?'); /* Search part? */ + p = StrChr(tail, '?'); /* Search part? */ if (p == NULL) p = (tail + strlen(tail) - 1); for (; *p != '/'; p--) ; /* last / */ @@ -657,7 +657,7 @@ char *HTParse(const char *aName, CTRACE((tfp, "HTParse: (No inheritance)\n")); } if (want_detail) { - p = strchr(tail, '?'); /* Search part? */ + p = StrChr(tail, '?'); /* Search part? */ if (p) { if (PARSE_STRICTPATH) { *p = '\0'; @@ -691,7 +691,7 @@ char *HTParse(const char *aName, * If there are any blanks remaining in the string, escape them as needed. * See the discussion in LYLegitimizeHREF() for example. */ - if ((p = strchr(result, ' ')) != 0) { + if ((p = StrChr(result, ' ')) != 0) { switch (is_url(result)) { case UNKNOWN_URL_TYPE: CTRACE((tfp, "HTParse: ignore:`%s'\n", result)); @@ -726,7 +726,7 @@ char *HTParse(const char *aName, p[0] = HEX_ESCAPE; p[1] = '2'; p[2] = '0'; - } while ((p = strchr(result, ' ')) != 0); + } while ((p = StrChr(result, ' ')) != 0); break; } } @@ -820,7 +820,7 @@ void HTSimplify(char *filename) filename[0] == '?' || filename[1] == '?' || filename[2] == '?') return; - if (strchr(filename, '/') != NULL) { + if (StrChr(filename, '/') != NULL) { for (p = (filename + 2); *p; p++) { if (*p == '?') { /* @@ -1246,7 +1246,7 @@ char *HTUnEscapeSome(char *str, isxdigit(UCH(p[2])) && (testcode = (char) FROMASCII(from_hex(p[1]) * 16 + from_hex(p[2]))) && /* %00 no good */ - strchr(do_trans, testcode)) { /* it's one of the ones we want */ + StrChr(do_trans, testcode)) { /* it's one of the ones we want */ *q++ = testcode; p += 3; } else { diff --git a/WWW/Library/Implementation/HTRules.c b/WWW/Library/Implementation/HTRules.c index 5756c3a6..a9b6e9db 100644 --- a/WWW/Library/Implementation/HTRules.c +++ b/WWW/Library/Implementation/HTRules.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTRules.c,v 1.44 2013/05/03 09:42:04 tom Exp $ + * $LynxId: HTRules.c,v 1.45 2013/11/28 11:14:29 tom Exp $ * * Configuration manager for Hypertext Daemon HTRules.c * ========================================== @@ -296,7 +296,7 @@ char *HTTranslate(const char *required) case HT_AlwaysAlert: pMsg = r->equiv ? r->equiv : (r->op == HT_AlwaysAlert) ? "%s" : "Rule: %s"; - if (strchr(pMsg, '%')) { + if (StrChr(pMsg, '%')) { HTSprintf0(&msgtmp, pMsg, current); pMsg = msgtmp; } @@ -346,7 +346,7 @@ char *HTTranslate(const char *required) CTRACE((tfp, "For `%s' using `%s'\n", current, r->equiv)); StrAllocCopy(current, r->equiv); /* use entire translation */ } else { - char *ins = strchr(r->equiv, '*'); /* Insertion point */ + char *ins = StrChr(r->equiv, '*'); /* Insertion point */ if (ins) { /* Consistent rule!!! */ char *temp = NULL; @@ -468,7 +468,7 @@ int HTSetConfiguration(char *config) char *p = line; /* Chop off comments */ - while ((p = strchr(p, '#'))) { + while ((p = StrChr(p, '#'))) { if (p == line || isspace(UCH(*(p - 1)))) { *p = 0; break; @@ -620,7 +620,7 @@ int HTSetConfiguration(char *config) const char *cp = word3; char *cp1, *cp2; - while ((cp1 = strchr(cp, '%'))) { + while ((cp1 = StrChr(cp, '%'))) { if (cp1[1] == '\0') { *cp1 = '\0'; break; @@ -628,7 +628,7 @@ int HTSetConfiguration(char *config) cp = cp1 + 2; continue; } else - while ((cp2 = strchr(cp1 + 2, '%'))) { + while ((cp2 = StrChr(cp1 + 2, '%'))) { if (cp2[1] == '\0') { *cp2 = '\0'; break; diff --git a/WWW/Library/Implementation/HTString.c b/WWW/Library/Implementation/HTString.c index dcc9e793..3eb94a11 100644 --- a/WWW/Library/Implementation/HTString.c +++ b/WWW/Library/Implementation/HTString.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTString.c,v 1.71 2013/05/04 12:01:30 tom Exp $ + * $LynxId: HTString.c,v 1.72 2013/11/28 11:14:49 tom Exp $ * * Case-independent string comparison HTString.c * @@ -467,9 +467,9 @@ char *HTNextTok(char **pstr, if (!bracks) bracks = "<\""; - get_blanks = (BOOL) (!strchr(delims, ' ') && !strchr(bracks, ' ')); - get_comments = (BOOL) (strchr(bracks, '(') != NULL); - skip_comments = (BOOL) (!get_comments && !strchr(delims, '(') && !get_blanks); + get_blanks = (BOOL) (!StrChr(delims, ' ') && !StrChr(bracks, ' ')); + get_comments = (BOOL) (StrChr(bracks, '(') != NULL); + skip_comments = (BOOL) (!get_comments && !StrChr(delims, '(') && !get_blanks); #define skipWHITE(c) (!get_blanks && WHITE(c)) while (*p && skipWHITE(*p)) @@ -482,7 +482,7 @@ char *HTNextTok(char **pstr, } while (1) { /* Strip white space and other delimiters */ - while (*p && (skipWHITE(*p) || strchr(delims, *p))) + while (*p && (skipWHITE(*p) || StrChr(delims, *p))) p++; if (!*p) { *pstr = p; @@ -514,12 +514,12 @@ char *HTNextTok(char **pstr, if (*p) p++; if (get_closing_char_too) { - if (!*p || (!strchr(bracks, *p) && strchr(delims, *p))) { + if (!*p || (!StrChr(bracks, *p) && StrChr(delims, *p))) { break; } else - get_closing_char_too = (BOOL) (strchr(bracks, *p) != NULL); + get_closing_char_too = (BOOL) (StrChr(bracks, *p) != NULL); } - } else if (strchr(bracks, *p)) { /* quoted or bracketed field */ + } else if (StrChr(bracks, *p)) { /* quoted or bracketed field */ switch (*p) { case '<': closer = '>'; @@ -543,19 +543,19 @@ char *HTNextTok(char **pstr, p++; /* Skip escaped chars */ if (get_closing_char_too) { p++; - if (!*p || (!strchr(bracks, *p) && strchr(delims, *p))) { + if (!*p || (!StrChr(bracks, *p) && StrChr(delims, *p))) { break; } else - get_closing_char_too = (BOOL) (strchr(bracks, *p) != NULL); + get_closing_char_too = (BOOL) (StrChr(bracks, *p) != NULL); } else break; /* kr95-10-9: needs to stop here */ } else { /* Spool field */ if (!start) start = p; - while (*p && !skipWHITE(*p) && !strchr(bracks, *p) && - !strchr(delims, *p)) + while (*p && !skipWHITE(*p) && !StrChr(bracks, *p) && + !StrChr(delims, *p)) p++; - if (*p && strchr(bracks, *p)) { + if (*p && StrChr(bracks, *p)) { get_closing_char_too = TRUE; } else { if (*p == '(' && skip_comments) { @@ -965,7 +965,7 @@ char *HTQuoteParameter(const char *parameter) last = strlen(parameter); for (i = 0; i < last; ++i) - if (strchr("\\&#$^*?(){}<>\"';`|", parameter[i]) != 0 + if (StrChr("\\&#$^*?(){}<>\"';`|", parameter[i]) != 0 || isspace(UCH(parameter[i]))) ++quoted; diff --git a/WWW/Library/Implementation/HTString.h b/WWW/Library/Implementation/HTString.h index 86cd9382..f25dae41 100644 --- a/WWW/Library/Implementation/HTString.h +++ b/WWW/Library/Implementation/HTString.h @@ -1,5 +1,5 @@ /* - * $LynxId: HTString.h,v 1.37 2012/02/07 23:41:25 tom Exp $ + * $LynxId: HTString.h,v 1.38 2013/11/28 11:09:55 tom Exp $ * String handling for libwww * STRINGS * @@ -41,6 +41,11 @@ extern "C" { #define MemCmp(a,b,c) memcmp((a),(b),(size_t)(c)) /* + * Workaround for glibc header defect combined with -Wlogical-op warnings + */ +#define StrChr (strchr) + + /* * Case-insensitive string comparison * * The usual routines (comp instead of cmp) had some problem. diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c index 35680a12..105dde85 100644 --- a/WWW/Library/Implementation/HTTCP.c +++ b/WWW/Library/Implementation/HTTCP.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTTCP.c,v 1.127 2013/10/13 23:42:55 tom Exp $ + * $LynxId: HTTCP.c,v 1.128 2013/11/28 11:14:59 tom Exp $ * * Generic Communication Code HTTCP.c * ========================== @@ -1285,7 +1285,7 @@ static int HTParseInet(SockA * soc_in, const char *str) /* * Parse port number if present. */ - if ((port = strchr(host, ':')) != NULL) { + if ((port = StrChr(host, ':')) != NULL) { *port++ = 0; /* Chop off port */ strptr = port; if (port[0] >= '0' && port[0] <= '9') { @@ -1603,7 +1603,7 @@ static LYNX_ADDRINFO *HTGetAddrInfo(const char *str, StrAllocCopy(s, str); - if (s[0] == '[' && (p = strchr(s, ']')) != NULL) { + if (s[0] == '[' && (p = StrChr(s, ']')) != NULL) { *p++ = '\0'; host = s + 1; } else { @@ -1692,7 +1692,7 @@ static void get_host_details(void) * UCX doesn't give the complete domain name. Get rest from UCX$BIND_DOM * logical. */ - if (strchr(hostname, '.') == NULL) { /* Not full address */ + if (StrChr(hostname, '.') == NULL) { /* Not full address */ domain_name = LYGetEnv("UCX$BIND_DOMAIN"); if (domain_name == NULL) domain_name = LYGetEnv("TCPIP$BIND_DOMAIN"); @@ -1814,7 +1814,7 @@ int HTDoConnect(const char *url, * Get node name and optional port number. */ p1 = HTParse(url, "", PARSE_HOST); - if ((at_sign = strchr(p1, '@')) != NULL) { + if ((at_sign = StrChr(p1, '@')) != NULL) { /* * If there's an @ then use the stuff after it as a hostname. */ diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c index 5176ceb8..b0ef1912 100644 --- a/WWW/Library/Implementation/HTTP.c +++ b/WWW/Library/Implementation/HTTP.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTTP.c,v 1.132 2013/10/13 23:30:26 tom Exp $ + * $LynxId: HTTP.c,v 1.133 2013/11/28 11:15:11 tom Exp $ * * HyperText Tranfer Protocol - Client implementation HTTP.c * ========================== @@ -416,7 +416,7 @@ int ws_netread(int fd, char *buf, int len) static void strip_userid(char *host) { char *p1 = host; - char *p2 = strchr(host, '@'); + char *p2 = StrChr(host, '@'); char *fake; if (p2 != 0) { @@ -846,7 +846,7 @@ static int HTLoadHTTP(const char *arg, /* start of CommonName */ cert_host += 4; /* find next part of DistinguishedName */ - if ((p = strchr(cert_host, '/')) != NULL) { + if ((p = StrChr(cert_host, '/')) != NULL) { *p = '\0'; ssl_dn_start = p; /* yes this points to the NUL byte */ } else @@ -1642,7 +1642,7 @@ static int HTLoadHTTP(const char *arg, #endif } - eol = strchr(line_buffer + length, LF); + eol = StrChr(line_buffer + length, LF); /* Do we *really* want to do this? */ if (eol && eol != line_buffer && *(eol - 1) == CR) *(eol - 1) = ' '; diff --git a/WWW/Library/Implementation/HTTelnet.c b/WWW/Library/Implementation/HTTelnet.c index 4e01a912..fb0098a7 100644 --- a/WWW/Library/Implementation/HTTelnet.c +++ b/WWW/Library/Implementation/HTTelnet.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTTelnet.c,v 1.40 2013/01/04 21:42:42 tom Exp $ + * $LynxId: HTTelnet.c,v 1.41 2013/11/28 11:15:19 tom Exp $ * * Telnet Access, Rlogin, etc HTTelnet.c * ========================== @@ -79,7 +79,7 @@ static int remote_session(char *acc_method, char *host) * *cp=0; // terminate at any ;,<,>,`,|,",' or space or return * or tab to prevent security hole */ - for (cp = (strchr(host, '@') ? strchr(host, '@') : host); *cp != '\0'; + for (cp = (StrChr(host, '@') ? StrChr(host, '@') : host); *cp != '\0'; cp++) { if (!isalnum(UCH(*cp)) && *cp != '_' && *cp != '-' && *cp != ':' && *cp != '.' && *cp != '@') { @@ -88,7 +88,7 @@ static int remote_session(char *acc_method, char *host) } } - hostname = strchr(host, '@'); + hostname = StrChr(host, '@'); if (hostname) { *hostname++ = '\0'; /* Split */ @@ -97,7 +97,7 @@ static int remote_session(char *acc_method, char *host) user = NULL; /* No user specified */ } - port = strchr(hostname, ':'); + port = StrChr(hostname, ':'); if (port) *port++ = '\0'; /* Split */ @@ -120,7 +120,7 @@ static int remote_session(char *acc_method, char *host) } if (user) { - password = strchr(user, ':'); + password = StrChr(user, ':'); if (password) { *password++ = '\0'; } diff --git a/WWW/Library/Implementation/HTUtils.h b/WWW/Library/Implementation/HTUtils.h index 27086a4e..9bd760e5 100644 --- a/WWW/Library/Implementation/HTUtils.h +++ b/WWW/Library/Implementation/HTUtils.h @@ -1,5 +1,5 @@ /* - * $LynxId: HTUtils.h,v 1.118 2013/10/10 00:06:59 tom Exp $ + * $LynxId: HTUtils.h,v 1.119 2013/11/28 11:33:20 tom Exp $ * * Utility macros for the W3 code library * MACROS FOR GENERAL USE @@ -347,6 +347,8 @@ Standard C library for malloc() etc #define NULL ((void *)0) #endif +#define DeConst(p) (void *)(intptr_t)(p) + #define isEmpty(s) ((s) == 0 || *(s) == 0) #define non_empty(s) !isEmpty(s) diff --git a/WWW/Library/Implementation/HTVMSUtils.c b/WWW/Library/Implementation/HTVMSUtils.c index 5449ae95..e2789561 100644 --- a/WWW/Library/Implementation/HTVMSUtils.c +++ b/WWW/Library/Implementation/HTVMSUtils.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTVMSUtils.c,v 1.38 2013/05/03 20:32:37 tom Exp $ + * $LynxId: HTVMSUtils.c,v 1.39 2013/11/28 11:15:31 tom Exp $ * * MODULE HTVMSUtil.c * VMS Utility Routines @@ -168,7 +168,7 @@ BOOL HTVMS_checkAccess(const char *FileName, return (NO); /* check Filename and convert */ - colon = strchr(FileName, ':'); + colon = StrChr(FileName, ':'); if (colon) VmsName = HTVMS_name("", colon + 1); else @@ -245,7 +245,7 @@ const char *HTVMS_wwwName(const char *vmsname) dst = wwwname; src = vmsname; dir = 0; - if (strchr(src, ':')) + if (StrChr(src, ':')) *(dst++) = '/'; for (; *src != '\0'; src++) { switch (*src) { @@ -342,13 +342,13 @@ int HTStat(const char *filename, Name[Len - 1] = '\0'; /* fail in case of device */ - Ptr = strchr(Name + 1, '/'); + Ptr = StrChr(Name + 1, '/'); if ((Ptr == NULL) && (Name[0] == '/')) { /* device only... */ StrAllocCat(Name, "/000000/000000"); } if (Ptr != NULL) { /* correct filename in case of toplevel dir */ - Ptr2 = strchr(Ptr + 1, '/'); + Ptr2 = StrChr(Ptr + 1, '/'); if ((Ptr2 == NULL) && (Name[0] == '/')) { char End[256]; @@ -527,9 +527,9 @@ static struct dirent *HTVMSreaddir(DIR *dirp) if (!(status & 0x01)) return (0); if (HTVMSFileVersions) - space = strchr(VMSentry, ' '); + space = StrChr(VMSentry, ' '); else - space = strchr(VMSentry, ';'); + space = StrChr(VMSentry, ';'); if (space) *space = '\0'; @@ -747,7 +747,7 @@ int HTVMSBrowseDir(const char *address, * /sys$sysroot/syshlp) before calling this routine. */ if (((*pathname != '/') || - (cp = strchr(pathname + 1, '/')) == NULL || + (cp = StrChr(pathname + 1, '/')) == NULL || *(cp + 1) == '\0' || 0 == StrNCmp((cp + 1), "000000", 6)) || (dp = HTVMSopendir(pathname)) == NULL) { diff --git a/WWW/Library/Implementation/HTWAIS.c b/WWW/Library/Implementation/HTWAIS.c index 5e95e7dc..e24dd6ec 100644 --- a/WWW/Library/Implementation/HTWAIS.c +++ b/WWW/Library/Implementation/HTWAIS.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTWAIS.c,v 1.37 2013/05/03 20:53:27 tom Exp $ + * $LynxId: HTWAIS.c,v 1.38 2013/11/28 11:16:03 tom Exp $ * * WorldWideWeb - Wide Area Informaion Server Access HTWAIS.c * ================================================== @@ -239,7 +239,7 @@ static char *WWW_from_archie(char *file) return result; /* Malloc error */ strcpy(result, "file://"); StrNCat(result, file, end - file); - colon = strchr(result + 7, ':'); /* Expect colon after host */ + colon = StrChr(result + 7, ':'); /* Expect colon after host */ if (colon) { for (; colon[0]; colon[0] = colon[1], colon++) ; /* move down */ } @@ -360,11 +360,7 @@ static any *WAIS_from_WWW(any *docid, char *docname) return 0; q = p; -/* *z++ = *p++ - '0'; - q = strchr(p , '='); - if (!q) return 0; -*/ - s = strchr(q, ';'); /* (Check only) */ + s = StrChr(q, ';'); /* (Check only) */ if (!s) return 0; /* Bad! No ';'; */ sor = z; /* Remember where the size field was */ @@ -649,7 +645,7 @@ int HTLoadWAIS(const char *arg, * First we remove the "wais:" if it was specified. 920110 */ names = HTParse(arg, "", PARSE_HOST | PARSE_PATH | PARSE_PUNCTUATION); - key = strchr(names, '?'); + key = StrChr(names, '?'); if (key) { char *p; @@ -664,20 +660,20 @@ int HTLoadWAIS(const char *arg, the_server_name = names + 1; if ((as_gate = (*the_server_name == '/')) != 0) the_server_name++; /* Accept one or two */ - www_database = strchr(the_server_name, '/'); + www_database = StrChr(the_server_name, '/'); if (www_database) { *www_database++ = 0; /* Separate database name */ - doctype = strchr(www_database, '/'); + doctype = StrChr(www_database, '/'); if (key) ok = YES; /* Don't need doc details */ else if (doctype) { /* If not search parse doc details */ *doctype++ = 0; /* Separate rest of doc address */ - doclength = strchr(doctype, '/'); + doclength = StrChr(doctype, '/'); if (doclength) { *doclength++ = 0; document_length = atol(doclength); if (document_length) { - docname = strchr(doclength, '/'); + docname = StrChr(doclength, '/'); if (docname) { *docname++ = 0; ok = YES; /* To avoid a goto! */ @@ -697,7 +693,7 @@ int HTLoadWAIS(const char *arg, CTRACE((tfp, "HTWAIS: Parsed OK\n")); - service = strchr(names, ':'); + service = StrChr(names, ':'); if (service) *service++ = 0; else @@ -819,7 +815,7 @@ int HTLoadWAIS(const char *arg, HTStructured *target; LYStrNCpy(keywords, key, MAX_KEYWORDS_LENGTH); - while ((p = strchr(keywords, '+')) != 0) + while ((p = StrChr(keywords, '+')) != 0) *p = ' '; /* |