aboutsummaryrefslogtreecommitdiffstats
path: root/WWW/Library/Implementation
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1998-05-02 23:39:11 -0400
committerThomas E. Dickey <dickey@invisible-island.net>1998-05-02 23:39:11 -0400
commit62e34428d357f609be17a866638bedb45f935d8e (patch)
treee5921380a563c3d0a2fa7d1cee4524a9f26f3ad9 /WWW/Library/Implementation
parent2a94396ccd9cf5ade728c53e02cba28e06af4378 (diff)
downloadlynx-snapshots-62e34428d357f609be17a866638bedb45f935d8e.tar.gz
snapshot of project "lynx", label v2-8-1dev_8
Diffstat (limited to 'WWW/Library/Implementation')
-rw-r--r--WWW/Library/Implementation/HTAAUtil.c24
-rw-r--r--WWW/Library/Implementation/HTAccess.c41
-rw-r--r--WWW/Library/Implementation/HTAnchor.c6
-rw-r--r--WWW/Library/Implementation/HTAuth.c4
-rw-r--r--WWW/Library/Implementation/HTCJK.h6
-rw-r--r--WWW/Library/Implementation/HTFTP.c85
-rw-r--r--WWW/Library/Implementation/HTFile.c5
-rw-r--r--WWW/Library/Implementation/HTGopher.c5
-rw-r--r--WWW/Library/Implementation/HTMIME.c19
-rw-r--r--WWW/Library/Implementation/HTTP.c4
-rw-r--r--WWW/Library/Implementation/HTVMSUtils.c11
-rw-r--r--WWW/Library/Implementation/SGML.c9
12 files changed, 79 insertions, 140 deletions
diff --git a/WWW/Library/Implementation/HTAAUtil.c b/WWW/Library/Implementation/HTAAUtil.c
index 7857ec52..bbcbc508 100644
--- a/WWW/Library/Implementation/HTAAUtil.c
+++ b/WWW/Library/Implementation/HTAAUtil.c
@@ -1,4 +1,3 @@
-
/* MODULE HTAAUtil.c
** COMMON PARTS OF ACCESS AUTHORIZATION MODULE
** FOR BOTH SERVER AND BROWSER
@@ -52,6 +51,7 @@
#include <HTTCP.h>
#include <HTAlert.h>
+#include <LYStrings.h>
#include <LYLeaks.h>
/* PUBLIC HTAAScheme_enum()
@@ -67,17 +67,12 @@
PUBLIC HTAAScheme HTAAScheme_enum ARGS1(CONST char*, name)
{
char *upcased = NULL;
- char *cur;
if (!name)
return HTAA_UNKNOWN;
StrAllocCopy(upcased, name);
- cur = upcased;
- while (*cur) {
- *cur = TOUPPER(*cur);
- cur++;
- }
+ LYUpperCase(upcased);
if (!strncmp(upcased, "NONE", 4)) {
FREE(upcased);
@@ -149,23 +144,12 @@ PUBLIC char *HTAAScheme_name ARGS1(HTAAScheme, scheme)
*/
PUBLIC HTAAMethod HTAAMethod_enum ARGS1(CONST char *, name)
{
- char tmp[MAX_METHODNAME_LEN+1];
- CONST char *src = name;
- char *dest = tmp;
-
if (!name)
return METHOD_UNKNOWN;
- while (*src) {
- *dest = TOUPPER(*src);
- dest++;
- src++;
- }
- *dest = 0;
-
- if (0==strcmp(tmp, "GET"))
+ if (0==strcasecomp(name, "GET"))
return METHOD_GET;
- else if (0==strcmp(tmp, "PUT"))
+ else if (0==strcasecomp(name, "PUT"))
return METHOD_PUT;
else
return METHOD_UNKNOWN;
diff --git a/WWW/Library/Implementation/HTAccess.c b/WWW/Library/Implementation/HTAccess.c
index 90d446d9..4eea11b9 100644
--- a/WWW/Library/Implementation/HTAccess.c
+++ b/WWW/Library/Implementation/HTAccess.c
@@ -968,29 +968,30 @@ PRIVATE BOOL HTLoadDocument ARGS4(
return NO;
}
- if (status <= 0) { /* Failure in accessing a document */
- char *temp = NULL;
- StrAllocCopy(temp, "Can't Access `");
- StrAllocCat(temp, full_address);
- StrAllocCat(temp, "'");
- _HTProgress(temp);
- FREE(temp);
- CTRACE(tfp, "HTAccess: Can't access `%s'\n", full_address);
- HTLoadError(sink, 500, "Unable to access document.");
- return NO;
- }
-
- /*
- ** If you get this, then please find which routine is returning
- ** a positive unrecognised error code!
- */
- fprintf(tfp,
+ if (status > 0) {
+ /*
+ ** If you get this, then please find which routine is returning
+ ** a positive unrecognised error code!
+ */
+ fprintf(stderr,
"**** HTAccess: socket or file number returned by obsolete load routine!\n");
- fprintf(tfp,
+ fprintf(stderr,
"**** HTAccess: Internal software error. Please mail lynx_dev@sig.net!\n");
- fprintf(tfp, "**** HTAccess: Status returned was: %d\n",status);
- exit(-1);
+ fprintf(stderr, "**** HTAccess: Status returned was: %d\n",status);
+ exit(-1);
+ }
+ /* Failure in accessing a document */
+ cp = NULL;
+ StrAllocCopy(cp, "Can't Access `");
+ StrAllocCat(cp, full_address);
+ StrAllocCat(cp, "'");
+ _HTProgress(cp);
+ FREE(cp);
+
+ CTRACE(tfp, "HTAccess: Can't access `%s'\n", full_address);
+ HTLoadError(sink, 500, "Unable to access document.");
+ return NO;
} /* HTLoadDocument */
/* Load a document from absolute name. HTLoadAbsolute()
diff --git a/WWW/Library/Implementation/HTAnchor.c b/WWW/Library/Implementation/HTAnchor.c
index 14e258f6..a489eba2 100644
--- a/WWW/Library/Implementation/HTAnchor.c
+++ b/WWW/Library/Implementation/HTAnchor.c
@@ -44,10 +44,10 @@ PRIVATE int HASH_FUNCTION ARGS1(
CONST char *, cp_address)
{
int hash;
- unsigned char *p;
+ CONST unsigned char *p;
- for (p = (unsigned char *)cp_address, hash = 0; *p; p++)
- hash = (int) (hash * 3 + (*(unsigned char *)p)) % HASH_SIZE;
+ for (p = (CONST unsigned char *)cp_address, hash = 0; *p; p++)
+ hash = (int) (hash * 3 + (*(CONST unsigned char *)p)) % HASH_SIZE;
return hash;
}
diff --git a/WWW/Library/Implementation/HTAuth.c b/WWW/Library/Implementation/HTAuth.c
index 573a24b7..70d9781a 100644
--- a/WWW/Library/Implementation/HTAuth.c
+++ b/WWW/Library/Implementation/HTAuth.c
@@ -146,13 +146,13 @@ PRIVATE HTAAUser *decompose_auth_string ARGS2(char *, authstring,
-PRIVATE BOOL HTAA_checkTimeStamp ARGS1(CONST char *, timestamp)
+PRIVATE BOOL HTAA_checkTimeStamp ARGS1(CONST char *, timestamp GCC_UNUSED)
{
return NO; /* This is just a stub */
}
-PRIVATE BOOL HTAA_checkInetAddress ARGS1(CONST char *, i_net_adr)
+PRIVATE BOOL HTAA_checkInetAddress ARGS1(CONST char *, i_net_adr GCC_UNUSED)
{
return NO; /* This is just a stub */
}
diff --git a/WWW/Library/Implementation/HTCJK.h b/WWW/Library/Implementation/HTCJK.h
index c5fa51af..19c8fa66 100644
--- a/WWW/Library/Implementation/HTCJK.h
+++ b/WWW/Library/Implementation/HTCJK.h
@@ -96,15 +96,15 @@ extern unsigned char * EUC_TO_JIS PARAMS((
CONST char * toA));
extern unsigned char * TO_EUC PARAMS((
- unsigned char * jis,
+ CONST unsigned char * jis,
unsigned char * euc));
extern void TO_SJIS PARAMS((
- unsigned char * any,
+ CONST unsigned char * any,
unsigned char * sjis));
extern void TO_JIS PARAMS((
- unsigned char * any,
+ CONST unsigned char * any,
unsigned char * jis));
#endif /* HTCJK_H */
diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c
index 38ceddd4..0c83e42d 100644
--- a/WWW/Library/Implementation/HTFTP.c
+++ b/WWW/Library/Implementation/HTFTP.c
@@ -110,6 +110,7 @@ BUGS: @@@ Limit connection cache size!
#define IPPORT_FTP 21
#endif /* !IPORT_FTP */
+#include <LYStrings.h>
#include <LYLeaks.h>
typedef struct _connection {
@@ -1417,8 +1418,8 @@ PRIVATE void parse_vms_dir_entry ARGS2(
/** Cast VMS non-README file and directory names to lowercase. **/
if (strstr(entry_info->filename, "READ") == NULL) {
- for (i = 0; entry_info->filename[i]; i++)
- entry_info->filename[i] = TOLOWER(entry_info->filename[i]);
+ LYLowerCase(entry_info->filename);
+ i = strlen(entry_info->filename);
} else {
i = ((strstr(entry_info->filename, "READ") - entry_info->filename) + 4);
if (!strncmp((char *)&entry_info->filename[i], "ME", 2)) {
@@ -1431,8 +1432,7 @@ PRIVATE void parse_vms_dir_entry ARGS2(
} else {
i = 0;
}
- for (; entry_info->filename[i]; i++)
- entry_info->filename[i] = TOLOWER(entry_info->filename[i]);
+ LYLowerCase(entry_info->filename + i);
}
/** Uppercase terminal .z's or _z's. **/
@@ -1553,28 +1553,22 @@ PRIVATE void parse_ms_windows_dir_entry ARGS2(
char *end = line + strlen(line);
/** Get rid of blank or junk lines. **/
- while (*cp && isspace(*cp))
- cp++;
+ cp = LYSkipBlanks(cp);
if (!(*cp)) {
entry_info->display = FALSE;
return;
}
/** Cut out file or directory name. **/
- cps = cp;
- while (*cps && !isspace(*cps))
- cps++;
+ cps = LYSkipNonBlanks(cp);
*cps++ ='\0';
cpd = cps;
StrAllocCopy(entry_info->filename, cp);
/** Track down the size **/
if (cps < end) {
- while (*cps && isspace(*cps))
- cps++;
- cpd = cps;
- while (*cpd && !isspace(*cpd))
- cpd++;
+ cps = LYSkipBlanks(cps);
+ cpd = LYSkipNonBlanks(cps);
*cpd++ = '\0';
if (isdigit(*cps)) {
entry_info->size = atoi(cps);
@@ -1592,8 +1586,7 @@ PRIVATE void parse_ms_windows_dir_entry ARGS2(
/** Track down the date. **/
if (cpd < end) {
- while (*cpd && isspace(*cpd))
- cpd++;
+ cpd = LYSkipBlanks(cpd);
if (strlen(cpd) > 17) {
*(cpd+6) = '\0'; /* Month and Day */
*(cpd+11) = '\0'; /* Year */
@@ -1635,8 +1628,7 @@ PRIVATE void parse_windows_nt_dir_entry ARGS2(
int i;
/** Get rid of blank or junk lines. **/
- while (*cp && isspace(*cp))
- cp++;
+ cp = LYSkipBlanks(cp);
if (!(*cp)) {
entry_info->display = FALSE;
return;
@@ -1644,9 +1636,7 @@ PRIVATE void parse_windows_nt_dir_entry ARGS2(
/** Cut out file or directory name. **/
cpd = cp;
- cps = (end-1);
- while (cps >= cpd && !isspace(*cps))
- cps--;
+ cps = LYSkipNonBlanks(end-1);
cp = (cps+1);
if (!strcmp(cp, ".") || !strcmp(cp, "..")) {
entry_info->display = FALSE;
@@ -1665,18 +1655,14 @@ PRIVATE void parse_windows_nt_dir_entry ARGS2(
/** Cut out the date. **/
cp = cps = cpd;
- while (*cps && !isspace(*cps))
- cps++;
+ cps = LYSkipNonBlanks(cps);
*cps++ ='\0';
if (cps > end) {
entry_info->display = FALSE;
return;
}
- while (*cps && isspace(*cps))
- cps++;
- cpd = cps;
- while (*cps && !isspace(*cps))
- cps++;
+ cps = LYSkipBlanks(cps);
+ cpd = LYSkipNonBlanks(cps);
*cps++ ='\0';
if (cps > end || cpd == cps || strlen(cpd) < 7) {
entry_info->display = FALSE;
@@ -1717,11 +1703,8 @@ PRIVATE void parse_windows_nt_dir_entry ARGS2(
/** Track down the size **/
if (cps < end) {
- while (*cps && isspace(*cps))
- cps++;
- cpd = cps;
- while (*cpd && !isspace(*cpd))
- cpd++;
+ cps = LYSkipBlanks(cps);
+ cpd = LYSkipNonBlanks(cps);
*cpd = '\0';
if (isdigit(*cps)) {
entry_info->size = atoi(cps);
@@ -1758,25 +1741,20 @@ PRIVATE void parse_cms_dir_entry ARGS2(
int i;
/** Get rid of blank or junk lines. **/
- while (*cp && isspace(*cp))
- cp++;
+ cp = LYSkipBlanks(cp);
if (!(*cp)) {
entry_info->display = FALSE;
return;
}
/** Cut out file or directory name. **/
- cps = cp;
- while (*cps && !isspace(*cps))
- cps++;
+ cps = LYSkipNonBlanks(cp);
*cps++ ='\0';
StrAllocCopy(entry_info->filename, cp);
if (strchr(entry_info->filename, '.') != NULL)
/** If we already have a dot, we did an NLST. **/
return;
- cp = cps;
- while (*cp && isspace(*cp))
- cp++;
+ cp = LYSkipBlanks(cps);
if (!(*cp)) {
/** If we don't have more, we've misparsed. **/
FREE(entry_info->filename);
@@ -1784,9 +1762,7 @@ PRIVATE void parse_cms_dir_entry ARGS2(
entry_info->display = FALSE;
return;
}
- cps = cp;
- while (*cps && !isspace(*cps))
- cps++;
+ cps = LYSkipNonBlanks(cp);
*cps++ ='\0';
if ((0 == strcasecomp(cp, "DIR")) && (cp - line) > 17) {
/** It's an SFS directory. **/
@@ -1801,11 +1777,8 @@ PRIVATE void parse_cms_dir_entry ARGS2(
/** Track down the VM/CMS RECFM or type. **/
cp = cps;
if (cp < end) {
- while (*cp && isspace(*cp))
- cp++;
- cps = cp;
- while (*cps && !isspace(*cps))
- cps++;
+ cp = LYSkipBlanks(cp);
+ cps = LYSkipNonBlanks(cp);
*cps++ = '\0';
/** Check cp here, if it's relevant someday. **/
}
@@ -1814,11 +1787,8 @@ PRIVATE void parse_cms_dir_entry ARGS2(
/** Track down the record length or dash. **/
cp = cps;
if (cp < end) {
- while (*cp && isspace(*cp))
- cp++;
- cps = cp;
- while (*cps && !isspace(*cps))
- cps++;
+ cp = LYSkipBlanks(cp);
+ cps = LYSkipNonBlanks(cp);
*cps++ = '\0';
if (isdigit(*cp)) {
RecordLength = atoi(cp);
@@ -1828,11 +1798,8 @@ PRIVATE void parse_cms_dir_entry ARGS2(
/** Track down the number of records or the dash. **/
cp = cps;
if (cps < end) {
- while (*cp && isspace(*cp))
- cp++;
- cps = cp;
- while (*cps && !isspace(*cps))
- cps++;
+ cp = LYSkipBlanks(cp);
+ cps = LYSkipNonBlanks(cp);
*cps++ = '\0';
if (isdigit(*cp)) {
Records = atoi(cp);
diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c
index 0e405b82..c809ff63 100644
--- a/WWW/Library/Implementation/HTFile.c
+++ b/WWW/Library/Implementation/HTFile.c
@@ -80,6 +80,7 @@
#include <LYexit.h>
#include <LYCharSets.h>
#include <LYGlobalDefs.h>
+#include <LYStrings.h>
#include <LYUtils.h>
#include <LYLeaks.h>
@@ -867,12 +868,10 @@ PUBLIC HTFormat HTCharsetFormat ARGS3(
char *cp = NULL, *cp1, *cp2, *cp3 = NULL, *cp4;
BOOL chartrans_ok = FALSE;
int chndl = -1;
- int i;
FREE(anchor->charset);
StrAllocCopy(cp, format->name);
- for (i = 0; cp[i]; i++)
- cp[i] = TOLOWER(cp[i]);
+ LYLowerCase(cp);
if (((cp1 = strchr(cp, ';')) != NULL) &&
(cp2 = strstr(cp1, "charset")) != NULL) {
CTRACE(tfp, "HTCharsetFormat: Extended MIME Content-Type is %s\n",
diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c
index ddc6a0aa..734b6f2f 100644
--- a/WWW/Library/Implementation/HTGopher.c
+++ b/WWW/Library/Implementation/HTGopher.c
@@ -74,6 +74,7 @@
*/
#include <HTML.h>
+#include <LYStrings.h>
#include <LYLeaks.h>
#define PUTC(c) (*targetClass.put_character)(target, c)
@@ -884,7 +885,6 @@ PRIVATE int interpret_cso_key ARGS5(
PRIVATE int parse_cso_field_info ARGS1(
CSOfield_info *, blk)
{
- int i;
char *info, *max_spec;
/*
@@ -898,8 +898,7 @@ PRIVATE int parse_cso_field_info ARGS1(
** are converted to all lower-case for comparison.
*/
info = blk->attributes;
- for (i = 0; info[i]; i++)
- info[i] = TOLOWER(info[i]);
+ LYLowerCase(info);
if (strstr(info, "indexed "))
blk->indexed = 1;
if (strstr(info, "default "))
diff --git a/WWW/Library/Implementation/HTMIME.c b/WWW/Library/Implementation/HTMIME.c
index f619eb81..70083ab5 100644
--- a/WWW/Library/Implementation/HTMIME.c
+++ b/WWW/Library/Implementation/HTMIME.c
@@ -20,6 +20,7 @@
#include <UCAux.h>
#include <LYCharSets.h>
+#include <LYStrings.h>
#include <LYLeaks.h>
#define FREE(x) if (x) {free(x); x = NULL;}
@@ -331,8 +332,7 @@ PRIVATE void HTMIME_put_character ARGS2(
** we'll make sure they're still gone from any
** charset parameter we check. - FM
*/
- for (i = 0; cp[i]; i++)
- cp[i] = TOLOWER(cp[i]);
+ LYLowerCase(cp);
if ((cp1 = strchr(cp, ';')) != NULL) {
BOOL chartrans_ok = NO;
if ((cp2 = strstr(cp1, "charset")) != NULL) {
@@ -1248,8 +1248,7 @@ PRIVATE void HTMIME_put_character ARGS2(
/*
** Convert to lowercase and indicate in anchor. - FM
*/
- for (i = 0; me->value[i]; i++)
- me->value[i] = TOLOWER(me->value[i]);
+ LYLowerCase(me->value);
StrAllocCopy(me->anchor->cache_control, me->value);
/*
** Check whether to set no_cache for the anchor. - FM
@@ -1373,8 +1372,7 @@ PRIVATE void HTMIME_put_character ARGS2(
/*
** Convert to lowercase and indicate in anchor. - FM
*/
- for (i = 0; me->value[i]; i++)
- me->value[i] = TOLOWER(me->value[i]);
+ LYLowerCase(me->value);
StrAllocCopy(me->anchor->content_encoding, me->value);
FREE(me->compression_encoding);
if (!strcmp(me->value, "8bit") ||
@@ -1407,8 +1405,7 @@ PRIVATE void HTMIME_put_character ARGS2(
/*
** Convert to lowercase and indicate in anchor. - FM
*/
- for (i = 0; me->value[i]; i++)
- me->value[i] = TOLOWER(me->value[i]);
+ LYLowerCase(me->value);
StrAllocCopy(me->anchor->content_language, me->value);
break;
case miCONTENT_LENGTH:
@@ -1463,8 +1460,7 @@ PRIVATE void HTMIME_put_character ARGS2(
** Force the Content-Transfer-Encoding value
** to all lower case. - FM
*/
- for (i = 0; me->value[i]; i++)
- me->value[i] = TOLOWER(me->value[i]);
+ LYLowerCase(me->value);
me->encoding = HTAtom_for(me->value);
break;
case miCONTENT_TYPE:
@@ -2021,8 +2017,7 @@ PUBLIC void HTmmdecode ARGS2(
int LYhndl;
*qm2 = '\0';
- for (p = s+2; *p; p++)
- *p = TOLOWER(*p);
+ LYLowerCase(s+2);
invalid = ((LYhndl = UCGetLYhndl_byMIME(s+2)) < 0 ||
UCCanTranslateFromTo(LYhndl,
current_char_set));
diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c
index 4cd22539..c2e48411 100644
--- a/WWW/Library/Implementation/HTTP.c
+++ b/WWW/Library/Implementation/HTTP.c
@@ -33,6 +33,7 @@
#include <HTAABrow.h>
#include <LYGlobalDefs.h>
+#include <LYStrings.h>
#include <LYLeaks.h>
struct _HTStream
@@ -307,8 +308,7 @@ try_again:
strcpy(line, pref_charset);
if (line[strlen(line)-1] == ',')
line[strlen(line)-1] = '\0';
- for (i = 0; line[i]; i++)
- line[i] = TOLOWER(line[i]);
+ LYLowerCase(line);
if (strstr(line, "iso-8859-1") == NULL)
strcat(line, ", iso-8859-1;q=0.01");
if (strstr(line, "us-ascii") == NULL)
diff --git a/WWW/Library/Implementation/HTVMSUtils.c b/WWW/Library/Implementation/HTVMSUtils.c
index 69198b65..21283c9b 100644
--- a/WWW/Library/Implementation/HTVMSUtils.c
+++ b/WWW/Library/Implementation/HTVMSUtils.c
@@ -1115,11 +1115,7 @@ PUBLIC int HTVMSBrowseDir ARGS4(
dot = strstr(entry_info->filename, ".DIR");
if (dot)
*dot = '\0';
- cp = entry_info->filename;
- while (cp && *cp) {
- *cp = TOLOWER(*cp);
- cp++;
- }
+ LYLowerCase(entry_info->filename);
StrAllocCopy(entry_info->type, "Directory");
} else {
if ((cp = strstr(entry_info->filename, "READ")) == NULL) {
@@ -1138,10 +1134,7 @@ PUBLIC int HTVMSBrowseDir ARGS4(
cp = entry_info->filename;
}
}
- while (cp && *cp) {
- *cp = TOLOWER(*cp);
- cp++;
- }
+ LYLowerCase(cp);
if (((len = strlen(entry_info->filename)) > 2) &&
entry_info->filename[len-1] == 'z') {
if (entry_info->filename[len-2] == '.' ||
diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c
index 21937698..15fc070c 100644
--- a/WWW/Library/Implementation/SGML.c
+++ b/WWW/Library/Implementation/SGML.c
@@ -3471,10 +3471,11 @@ PUBLIC unsigned char * EUC_TO_JIS ARGS4(
}
PUBLIC unsigned char * TO_EUC ARGS2(
- unsigned char *, jis,
+ CONST unsigned char *, jis,
unsigned char *, euc)
{
- register unsigned char *s, *d, c, jis_stat;
+ register CONST unsigned char *s;
+ register unsigned char *d, c, jis_stat;
register int to1B, to2B;
register int in_sjis = 0;
@@ -3524,7 +3525,7 @@ PUBLIC unsigned char * TO_EUC ARGS2(
}
PUBLIC void TO_SJIS ARGS2(
- unsigned char *, any,
+ CONST unsigned char *, any,
unsigned char *, sjis)
{
unsigned char *euc;
@@ -3542,7 +3543,7 @@ PUBLIC void TO_SJIS ARGS2(
}
PUBLIC void TO_JIS ARGS2(
- unsigned char *, any,
+ CONST unsigned char *, any,
unsigned char *, jis)
{
unsigned char *euc;