diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1998-02-27 19:00:00 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1998-02-27 19:00:00 -0500 |
commit | 86b4d41a7463bd35cf662fc748aa338caef609c9 (patch) | |
tree | db4ba2deed8edca7df91182c0253ee93248c7382 /WWW | |
parent | 899516a7c8880df05e30bbbed72ca1d3cb7a4f00 (diff) | |
download | lynx-snapshots-86b4d41a7463bd35cf662fc748aa338caef609c9.tar.gz |
snapshot of project "lynx", label v2-7-1ac-0_117
Diffstat (limited to 'WWW')
25 files changed, 550 insertions, 766 deletions
diff --git a/WWW/Library/Implementation/HTAAServ.c b/WWW/Library/Implementation/HTAAServ.c index fb6f696a..cb8623d7 100644 --- a/WWW/Library/Implementation/HTAAServ.c +++ b/WWW/Library/Implementation/HTAAServ.c @@ -49,8 +49,8 @@ #include "HTString.h" #include "HTAccess.h" /* HTSecure */ #include "HTFile.h" /* HTLocalName */ -#include "HTRules.h" /* */ -#include "HTParse.h" /* URL parsing function */ +#include "HTRules.h" /* */ +#include "HTParse.h" /* URL parsing function */ #include "HTList.h" /* HTList object */ #include "HTAAUtil.h" /* AA common parts */ @@ -71,7 +71,7 @@ PUBLIC time_t theTime; /* ** Module-wide global variables */ -PRIVATE FILE * htaa_logfile = NULL; /* Log file */ +PRIVATE FILE * htaa_logfile = NULL; /* Log file */ PRIVATE HTAAUser *htaa_user = NULL; /* Authenticated user */ PRIVATE HTAAFailReasonType HTAAFailReason = HTAA_OK; /* AA fail reason */ @@ -82,7 +82,7 @@ PRIVATE HTAAFailReasonType HTAAFailReason = HTAA_OK; /* AA fail reason */ ** (Can be used in server reply status line ** with 401/403 replies.) ** ON EXIT: -** returns a string containing the error message +** returns a string containing the error message ** corresponding to internal HTAAFailReason. */ PUBLIC char *HTAA_statusMessage NOARGS @@ -125,7 +125,7 @@ PUBLIC char *HTAA_statusMessage NOARGS /* Success */ case HTAA_OK: - return "AA: Access should be ok but something went wrong"; + return "AA: Access should be ok but something went wrong"; break; case HTAA_OK_GATEWAY: @@ -142,7 +142,7 @@ PUBLIC char *HTAA_statusMessage NOARGS PRIVATE char *status_name ARGS1(HTAAFailReasonType, reason) { - switch (HTAAFailReason) { + switch (reason) { /* 401 cases */ case HTAA_NO_AUTH: @@ -207,11 +207,11 @@ PRIVATE char *status_name ARGS1(HTAAFailReasonType, reason) ** Kerberos-ticket). ** ** ON EXIT: -** returns HTAA_OK on success. +** returns HTAA_OK on success. ** Otherwise the reason for failing. ** NOTE: ** This function does not check whether the file -** exists or not -- so the status 404 Not found +** exists or not -- so the status 404 Not found ** must be returned from somewhere else (this is ** to avoid unnecessary overhead of opening the ** file twice). @@ -234,9 +234,9 @@ PRIVATE HTAAFailReasonType check_authorization ARGS4(CONST char *, pathname, return HTAA_BY_RULE; } if (TRACE) - fprintf(stderr, "%s `%s' %s %s\n", - "HTAA_checkAuthorization: translated path:", - pathname, "method:", HTAAMethod_name(method)); + fprintf(stderr, "%s `%s' %s %s\n", + "HTAA_checkAuthorization: translated path:", + pathname, "method:", HTAAMethod_name(method)); /* ** Get protection setting (set up by callbacks from rule system) @@ -259,14 +259,14 @@ PRIVATE HTAAFailReasonType check_authorization ARGS4(CONST char *, pathname, /* ** Authenticate if authentication info given */ - if (scheme != HTAA_UNKNOWN && scheme != HTAA_NONE) { + if (scheme != HTAA_UNKNOWN && scheme != HTAA_NONE) { htaa_user = HTAA_authenticate(scheme, scheme_specifics, prot); if (TRACE) - fprintf(stderr, "Authentication returned: %s\n", - (htaa_user ? htaa_user->username - : "NOT-AUTHENTICATED")); + fprintf(stderr, "Authentication returned: %s\n", + (htaa_user ? htaa_user->username + : "NOT-AUTHENTICATED")); } HTAA_resolveGroupReferences(prot->mask_group, group_def_list); reason = HTAA_userAndInetInGroup(prot->mask_group, @@ -281,9 +281,9 @@ PRIVATE HTAAFailReasonType check_authorization ARGS4(CONST char *, pathname, "by mask (no ACL, only Protect rule)", "host", HTClientHost); else - fprintf(stderr, "%s %s %s %s\n", + fprintf(stderr, "%s %s %s %s\n", "HTAA_checkAuthorization: request from", - HTClientHost, + HTClientHost, "accepted by only mask match (no ACL, only", "Protect rule, and only mask enabled)"); } @@ -299,8 +299,8 @@ PRIVATE HTAAFailReasonType check_authorization ARGS4(CONST char *, pathname, } else { /* No protect rule and no ACL => OK 200 */ if (TRACE) - fprintf(stderr, "HTAA_checkAuthorization: %s\n", - "no protect rule nor ACL -- ok\n"); + fprintf(stderr, "HTAA_checkAuthorization: %s\n", + "no protect rule nor ACL -- ok\n"); return HTAA_OK; } } @@ -315,9 +315,9 @@ PRIVATE HTAAFailReasonType check_authorization ARGS4(CONST char *, pathname, if (!prot) { /* @@ Default protection not set ?? */ if (TRACE) - fprintf(stderr, "%s %s\n", - "HTAA_checkAuthorization: default protection", - "not set (internal server error)!!"); + fprintf(stderr, "%s %s\n", + "HTAA_checkAuthorization: default protection", + "not set (internal server error)!!"); return HTAA_SETUP_ERROR; } } @@ -333,16 +333,16 @@ PRIVATE HTAAFailReasonType check_authorization ARGS4(CONST char *, pathname, /* ** Authenticate now that we know protection mode */ - if (scheme != HTAA_UNKNOWN && scheme != HTAA_NONE) { + if (scheme != HTAA_UNKNOWN && scheme != HTAA_NONE) { htaa_user = HTAA_authenticate(scheme, scheme_specifics, prot); if (TRACE) - fprintf(stderr, "Authentication returned: %s\n", - (htaa_user + fprintf(stderr, "Authentication returned: %s\n", + (htaa_user ? htaa_user->username : "NOT-AUTHENTICATED")); } - /* + /* ** Check mask group */ if (prot->mask_group) { @@ -362,7 +362,7 @@ PRIVATE HTAAFailReasonType check_authorization ARGS4(CONST char *, pathname, if (TRACE) fprintf(stderr, "%s %s %s %s %s\n", "HTAA_checkAuthorization: request from", - HTClientHost, + HTClientHost, "accepted by just mask group match", "(no ACL, only Protect rule, and only", "mask enabled)"); @@ -370,15 +370,15 @@ PRIVATE HTAAFailReasonType check_authorization ARGS4(CONST char *, pathname, } } /* - ** Get ACL entries; get first one first, the loop others + ** Get ACL entries; get first one first, the loop others ** Remember, allowed_groups is automatically freed by ** HTAA_getAclEntry(). */ allowed_groups = HTAA_getAclEntry(acl_file, pathname, method); if (!allowed_groups) { if (TRACE) - fprintf(stderr, "%s `%s' %s\n", - "No entry for file", pathname, "in ACL"); + fprintf(stderr, "%s `%s' %s\n", + "No entry for file", pathname, "in ACL"); HTAA_closeAcl(acl_file); return HTAA_NO_ENTRY; /* Forbidden -- no entry in the ACL */ } @@ -414,16 +414,16 @@ PRIVATE HTAAFailReasonType check_authorization ARGS4(CONST char *, pathname, ** Kerberos-ticket). ** ** ON EXIT: -** returns status codes uniform with those of HTTP: +** returns status codes uniform with those of HTTP: ** 200 OK if file access is ok. ** 401 Unauthorized if user is not authorized to ** access the file. -** 403 Forbidden if there is no entry for the +** 403 Forbidden if there is no entry for the ** requested file in the ACL. ** ** NOTE: ** This function does not check whether the file -** exists or not -- so the status 404 Not found +** exists or not -- so the status 404 Not found ** must be returned from somewhere else (this is ** to avoid unnecessary overhead of opening the ** file twice). @@ -432,7 +432,7 @@ PRIVATE HTAAFailReasonType check_authorization ARGS4(CONST char *, pathname, PUBLIC int HTAA_checkAuthorization ARGS4(CONST char *, url, CONST char *, method_name, CONST char *, scheme_name, - char *, scheme_specifics) + char *, scheme_specifics) { static char *pathname = NULL; char *local_copy = NULL; @@ -465,8 +465,8 @@ PUBLIC int HTAA_checkAuthorization ARGS4(CONST char *, url, } else { pathname = HTTranslate(local_copy); /* Translate rules even if */ - /* a /htbin call to set up */ - /* protections. */ + /* a /htbin call to set up */ + /* protections. */ if (0 == strncmp(local_copy, "/htbin/", 7)) { if (!HTBinDir) HTAAFailReason = HTAA_HTBIN; @@ -483,7 +483,7 @@ PUBLIC int HTAA_checkAuthorization ARGS4(CONST char *, url, if (!pathname) { /* Forbidden by rule */ if (TRACE) - fprintf(stderr, "HTAA_checkAuthorization: Forbidden by rule\n"); + fprintf(stderr, "HTAA_checkAuthorization: Forbidden by rule\n"); HTAAFailReason = HTAA_BY_RULE; } else if (HTAAFailReason != HTAA_HTBIN) { @@ -574,7 +574,7 @@ PUBLIC int HTAA_checkAuthorization ARGS4(CONST char *, url, ** prot protection setup structure. ** ** ON EXIT: -** returns scheme specific parameters in an +** returns scheme specific parameters in an ** auto-freed string. */ PRIVATE char *compose_scheme_specifics ARGS2(HTAAScheme, scheme, @@ -621,7 +621,7 @@ PRIVATE char *compose_scheme_specifics ARGS2(HTAAScheme, scheme, ** authentication scheme was used. ** ** ON EXIT: -** returns a buffer containing all the WWW-Authenticate: +** returns a buffer containing all the WWW-Authenticate: ** fields including CRLFs (this buffer is auto-freed). ** NULL, if authentication won't help in accessing ** the requested document. @@ -643,7 +643,7 @@ PUBLIC char *HTAA_composeAuthHeaders NOARGS return NULL; } else if (TRACE) - fprintf(stderr, "HTAA_composeAuthHeaders: for file `%s'\n", + fprintf(stderr, "HTAA_composeAuthHeaders: for file `%s'\n", prot->filename); FREE(result); /* From previous call */ @@ -664,11 +664,11 @@ PUBLIC char *HTAA_composeAuthHeaders NOARGS strcat(result, "\r\n"); } /* scheme name found */ else if (TRACE) - fprintf(stderr, "HTAA_composeAuthHeaders: %s %d\n", + fprintf(stderr, "HTAA_composeAuthHeaders: %s %d\n", "No name found for scheme number", scheme); } /* scheme valid for requested document */ } /* for every scheme */ - + return result; } diff --git a/WWW/Library/Implementation/HTAAUtil.c b/WWW/Library/Implementation/HTAAUtil.c index 837f09c7..a7cad59b 100644 --- a/WWW/Library/Implementation/HTAAUtil.c +++ b/WWW/Library/Implementation/HTAAUtil.c @@ -33,7 +33,7 @@ ** ** AUTHORS: ** AL Ari Luotonen luotonen@dxcern.cern.ch -** MD Mark Donszelmann duns@vxdeop.cern.ch +** MD Mark Donszelmann duns@vxdeop.cern.ch ** ** HISTORY: ** 8 Nov 93 MD (VMS only) Added case insensitive comparison in HTAA_templateCaseMatch @@ -62,7 +62,7 @@ ** name is a string representing the scheme name. ** ** ON EXIT: -** returns the enumerated constant for that scheme. +** returns the enumerated constant for that scheme. */ PUBLIC HTAAScheme HTAAScheme_enum ARGS1(CONST char*, name) { @@ -70,7 +70,7 @@ PUBLIC HTAAScheme HTAAScheme_enum ARGS1(CONST char*, name) char *cur; if (!name) - return HTAA_UNKNOWN; + return HTAA_UNKNOWN; StrAllocCopy(upcased, name); cur = upcased; @@ -78,24 +78,24 @@ PUBLIC HTAAScheme HTAAScheme_enum ARGS1(CONST char*, name) *cur = TOUPPER(*cur); cur++; } - + if (!strncmp(upcased, "NONE", 4)) { - FREE(upcased); + FREE(upcased); return HTAA_NONE; } else if (!strncmp(upcased, "BASIC", 5)) { - FREE(upcased); + FREE(upcased); return HTAA_BASIC; } else if (!strncmp(upcased, "PUBKEY", 6)) { - FREE(upcased); + FREE(upcased); return HTAA_PUBKEY; } else if (!strncmp(upcased, "KERBEROSV4", 10)) { - FREE(upcased); + FREE(upcased); return HTAA_KERBEROS_V4; } else if (!strncmp(upcased, "KERBEROSV5", 10)) { - FREE(upcased); + FREE(upcased); return HTAA_KERBEROS_V5; } else { - FREE(upcased); + FREE(upcased); return HTAA_UNKNOWN; } } @@ -108,13 +108,13 @@ PUBLIC HTAAScheme HTAAScheme_enum ARGS1(CONST char*, name) ** HTAA_NONE, HTAA_BASIC, HTAA_PUBKEY, ... ** ** ON EXIT: -** returns the name of the scheme, i.e. +** returns the name of the scheme, i.e. ** "None", "Basic", "Pubkey", ... */ PUBLIC char *HTAAScheme_name ARGS1(HTAAScheme, scheme) { switch (scheme) { - case HTAA_NONE: + case HTAA_NONE: return "None"; break; case HTAA_BASIC: @@ -144,7 +144,7 @@ PUBLIC char *HTAAScheme_name ARGS1(HTAAScheme, scheme) ** name is the method name to translate. ** ** ON EXIT: -** returns HTAAMethod enumerated value corresponding +** returns HTAAMethod enumerated value corresponding ** to the given name. */ PUBLIC HTAAMethod HTAAMethod_enum ARGS1(CONST char *, name) @@ -154,7 +154,7 @@ PUBLIC HTAAMethod HTAAMethod_enum ARGS1(CONST char *, name) char *dest = tmp; if (!name) - return METHOD_UNKNOWN; + return METHOD_UNKNOWN; while (*src) { *dest = TOUPPER(*src); @@ -179,23 +179,23 @@ PUBLIC HTAAMethod HTAAMethod_enum ARGS1(CONST char *, name) ** METHOD_GET, METHOD_PUT, ... ** ** ON EXIT: -** returns the name of the scheme, i.e. +** returns the name of the scheme, i.e. ** "GET", "PUT", ... */ PUBLIC char *HTAAMethod_name ARGS1(HTAAMethod, method) { switch (method) { case METHOD_GET: - return "GET"; + return "GET"; break; case METHOD_PUT: - return "PUT"; + return "PUT"; break; case METHOD_UNKNOWN: - return "UNKNOWN"; + return "UNKNOWN"; break; default: - return "THIS-IS-A-BUG"; + return "THIS-IS-A-BUG"; } } @@ -207,10 +207,10 @@ PUBLIC char *HTAAMethod_name ARGS1(HTAAMethod, method) ** list is a list of method names. ** ** ON EXIT: -** returns YES, if method was found. +** returns YES, if method was found. ** NO, if not found. */ -PUBLIC BOOL HTAAMethod_inList ARGS2(HTAAMethod, method, +PUBLIC BOOL HTAAMethod_inList ARGS2(HTAAMethod, method, HTList *, list) { HTList *cur = list; @@ -246,10 +246,10 @@ PUBLIC BOOL HTAAMethod_inList ARGS2(HTAAMethod, method, ** agaist the template. ** ** ON EXIT: -** returns YES, if filename matches the template. +** returns YES, if filename matches the template. ** NO, otherwise. */ -PUBLIC BOOL HTAA_templateMatch ARGS2(CONST char *, template, +PUBLIC BOOL HTAA_templateMatch ARGS2(CONST char *, template, CONST char *, filename) { CONST char *p = template; @@ -260,7 +260,7 @@ PUBLIC BOOL HTAA_templateMatch ARGS2(CONST char *, template, ; /* do nothing else */ if (!*p && !*q) - return YES; /* Equally long equal strings */ + return YES; /* Equally long equal strings */ else if ('*' == *p) { /* Wildcard */ p++; /* Skip wildcard character */ m = strlen(q) - strlen(p); /* Amount to match to wildcard */ @@ -268,14 +268,14 @@ PUBLIC BOOL HTAA_templateMatch ARGS2(CONST char *, template, return NO; /* No match, filename too short */ else { /* Skip the matched characters and compare */ if (strcmp(p, q+m)) - return NO; /* Tail mismatch */ + return NO; /* Tail mismatch */ else - return YES; /* Tail match */ + return YES; /* Tail match */ } } /* if wildcard */ else - return NO; /* Length or character mismatch */ -} + return NO; /* Length or character mismatch */ +} /* PUBLIC HTAA_templateCaseMatch() @@ -284,7 +284,7 @@ PUBLIC BOOL HTAA_templateMatch ARGS2(CONST char *, template, ** NOTE: ** This is essentially the same code as in HTAA_templateMatch, but ** it compares case insensitive (for VMS). Reason for this routine -** is that HTAA_templateMatch gets called from several places, also +** is that HTAA_templateMatch gets called from several places, also ** there where a case sensitive match is needed, so one cannot just ** change the HTAA_templateMatch routine for VMS. ** @@ -297,11 +297,11 @@ PUBLIC BOOL HTAA_templateMatch ARGS2(CONST char *, template, ** agaist the template. ** ** ON EXIT: -** returns YES, if filename matches the template. +** returns YES, if filename matches the template. ** NO, otherwise. */ -PUBLIC BOOL HTAA_templateCaseMatch ARGS2(CONST char *, template, - CONST char *, filename) +PUBLIC BOOL HTAA_templateCaseMatch ARGS2(CONST char *, template, + CONST char *, filename) { CONST char *p = template; CONST char *q = filename; @@ -312,7 +312,7 @@ PUBLIC BOOL HTAA_templateCaseMatch ARGS2(CONST char *, template, ; /* do nothing else */ if (!*p && !*q) - return YES; /* Equally long equal strings */ + return YES; /* Equally long equal strings */ else if ('*' == *p) { /* Wildcard */ p++; /* Skip wildcard character */ m = strlen(q) - strlen(p); /* Amount to match to wildcard */ @@ -320,14 +320,14 @@ PUBLIC BOOL HTAA_templateCaseMatch ARGS2(CONST char *, template, return NO; /* No match, filename too short */ else { /* Skip the matched characters and compare */ if (strcasecomp(p, q+m)) - return NO; /* Tail mismatch */ + return NO; /* Tail mismatch */ else - return YES; /* Tail match */ + return YES; /* Tail match */ } } /* if wildcard */ else - return NO; /* Length or character mismatch */ -} + return NO; /* Length or character mismatch */ +} /* PUBLIC HTAA_makeProtectionTemplate() @@ -337,10 +337,10 @@ PUBLIC BOOL HTAA_templateCaseMatch ARGS2(CONST char *, template, ** it to tell the client, and by browser if server ** didn't send WWW-ProtectionTemplate: field) ** ON ENTRY: -** docname is the document pathname (from URL). +** docname is the document pathname (from URL). ** ** ON EXIT: -** returns a template matching docname, and other files +** returns a template matching docname, and other files ** files in that directory. ** ** E.g. /foo/bar/x.html => /foo/bar/ * @@ -365,11 +365,11 @@ PUBLIC char *HTAA_makeProtectionTemplate ARGS1(CONST char *, docname) StrAllocCat(template, "*"); } else - StrAllocCopy(template, "*"); + StrAllocCopy(template, "*"); if (TRACE) - fprintf(stderr, "make_template: made template `%s' for file `%s'\n", - template, docname); + fprintf(stderr, "make_template: made template `%s' for file `%s'\n", + template, docname); return template; } @@ -407,7 +407,7 @@ PUBLIC char *HTAA_makeProtectionTemplate ARGS1(CONST char *, docname) ** name = "value" , foo = "bar" ** ** ON EXIT: -** returns a list of name-value pairs (actually HTAssocList*). +** returns a list of name-value pairs (actually HTAssocList*). ** For items with no name, just value, the name is ** the number of order number of that item. E.g. ** "1" for the first, etc. @@ -420,7 +420,7 @@ PUBLIC HTAssocList *HTAA_parseArgList ARGS1(char *, str) int n = 0; if (!str) - return assoc_list; + return assoc_list; while (*str) { SKIPWS(str); /* Skip leading whitespace */ @@ -458,7 +458,7 @@ PUBLIC HTAssocList *HTAA_parseArgList ARGS1(char *, str) } } else { /* No name, just a value */ - if (*cur == ',') + if (*cur == ',') *(cur++) = '\0'; /* Terminate value */ /* else last value on line (already terminated by NULL) */ StrAllocCopy(name, "nnn"); /* Room for item order number */ @@ -496,15 +496,15 @@ PRIVATE int in_soc = -1; ** soc is the socket to use when start_of_headers ** buffer is used up. ** ON EXIT: -** returns nothing. +** returns nothing. ** Subsequent calls to HTAA_getUnfoldedLine() ** will use this buffer first and then ** proceed to read from socket. */ PUBLIC void HTAA_setupReader ARGS4(char *, start_of_headers, - int, length, + int, length, void *, handle, - int, soc) + int, soc) { start_pointer = buffer; if (start_of_headers) { @@ -527,8 +527,8 @@ PUBLIC void HTAA_setupReader ARGS4(char *, start_of_headers, ** this function to set up internal buffer. ** ** ON EXIT: -** returns a newly-allocated character string representing -** the read line. The line is unfolded, i.e. +** returns a newly-allocated character string representing +** the read line. The line is unfolded, i.e. ** lines that begin with whitespace are appended ** to current line. E.g. ** @@ -549,7 +549,7 @@ PUBLIC char *HTAA_getUnfoldedLine NOARGS BOOL peek_for_folding = NO; if (in_soc < 0) { - if (TRACE) + if (TRACE) fprintf(stderr, "%s %s\n", "HTAA_getUnfoldedLine: buffer not initialized", "with function HTAA_setupReader()"); @@ -581,7 +581,7 @@ PUBLIC char *HTAA_getUnfoldedLine NOARGS /* Unfolding */ - + if (peek_for_folding) { if (*cur != ' ' && *cur != '\t') return line; /* Ok, no continuation line */ @@ -595,7 +595,7 @@ PUBLIC char *HTAA_getUnfoldedLine NOARGS while (cur < end_pointer && *cur != '\n') /* Find the end-of-line */ cur++; /* (or end-of-buffer). */ - + /* Terminating line */ if (cur < end_pointer) { /* So *cur==LF, terminate line */ diff --git a/WWW/Library/Implementation/HTAccess.c b/WWW/Library/Implementation/HTAccess.c index 90b56d3b..f147d8c5 100644 --- a/WWW/Library/Implementation/HTAccess.c +++ b/WWW/Library/Implementation/HTAccess.c @@ -58,6 +58,7 @@ #include "HTAlert.h" #include "HTCJK.h" #include "UCMap.h" +#include "GridText.h" #include "LYexit.h" #include "LYLeaks.h" diff --git a/WWW/Library/Implementation/HTAuth.c b/WWW/Library/Implementation/HTAuth.c index 8d2ec4ca..c3364db9 100644 --- a/WWW/Library/Implementation/HTAuth.c +++ b/WWW/Library/Implementation/HTAuth.c @@ -30,7 +30,7 @@ ** from browser. ** ** ON EXIT: -** returns a node representing the user information +** returns a node representing the user information ** (as always, this is automatically freed ** by AA package). */ @@ -45,23 +45,23 @@ PRIVATE HTAAUser *decompose_auth_string ARGS2(char *, authstring, char *timestamp = NULL; char *browsers_key = NULL; - if (!user && !(user = (HTAAUser*)malloc(sizeof(HTAAUser)))) /* Allocated */ + if (!user && !(user = (HTAAUser*)malloc(sizeof(HTAAUser)))) /* Allocated */ outofmem(__FILE__, "decompose_auth_string"); /* only once */ user->scheme = scheme; user->username = NULL; /* Not freed, because freeing */ user->password = NULL; /* cleartext also frees these */ - user->inet_addr = NULL; /* See below: || */ - user->timestamp = NULL; /* || */ - user->secret_key = NULL; /* || */ - /* \/ */ + user->inet_addr = NULL; /* See below: || */ + user->timestamp = NULL; /* || */ + user->secret_key = NULL; /* || */ + /* \/ */ FREE(cleartext); /* From previous call. */ - /* NOTE: parts of this memory are pointed to by */ - /* pointers in HTAAUser structure. Therefore, */ - /* this also frees all the strings pointed to */ + /* NOTE: parts of this memory are pointed to by */ + /* pointers in HTAAUser structure. Therefore, */ + /* this also frees all the strings pointed to */ /* by the static 'user'. */ - if (!authstring || !*authstring || + if (!authstring || !*authstring || scheme != HTAA_BASIC || scheme == HTAA_PUBKEY) return NULL; @@ -85,7 +85,7 @@ PRIVATE HTAAUser *decompose_auth_string ARGS2(char *, authstring, else { /* Just uudecode */ int bytes_decoded; int len = strlen(authstring) + 1; - + if (!(cleartext = (char*)malloc(len))) outofmem(__FILE__, "decompose_auth_string"); bytes_decoded = HTUU_decode(authstring, @@ -111,7 +111,7 @@ PRIVATE HTAAUser *decompose_auth_string ARGS2(char *, authstring, ** Extract rest of the fields */ if (scheme == HTAA_PUBKEY) { - if ( !(i_net_adr =strchr(password, ':')) || + if ( !(i_net_adr =strchr(password, ':')) || (*(i_net_adr++) ='\0'), !(timestamp =strchr(i_net_adr,':')) || (*(timestamp++) ='\0'), !(browsers_key=strchr(timestamp,':')) || (*(browsers_key++)='\0')) { @@ -142,7 +142,7 @@ PRIVATE HTAAUser *decompose_auth_string ARGS2(char *, authstring, "Pubkey scheme authentication string:", username, password, i_net_adr, timestamp, browsers_key); } - + return user; } @@ -171,7 +171,7 @@ PRIVATE BOOL HTAA_checkInetAddress ARGS1(CONST char *, i_net_adr) ** for the file. ** ** ON EXIT: -** returns NULL, if authentication failed. +** returns NULL, if authentication failed. ** Otherwise a pointer to a structure ** representing authenticated user, ** which should not be freed. @@ -189,7 +189,7 @@ PUBLIC HTAAUser *HTAA_authenticate ARGS3(HTAAScheme, scheme, case HTAA_PUBKEY: { HTAAUser *user = decompose_auth_string(scheme_specifics, scheme); - /* Remember, user is auto-freed */ + /* Remember, user is auto-freed */ if (user && HTAA_checkPassword(user->username, user->password, diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c index 245e515a..8c014f76 100644 --- a/WWW/Library/Implementation/HTFTP.c +++ b/WWW/Library/Implementation/HTFTP.c @@ -1746,7 +1746,7 @@ PRIVATE void parse_windows_nt_dir_entry ARGS2( } if (strlen(cp) == 8 && isdigit(*cp) && isdigit(*(cp+1)) && *(cp+2) == '-' && - isdigit(*(cp+3)) && isdigit(*(cp+1)) && *(cp+5) == '-') { + isdigit(*(cp+3)) && isdigit(*(cp+4)) && *(cp+5) == '-') { *(cp+2) = '\0'; /* Month */ i = atoi(cp) - 1; *(cp+5) = '\0'; /* Day */ @@ -1756,12 +1756,10 @@ PRIVATE void parse_windows_nt_dir_entry ARGS2( cp += 6; /* Year */ if (strcmp((ThisYear+2), cp)) { /* Not this year, so show the year */ - if (atoi(cp) < atoi((char *)&ThisYear[2])) { - sprintf((char *)&date[6], " %c%c%s", - ThisYear[0], ThisYear[1], cp); + if (atoi(cp) < 70) { + sprintf((char *)&date[6], " 20%s", cp); } else { - sprintf((char *)&date[6], " %c%c%s", - LastYear[0], LastYear[1], cp); + sprintf((char *)&date[6], " 19%s", cp); } } else { /* Is this year, so show the time */ @@ -1936,12 +1934,10 @@ PRIVATE void parse_cms_dir_entry ARGS2( cpd += 6; /* Year */ if (strcmp((ThisYear+2), cpd)) { /* Not this year, so show the year. */ - if (atoi(cpd) < atoi((char *)&ThisYear[2])) { - sprintf((char *)&date[6], " %c%c%s", - ThisYear[0], ThisYear[1], cpd); + if (atoi(cpd) < 70) { + sprintf((char *)&date[6], " 20%s", cpd); } else { - sprintf((char *)&date[6], " %c%c%s", - LastYear[0], LastYear[1], cpd); + sprintf((char *)&date[6], " 19%s", cpd); } } else { /* Is this year, so show the time. */ diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c index 94815710..e2bcd56f 100644 --- a/WWW/Library/Implementation/HTFile.c +++ b/WWW/Library/Implementation/HTFile.c @@ -30,7 +30,7 @@ #include <dirent.h> #define USE_DIRENT #include "HTDOS.h" -#endif +#endif /* DOSPATH */ #include "HTUtils.h" #include "tcp.h" @@ -996,7 +996,7 @@ PUBLIC HTFormat HTCharsetFormat ARGS3( FREE(cp); /* - ** Set up defaults, if needed. - FM + ** Set up defaults, if needed. - FM */ if (!chartrans_ok && !anchor->charset && default_LYhndl >= 0) { HTAnchor_setUCInfoStage(anchor, default_LYhndl, @@ -1206,7 +1206,7 @@ PUBLIC void HTDirEntry ARGS3( ** ** On exit: ** Returns TRUE if an "Up to <parent>" link was not created -** for a readable local directiory because LONG_LIST is defined +** for a readable local directory because LONG_LIST is defined ** and NO_PARENT_DIR_REFERENCE is not defined, such that the ** calling function use LYListFmtParse() to create a link to ** the parent directory. Otherwise, it returns FALSE. - FM @@ -1439,7 +1439,7 @@ PUBLIC BOOL HTDirTitles ARGS3( ** This is the physical address of the file ** ** On exit: -** returns <0 Error has occured. +** returns <0 Error has occurred. ** HTLOADED OK ** */ @@ -1504,7 +1504,7 @@ PUBLIC int HTLoadFile ARGS4( /* * If content_type and content_encoding are BOTH already set * in the anchor object, we believe it and don't try to - * derive format and ancoding from the filename. - kw + * derive format and encoding from the filename. - kw */ format = HTAtom_for(anchor->content_type); myEncoding = HTAtom_for(anchor->content_encoding); @@ -1573,7 +1573,7 @@ PUBLIC int HTLoadFile ARGS4( fp = fopen(vmsname, "r", "shr=put", "shr=upd"); /* - ** If the file wasn't VMS syntax, then perhaps it is ultrix. + ** If the file wasn't VMS syntax, then perhaps it is Ultrix. */ if (!fp) { char ultrixname[INFINITY]; @@ -1726,7 +1726,7 @@ PUBLIC int HTLoadFile ARGS4( fclose(fp); } return status; - } /* If successfull open */ + } /* If successful open */ FREE(filename); } @@ -1884,7 +1884,7 @@ PUBLIC int HTLoadFile ARGS4( ** is create a new hypertext object containing a list of files and ** subdirectories contained in the directory. All of these are ** links to the directories or files listed. - ** NB This assumes the existance of a type 'STRUCT_DIRENT', which + ** NB This assumes the existence of a type 'STRUCT_DIRENT', which ** will hold the directory entry, and a type 'DIR' which is used ** to point to the current directory being read. */ @@ -1974,7 +1974,7 @@ PUBLIC int HTLoadFile ARGS4( */ StrAllocCopy (tail, "/foo/.."); } else { - char *p = strrchr(pathname, '/'); /* find lastslash */ + char *p = strrchr(pathname, '/'); /* find last slash */ if (!p) { /* @@ -2367,7 +2367,7 @@ PUBLIC int HTLoadFile ARGS4( fclose(fp); } return status; - } /* If succesfull open */ + } /* If successful open */ FREE(localname); } /* scope of fp */ } /* local unix file system */ @@ -2380,7 +2380,7 @@ PUBLIC int HTLoadFile ARGS4( */ { /* - ** Deal with case-sensitivity differences on VMS verus Unix. + ** Deal with case-sensitivity differences on VMS versus Unix. */ #ifdef VMS if (strcasecomp(nodename, HTHostName()) != 0) diff --git a/WWW/Library/Implementation/HTFile.h b/WWW/Library/Implementation/HTFile.h index ba94597a..b65c17e7 100644 --- a/WWW/Library/Implementation/HTFile.h +++ b/WWW/Library/Implementation/HTFile.h @@ -12,7 +12,9 @@ #include "HTFormat.h" #include "HTAccess.h" +#ifndef HTML_H #include "HTML.h" /* SCW */ +#endif /* HTML_H */ /* ** Controlling globals diff --git a/WWW/Library/Implementation/HTFormat.c b/WWW/Library/Implementation/HTFormat.c index cf36c304..c05af1fa 100644 --- a/WWW/Library/Implementation/HTFormat.c +++ b/WWW/Library/Implementation/HTFormat.c @@ -512,7 +512,7 @@ PUBLIC float HTStackValue ARGS4( PUBLIC int HTCopy ARGS4( HTParentAnchor *, anchor, int, file_number, - void*, handle, + void*, handle GCC_UNUSED, HTStream*, sink) { HTStreamClass targetClass; @@ -806,7 +806,7 @@ PRIVATE int HTGzFileCopy ARGS2( ** */ PUBLIC void HTCopyNoCR ARGS3( - HTParentAnchor *, anchor, + HTParentAnchor *, anchor GCC_UNUSED, int, file_number, HTStream*, sink) { diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c index 53e4149b..23e8f9d0 100644 --- a/WWW/Library/Implementation/HTGopher.c +++ b/WWW/Library/Implementation/HTGopher.c @@ -211,7 +211,7 @@ PRIVATE void write_anchor ARGS2(CONST char *,text, CONST char *,addr) ** ============================ */ PRIVATE void parse_menu ARGS2( - CONST char *, arg, + CONST char *, arg GCC_UNUSED, HTParentAnchor *, anAnchor) { char gtype; @@ -865,7 +865,7 @@ PRIVATE int interpret_cso_key ARGS5( /* ** No match, dump key to buffer so client sees it for debugging. */ - int out = 0; + size_t out = 0; while (*key && (*key != ')')) { buf[out++] = (*key++); if (out > sizeof(buf)-2) { @@ -936,7 +936,8 @@ PRIVATE int parse_cso_fields ARGS2( { char ch; char *p = buf; - int i, code = 0, prev_code, alen; + int i, code = 0, prev_code; + size_t alen; char *indx, *name; CSOfield_info *last, *new; @@ -1103,7 +1104,8 @@ PRIVATE int generate_cso_form ARGS4( char *, buf, HTStream *, Target) { - int i, j, length, out; + int i, j, length; + size_t out; int full_flag = 1; char *key, *line; CSOformgen_context ctx; diff --git a/WWW/Library/Implementation/HTML.h b/WWW/Library/Implementation/HTML.h deleted file mode 100644 index be492b28..00000000 --- a/WWW/Library/Implementation/HTML.h +++ /dev/null @@ -1,257 +0,0 @@ -/* HTML to rich text converter for libwww -** -** THE HTML TO RTF OBJECT CONVERTER -** -** This interprets the HTML semantics. -*/ -#ifndef HTML_H -#define HTML_H - -#ifndef HTUTILS_H -#include "HTUtils.h" -#endif /* HTUTILS_H */ -#include "UCDefs.h" -#include "UCAux.h" -#include "HTAnchor.h" -#include "HTMLDTD.h" - -#ifdef SHORT_NAMES -#define HTMLPresentation HTMLPren -#define HTMLPresent HTMLPres -#endif /* SHORT_NAMES */ - -extern CONST HTStructuredClass HTMLPresentation; - -#ifdef Lynx_HTML_Handler -/* -** This section is semi-private to HTML.c and it's helper modules. - FM -** -------------------------------------------------------------------- -*/ - -typedef struct _stack_element { - HTStyle * style; - int tag_number; -} stack_element; - -/* HTML Object -** ----------- -*/ -#define MAX_NESTING 800 /* Should be checked by parser */ - -struct _HTStructured { - CONST HTStructuredClass * isa; - HTParentAnchor * node_anchor; - HText * text; - - HTStream* target; /* Output stream */ - HTStreamClass targetClass; /* Output routines */ - - HTChildAnchor * CurrentA; /* current HTML_A anchor */ - int CurrentANum; /* current HTML_A number */ - char * base_href; /* current HTML_BASE href */ - char * map_address; /* current HTML_MAP address */ - - HTChunk title; /* Grow by 128 */ - HTChunk object; /* Grow by 128 */ - BOOL object_started; - BOOL object_declare; - BOOL object_shapes; - BOOL object_ismap; - char * object_usemap; - char * object_id; - char * object_title; - char * object_data; - char * object_type; - char * object_classid; - char * object_codebase; - char * object_codetype; - char * object_name; - HTChunk option; /* Grow by 128 */ - BOOL first_option; /* First OPTION in SELECT? */ - char * LastOptionValue; - BOOL LastOptionChecked; - BOOL select_disabled; - HTChunk textarea; /* Grow by 128 */ - char * textarea_name; - int textarea_name_cs; - char * textarea_accept_cs; - char * textarea_cols; - int textarea_rows; - int textarea_disabled; - char * textarea_id; - HTChunk math; /* Grow by 128 */ - HTChunk style_block; /* Grow by 128 */ - HTChunk script; /* Grow by 128 */ - - /* - * Used for nested lists. - FM - */ - int List_Nesting_Level; /* counter for list nesting level */ - int OL_Counter[12]; /* counter for ordered lists */ - char OL_Type[12]; /* types for ordered lists */ - int Last_OL_Count; /* last count in ordered lists */ - char Last_OL_Type; /* last type in ordered lists */ - - int Division_Level; - short DivisionAlignments[MAX_NESTING]; - int Underline_Level; - int Quote_Level; - - BOOL UsePlainSpace; - BOOL HiddenValue; - int lastraw; - - char * comment_start; /* for literate programming */ - char * comment_end; - - HTTag * current_tag; - BOOL style_change; - HTStyle * new_style; - HTStyle * old_style; - int current_default_alignment; - BOOL in_word; /* Have just had a non-white char */ - stack_element stack[MAX_NESTING]; - stack_element *sp; /* Style stack pointer */ - BOOL stack_overrun; /* Was MAX_NESTING exceeded? */ - int skip_stack; /* flag to skip next style stack operation */ - - /* - ** Track if we are in an anchor, paragraph, address, base, etc. - */ - BOOL inA; - BOOL inAPPLET; - BOOL inAPPLETwithP; - BOOL inBadBASE; - BOOL inBadHREF; - BOOL inBadHTML; - BOOL inBASE; - BOOL inBoldA; - BOOL inBoldH; - BOOL inCAPTION; - BOOL inCREDIT; - BOOL inFIG; - BOOL inFIGwithP; - BOOL inFONT; - BOOL inFORM; - BOOL inLABEL; - BOOL inP; - BOOL inPRE; - BOOL inSELECT; - BOOL inTABLE; - BOOL inTEXTAREA; - BOOL inUnderline; - - BOOL needBoldH; - - /* - ** UCI and UCLYhndl give the UCInfo and charset registered for - ** the HTML parser in the node_anchor's UCStages structure. It - ** indicates what is fed to the HTML parser as the stream of character - ** data (not necessarily tags and attributes). It should currently - ** always be set to be the same as UCI and UCLhndl for the HTEXT stage - ** in the node_anchor's UCStages structure, since the HTML parser sends - ** its input character data to the output without further charset - ** translation. - */ - LYUCcharset * UCI; - int UCLYhndl; - /* - ** inUCI and inUCLYhndl indicate the UCInfo and charset which the - ** HTML parser treats at the input charset. It is normally set - ** to the UCI and UCLhndl for the SGML parser in the node_anchor's - ** UCStages structure (which may be a dummy, based on the MIME - ** parser's UCI and UCLhndl in that structure, when we are handling - ** a local file or non-http(s) gateway). It could be changed - ** temporarily by the HTML parser, for conversions of attribute - ** strings, but should be reset once done. - FM - */ - LYUCcharset * inUCI; - int inUCLYhndl; - /* - ** outUCI and outUCLYhndl indicate the UCInfo and charset which - ** the HTML parser treats as the output charset. It is normally - ** set to its own UCI and UCLhndl. It could be changed for - ** conversions of attribute strings, but should be reset once - ** done. - FM - */ - LYUCcharset * outUCI; - int outUCLYhndl; - /* - ** T holds the transformation rules for conversions of strings - ** between the input and output charsets by the HTML parser. - FM - */ - UCTransParams T; - - int tag_charset; /* charset for attribute values etc. */ -}; - -struct _HTStream { - CONST HTStreamClass * isa; - /* .... */ -}; - -/* - * Semi-Private functions. - FM - */ -extern void HTML_put_character PARAMS((HTStructured *me, char c)); -extern void HTML_put_string PARAMS((HTStructured *me, CONST char *s)); -extern void HTML_write PARAMS((HTStructured *me, CONST char *s, int l)); -extern int HTML_put_entity PARAMS((HTStructured *me, int entity_number)); -#endif /* Lynx_HTML_Handler */ - -/* P U B L I C -*/ - -/* -** HTConverter to present HTML -*/ -extern HTStream* HTMLToPlain PARAMS(( - HTPresentation * pres, - HTParentAnchor * anchor, - HTStream * sink)); - -extern HTStream* HTMLToC PARAMS(( - HTPresentation * pres, - HTParentAnchor * anchor, - HTStream * sink)); - -extern HTStream* HTMLPresent PARAMS(( - HTPresentation * pres, - HTParentAnchor * anchor, - HTStream * sink)); - -extern HTStructured* HTML_new PARAMS(( - HTParentAnchor * anchor, - HTFormat format_out, - HTStream * target)); - -/* -** Names for selected internal representations. -*/ -typedef enum _HTMLCharacterSet { - HTML_ISO_LATIN1, - HTML_NEXT_CHARS, - HTML_PC_CP950 -} HTMLCharacterSet; - -/* -** Record error message as a hypertext object. -** -** The error message should be marked as an error so that it can be -** reloaded later. This implementation just throws up an error message -** and leaves the document unloaded. -** -** On entry, -** sink is a stream to the output device if any -** number is the HTTP error number -** message is the human readable message. -** On exit, -** a retrun code like HT_LOADED if object exists else 60; 0 -*/ -extern int HTLoadError PARAMS(( - HTStream * sink, - int number, - CONST char * message)); - -#endif /* HTML_H */ - diff --git a/WWW/Library/Implementation/HTMLDTD.c b/WWW/Library/Implementation/HTMLDTD.c index 441f081f..0d616bf1 100644 --- a/WWW/Library/Implementation/HTMLDTD.c +++ b/WWW/Library/Implementation/HTMLDTD.c @@ -13,6 +13,8 @@ ** ------------ ** ** This table must be matched exactly with ALL the translation tables +** (this is an obsolete translation mechanism, +** currently replaced with unicode chartrans in most cases...) */ static CONST char* entities[] = { "AElig", /* capital AE diphthong (ligature) */ @@ -63,7 +65,7 @@ static CONST char* entities[] = { "copy", /* copyright sign */ "curren", /* currency sign */ "deg", /* degree sign */ - "die", /* spacing diaresis */ + "die", /* spacing dieresis */ "divide", /* division sign */ "eacute", /* small e, acute accent */ "ecirc", /* small e, circumflex accent */ @@ -106,7 +108,7 @@ static CONST char* entities[] = { "para", /* paragraph sign */ "plusmn", /* plus-or-minus sign */ "pound", /* pound sign */ - "quot", /* quot '"' */ + "quot", /* quote '"' */ "raquo", /* angle quotation mark, right */ "reg", /* circled R registered sign */ "sect", /* section sign */ @@ -122,7 +124,7 @@ static CONST char* entities[] = { "uacute", /* small u, acute accent */ "ucirc", /* small u, circumflex accent */ "ugrave", /* small u, grave accent */ - "uml", /* spacing diaresis */ + "uml", /* spacing dieresis */ "uuml", /* small u, dieresis or umlaut mark */ "yacute", /* small y, acute accent */ "yen", /* yen sign */ @@ -136,7 +138,7 @@ static CONST char* entities[] = { /* Attribute Lists ** --------------- ** -** Lists must be in alphatbetical order by attribute name +** Lists must be in alphabetical order by attribute name ** The tag elements contain the number of attributes */ static attr a_attr[] = { /* Anchor attributes */ @@ -351,7 +353,7 @@ static attr credit_attr[] = { /* CREDIT attributes */ { 0 } /* Terminate list */ }; -static attr div_attr[] = { /* DIV attribures */ +static attr div_attr[] = { /* DIV attributes */ { "ALIGN" }, { "CLASS" }, { "CLEAR" }, @@ -614,7 +616,7 @@ static attr input_attr[] = { /* INPUT attributes */ static attr isindex_attr[] = { /* ISINDEX attributes */ { "ACTION" }, /* Not in spec. Lynx treats it as HREF. - FM */ { "DIR" }, - { "HREF" }, /* HTML 3.0 attritute for search action. - FM */ + { "HREF" }, /* HTML 3.0 attribute for search action. - FM */ { "ID" }, { "LANG" }, { "PROMPT" }, /* HTML 3.0 attribute for prompt string. - FM */ @@ -724,7 +726,7 @@ static attr meta_attr[] = { /* META attributes */ { 0 } /* Terminate list */ }; -static attr nextid_attr[] = { /* NEXTID attribures */ +static attr nextid_attr[] = { /* NEXTID attributes */ { "N" } }; @@ -832,7 +834,7 @@ static attr p_attr[] = { /* P attributes */ { 0 } /* Terminate list */ }; -static attr param_attr[] = { /* PARAM attribures */ +static attr param_attr[] = { /* PARAM attributes */ { "ACCEPT" }, { "ACCEPT-CHARSET" }, { "ACCEPT-ENCODING" }, @@ -854,7 +856,7 @@ static attr param_attr[] = { /* PARAM attribures */ { 0 } /* Terminate list */ }; -static attr script_attr[] = { /* SCRIPT attribures */ +static attr script_attr[] = { /* SCRIPT attributes */ { "CLASS" }, { "CLEAR" }, { "DIR" }, @@ -1580,8 +1582,8 @@ PUBLIC CONST SGML_dtd HTML_dtd = { HTML_ELEMENTS, entities, sizeof(entities)/sizeof(entities[0]), - extra_entities, - sizeof(extra_entities)/sizeof(extra_entities[0]) + unicode_entities, + sizeof(unicode_entities)/sizeof(unicode_entities[0]) }; /* This function fills the "tags" part of the HTML_dtd structure with diff --git a/WWW/Library/Implementation/HTMLGen.c b/WWW/Library/Implementation/HTMLGen.c index a918f96c..1839f3c4 100644 --- a/WWW/Library/Implementation/HTMLGen.c +++ b/WWW/Library/Implementation/HTMLGen.c @@ -263,8 +263,8 @@ PRIVATE void HTMLGen_start_element ARGS6( int, element_number, CONST BOOL*, present, CONST char **, value, - int, charset, - char **, insert) + int, charset GCC_UNUSED, + char **, insert GCC_UNUSED) { int i; BOOL was_preformatted = me->preformatted; @@ -344,7 +344,7 @@ PRIVATE void HTMLGen_start_element ARGS6( PRIVATE void HTMLGen_end_element ARGS3( HTStructured *, me, int, element_number, - char **, insert) + char **, insert GCC_UNUSED) { if (!me->preformatted && HTML_dtd.tags[element_number].contents != SGML_EMPTY) { @@ -404,14 +404,14 @@ PRIVATE void PlainToHTML_free ARGS1( PRIVATE void HTMLGen_abort ARGS2( HTStructured *, me, - HTError, e) + HTError, e GCC_UNUSED) { HTMLGen_free(me); } PRIVATE void PlainToHTML_abort ARGS2( HTStructured *, me, - HTError, e) + HTError, e GCC_UNUSED) { PlainToHTML_free(me); } @@ -513,8 +513,8 @@ PRIVATE CONST HTStructuredClass PlainToHTMLConversion = ** ------------------------------------------ */ PUBLIC HTStream* HTPlainToHTML ARGS3( - HTPresentation *, pres, - HTParentAnchor *, anchor, + HTPresentation *, pres GCC_UNUSED, + HTParentAnchor *, anchor GCC_UNUSED, HTStream *, sink) { HTStructured *me = (HTStructured *)malloc(sizeof(*me)); diff --git a/WWW/Library/Implementation/HTPlain.c b/WWW/Library/Implementation/HTPlain.c index 91a2585b..dda98d5f 100644 --- a/WWW/Library/Implementation/HTPlain.c +++ b/WWW/Library/Implementation/HTPlain.c @@ -12,6 +12,12 @@ #include "HTPlain.h" +#include "HTChunk.h" +#include "HText.h" +#include "HTStyle.h" +#define Lynx_HTML_Handler +#include "HTML.h" /* styles[] */ + #define BUFFER_SIZE 4096; /* Tradeoff */ #include "HText.h" @@ -27,8 +33,6 @@ #define FREE(x) if (x) {free(x); x = NULL;} -extern HTStyleSheet * styleSheet; - extern BOOLEAN LYRawMode; extern BOOL HTPassEightBitRaw; extern BOOL HTPassHighCtrlRaw; @@ -43,23 +47,23 @@ struct _HTStream { CONST HTStreamClass * isa; HText * text; /* - ** The node_anchor UCInfo and handle for the input (PARSER) stage. - FM + ** The node_anchor UCInfo and handle for the input (PARSER) stage. - FM */ - LYUCcharset * inUCI; - int inUCLYhndl; + LYUCcharset * inUCI; + int inUCLYhndl; /* - ** The node_anchor UCInfo and handle for the output (HTEXT) stage. - FM + ** The node_anchor UCInfo and handle for the output (HTEXT) stage. - FM */ int outUCLYhndl; /* - ** Counter, value, buffer and pointer for UTF-8 handling. - FM + ** Counter, value, buffer and pointer for UTF-8 handling. - FM */ char utf_count; UCode_t utf_char; char utf_buf[8]; char * utf_buf_p; /* - ** The charset transformation structure. - FM + ** The charset transformation structure. - FM */ UCTransParams T; }; @@ -256,7 +260,7 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) /* ** Combine UTF-8 into Unicode. ** Incomplete characters silently ignored. - ** from Linux kernel's console.c - KW + ** from Linux kernel's console.c - KW */ if (c_unsign > 127) { /* @@ -264,9 +268,9 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) */ if (me->utf_count > 0 && (c & 0xc0) == 0x80) { /* - ** Adjust the UCode_t value, add the octet - ** to the buffer, and decrement the byte - ** count. - FM + ** Adjust the UCode_t value, add the octet + ** to the buffer, and decrement the byte + ** count. - FM */ me->utf_char = (me->utf_char << 6) | (c & 0x3f); me->utf_count--; @@ -289,7 +293,7 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) } } else { /* - ** Start handling a new multibyte character. - FM + ** Start handling a new multibyte character. - FM */ me->utf_buf_p = me->utf_buf; me->utf_buf_p[0] = c; @@ -318,7 +322,7 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) me->utf_buf_p[0] = '\0'; } /* - ** Get the next byte. - FM + ** Get the next byte. - FM */ continue; } @@ -609,7 +613,7 @@ PRIVATE void HTPlain_free ARGS1( */ PRIVATE void HTPlain_abort ARGS2( HTStream *, me, - HTError, e) + HTError, e GCC_UNUSED) { HTPlain_free(me); } @@ -629,9 +633,9 @@ PUBLIC CONST HTStreamClass HTPlain = ** ---------- */ PUBLIC HTStream* HTPlainPresent ARGS3( - HTPresentation *, pres, + HTPresentation *, pres GCC_UNUSED, HTParentAnchor *, anchor, - HTStream *, sink) + HTStream *, sink GCC_UNUSED) { HTStream* me = (HTStream*)malloc(sizeof(*me)); @@ -654,7 +658,7 @@ PUBLIC HTStream* HTPlainPresent ARGS3( HTAnchor_getUCInfoStage(anchor,UCT_STAGE_HTEXT)); me->text = HText_new(anchor); - HText_setStyle(me->text, HTStyleNamed(styleSheet, "Example")); + HText_setStyle(me->text, styles[HTML_XMP] ); HText_beginAppend(me->text); return (HTStream*) me; diff --git a/WWW/Library/Implementation/HTString.c b/WWW/Library/Implementation/HTString.c index bc3c3334..5f358b97 100644 --- a/WWW/Library/Implementation/HTString.c +++ b/WWW/Library/Implementation/HTString.c @@ -11,6 +11,7 @@ #include "tcp.h" #include "LYLeaks.h" +#include "LYStrings.h" #define FREE(x) if (x) {free(x); x = NULL;} @@ -22,6 +23,58 @@ PUBLIC int WWW_TraceFlag = 0; /* Global trace flag for ALL W3 code */ PUBLIC CONST char * HTLibraryVersion = VC; /* String for help screen etc */ +/* +** strcasecomp8 is a variant of strcasecomp (below) +** ------------ ----------- +** but uses 8bit upper/lower case information +** from the current display charset. +** It returns 0 if exact match. +*/ +PUBLIC int strcasecomp8 ARGS2( + CONST char*, a, + CONST char *, b) +{ + CONST char *p = a; + CONST char *q = b; + + for ( ; *p && *q; p++, q++) { + int diff = UPPER8(*p, *q); + if (diff) return diff; + } + if (*p) + return 1; /* p was longer than q */ + if (*q) + return -1; /* p was shorter than q */ + return 0; /* Exact match */ +} + +/* +** strncasecomp8 is a variant of strncasecomp (below) +** ------------- ------------ +** but uses 8bit upper/lower case information +** from the current display charset. +** It returns 0 if exact match. +*/ +PUBLIC int strncasecomp8 ARGS3( + CONST char*, a, + CONST char *, b, + int, n) +{ + CONST char *p = a; + CONST char *q = b; + + for ( ; ; p++, q++) { + int diff; + if (p == (a+n)) + return 0; /* Match up to n characters */ + if (!(*p && *q)) + return (*p - *q); + diff = UPPER8(*p, *q); + if (diff) + return diff; + } + /*NOTREACHED*/ +} #ifndef VM /* VM has these already it seems */ /* Strings of any length @@ -34,7 +87,7 @@ PUBLIC int strcasecomp ARGS2( CONST char *p = a; CONST char *q = b; - for (p = a, q = b; *p && *q; p++, q++) { + for ( ; *p && *q; p++, q++) { int diff = TOLOWER(*p) - TOLOWER(*q); if (diff) return diff; } @@ -57,7 +110,7 @@ PUBLIC int strncasecomp ARGS3( CONST char *p = a; CONST char *q = b; - for (p = a, q = b; ; p++, q++) { + for ( ; ; p++, q++) { int diff; if (p == (a+n)) return 0; /* Match up to n characters */ diff --git a/WWW/Library/Implementation/HTString.h b/WWW/Library/Implementation/HTString.h index fb2d3397..0b2c23dc 100644 --- a/WWW/Library/Implementation/HTString.h +++ b/WWW/Library/Implementation/HTString.h @@ -25,6 +25,15 @@ Case-insensitive string comparison extern int strcasecomp PARAMS((CONST char *a, CONST char *b)); extern int strncasecomp PARAMS((CONST char *a, CONST char *b, int n)); +extern int strcasecomp8 PARAMS((CONST char *a, CONST char *b)); +extern int strncasecomp8 PARAMS((CONST char *a, CONST char *b, int n)); + /* + ** strcasecomp8 and strncasecomp8 are variants of strcasecomp + ** and strncasecomp, but use 8bit upper/lower case information + ** from the current display charset + */ + + /* Malloced string manipulation diff --git a/WWW/Library/Implementation/HTStyle.h b/WWW/Library/Implementation/HTStyle.h index 99f57e54..bbab0ea6 100644 --- a/WWW/Library/Implementation/HTStyle.h +++ b/WWW/Library/Implementation/HTStyle.h @@ -1,33 +1,33 @@ /* HTStyle: Style management for libwww STYLE DEFINITION FOR HYPERTEXT - + Styles allow the translation between a logical property of a piece of text and its physical representation. - + A StyleSheet is a collection of styles, defining the translation necessary to represent a document. It is a linked list of styles. - + Overriding this module Why is the style structure declared in the HTStyle.h module, instead of having the user browser define the structure, and the HTStyle routines just use sizeof() for copying? - + It's not obvious whether HTStyle.c should be common code. It's useful to have common code for loading style sheets, especially if the movement toward standard style sheets gets going. - + If it IS common code, then both the hypertext object and HTStyle.c must know the structure of a style, so HTStyle.h is a suitable place to put that. HTStyle.c has to be compiled with a knowledge of the - + It we take it out of the library, then of course HTStyle could be declared as an undefined structure. The only references to it are in the structure-flattening code HTML.c and HTPlain.c, which only use HTStypeNamed(). - + You can in any case override this function in your own code, which will prevent the HTStyle from being loaded. You will be able to redefine your style structure in this case without problems, as no other moule needs to know it. - + */ #ifndef HTStyle_H #define HTStyle_H @@ -80,7 +80,7 @@ typedef int HTColor; /* Sorry about the US spelling! */ #define STYLE_NAME_LENGTH 80 /* @@@@@@@@@@@ */ - + typedef struct { short kind; /* only NX_LEFTTAB implemented*/ HTCoord position; /* x coordinate for stop */ @@ -118,7 +118,7 @@ typedef struct _HTStyle { short alignment; /* quad justification */ HTCoord lineHt; /* line height */ HTCoord descentLine; /* descender bottom from baseline */ - HTTabStop *tabs; /* array of tab stops, 0 terminated */ + CONST HTTabStop *tabs; /* array of tab stops, 0 terminated */ BOOL wordWrap; /* Yes means wrap at space not char */ BOOL freeFormat; /* Yes means \n is just white space */ @@ -140,7 +140,7 @@ typedef struct _HTStyle { /* Style functions: */ extern HTStyle * HTStyleNew NOPARAMS; -extern HTStyle* HTStyleNewNamed PARAMS ((CONST char * name)); +extern HTStyle * HTStyleNewNamed PARAMS ((CONST char * name)); extern HTStyle * HTStyleFree PARAMS((HTStyle * self)); #ifdef SUPRESS extern HTStyle * HTStyleRead PARAMS((HTStyle * self, HTStream * stream)); @@ -175,9 +175,8 @@ extern HTStyleSheet * HTStyleSheetWrite PARAMS((HTStyleSheet * self, HTStream * stream)); #endif #define CLEAR_POINTER ((void *)-1) /* Pointer value means "clear me" */ -#endif /* HTStyle_H */ - -/* +/* DefaultStyle.c */ +extern HTStyleSheet * DefaultStyle NOPARAMS; - */ +#endif /* HTStyle_H */ diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c index 913460bb..dab7ab73 100644 --- a/WWW/Library/Implementation/HTTCP.c +++ b/WWW/Library/Implementation/HTTCP.c @@ -4,16 +4,16 @@ ** This code is in common between client and server sides. ** ** 16 Jan 92 TBL Fix strtol() undefined on CMU Mach. -** 25 Jun 92 JFG Added DECNET option through TCP socket emulation. -** 13 Sep 93 MD Added correct return of vmserrorno for HTInetStatus. +** 25 Jun 92 JFG Added DECNET option through TCP socket emulation. +** 13 Sep 93 MD Added correct return of vmserrorno for HTInetStatus. ** Added decoding of vms error message for MULTINET. -** 7-DEC-1993 Bjorn S. Nilsson, ALEPH, CERN, VMS UCX ioctl() changes +** 7-DEC-1993 Bjorn S. Nilsson, ALEPH, CERN, VMS UCX ioctl() changes ** (done of Mosaic) -** 19 Feb 94 Danny Mayer Added Bjorn Fixes to Lynx version -** 7 Mar 94 Danny Mayer Added Fix UCX version for full domain name -** 20 May 94 Andy Harper Added support for CMU TCP/IP transport -** 17 Nov 94 Andy Harper Added support for SOCKETSHR transport -** 16 Jul 95 S. Bjorndahl added kluge to deal with LIBCMU bug +** 19 Feb 94 Danny Mayer Added Bjorn Fixes to Lynx version +** 7 Mar 94 Danny Mayer Added Fix UCX version for full domain name +** 20 May 94 Andy Harper Added support for CMU TCP/IP transport +** 17 Nov 94 Andy Harper Added support for SOCKETSHR transport +** 16 Jul 95 S. Bjorndahl added kluge to deal with LIBCMU bug */ #include "HTUtils.h" @@ -27,17 +27,17 @@ #include <signal.h> #include <sys/wait.h> #endif /* NSL_FORK */ - + #define FREE(x) if (x) {free(x); x = NULL;} extern int HTCheckForInterrupt NOPARAMS; #ifdef SVR4_BSDSELECT PUBLIC int BSDselect PARAMS(( - int nfds, - fd_set * readfds, + int nfds, + fd_set * readfds, fd_set * writefds, - fd_set * exceptfds, + fd_set * exceptfds, struct timeval * timeout)); #ifdef select #undef select @@ -55,7 +55,7 @@ PUBLIC int BSDselect PARAMS(( #ifdef SHORT_NAMES #define HTInetStatus HTInStat -#define HTInetString HTInStri +#define HTInetString HTInStri #define HTParseInet HTPaInet #endif /* SHORT_NAMES */ @@ -88,10 +88,10 @@ PUBLIC unsigned long socks_bind_remoteAddr; /* for long Rbind */ ** ** On entry, ** where gives a description of what caused the error -** global errno gives the error number in the unix way. +** global errno gives the error number in the Unix way. ** ** On return, -** returns a negative status in the unix way. +** returns a negative status in the Unix way. */ #ifndef PCNFS @@ -119,7 +119,7 @@ extern int sys_nerr; #if defined(VMS) && defined(UCX) /* -** A routine to mimick the ioctl function for UCX. +** A routine to mimic the ioctl function for UCX. ** Bjorn S. Nilsson, 25-Nov-1993. Based on an example in the UCX manual. */ #include <iodef.h> @@ -127,7 +127,7 @@ extern int sys_nerr; extern int vaxc$get_sdc(), sys$qiow(); PUBLIC int HTioctl ARGS3( - int, d, + int, d, int, request, int *, argp) { @@ -135,41 +135,41 @@ PUBLIC int HTioctl ARGS3( unsigned short fun, iosb[4]; char *p5, *p6; struct comm { - int command; - char *addr; + int command; + char *addr; } ioctl_comm; struct it2 { - unsigned short len; - unsigned short opt; - struct comm *addr; + unsigned short len; + unsigned short opt; + struct comm *addr; } ioctl_desc; if ((sdc = vaxc$get_sdc (d)) == 0) { - errno = EBADF; - return -1; + errno = EBADF; + return -1; } ioctl_desc.opt = UCX$C_IOCTL; ioctl_desc.len = sizeof(struct comm); ioctl_desc.addr = &ioctl_comm; if (request & IOC_OUT) { - fun = IO$_SENSEMODE; - p5 = 0; - p6 = (char *)&ioctl_desc; + fun = IO$_SENSEMODE; + p5 = 0; + p6 = (char *)&ioctl_desc; } else { - fun = IO$_SETMODE; - p5 = (char *)&ioctl_desc; - p6 = 0; + fun = IO$_SETMODE; + p5 = (char *)&ioctl_desc; + p6 = 0; } ioctl_comm.command = request; ioctl_comm.addr = (char *)argp; status = sys$qiow (0, sdc, fun, iosb, 0, 0, 0, 0, 0, 0, p5, p6); if (!(status & 01)) { - errno = status; - return -1; + errno = status; + return -1; } if (!(iosb[0] & 01)) { - errno = iosb[0]; - return -1; + errno = iosb[0]; + return -1; } return 0; } @@ -179,7 +179,7 @@ PUBLIC int HTioctl ARGS3( ** --------------------- */ PUBLIC int HTInetStatus ARGS1( - char *, where) + char *, where) { #ifdef VMS #ifdef MULTINET @@ -188,7 +188,7 @@ PUBLIC int HTInetStatus ARGS1( #endif /* VMS */ CTRACE(tfp, - "TCP: Error %d in `SOCKET_ERRNO' after call to %s() failed.\n\t%s\n", + "TCP: Error %d in `SOCKET_ERRNO' after call to %s() failed.\n\t%s\n", SOCKET_ERRNO, where, /* third arg is transport/platform specific */ #ifdef VM @@ -198,7 +198,7 @@ PUBLIC int HTInetStatus ARGS1( #ifdef VMS #ifdef MULTINET - vms_errno_string()); + vms_errno_string()); #else ((SOCKET_ERRNO > 0 && SOCKET_ERRNO <= 65) ? strerror(SOCKET_ERRNO) : "(Error number not translated)")); @@ -219,17 +219,17 @@ PUBLIC int HTInetStatus ARGS1( #ifdef VMS #ifndef MULTINET CTRACE(tfp, - " Unix error number (SOCKET_ERRNO) = %ld dec\n", + " Unix error number (SOCKET_ERRNO) = %ld dec\n", SOCKET_ERRNO); CTRACE(tfp, - " VMS error (vaxc$errno) = %lx hex\n", + " VMS error (vaxc$errno) = %lx hex\n", vaxc$errno); #endif /* MULTINET */ #endif /* VMS */ #ifdef VMS /* - ** uerrno and errno happen to be zero if vmserrno <> 0 + ** uerrno and errno happen to be zero if vmserrno <> 0 */ #ifdef MULTINET return -vmserrno; @@ -261,32 +261,32 @@ PUBLIC unsigned int HTCardinal ARGS3( { unsigned int n; if ((**pp<'0') || (**pp>'9')) { /* Null string is error */ - *pstatus = -3; /* No number where one expeceted */ + *pstatus = -3; /* No number where one expected */ return 0; } n = 0; while ((**pp >= '0') && (**pp <= '9')) - n = n*10 + *((*pp)++) - '0'; + n = n*10 + *((*pp)++) - '0'; if (n > max_value) { - *pstatus = -4; /* Cardinal outside range */ + *pstatus = -4; /* Cardinal outside range */ return 0; } return n; } -#ifndef DECNET /* Function only used below for a trace message */ +#ifndef DECNET /* Function only used below for a trace message */ /* Produce a string for an Internet address ** ---------------------------------------- ** ** On exit, -** returns a pointer to a static string which must be copied if +** returns a pointer to a static string which must be copied if ** it is to be kept. */ PUBLIC CONST char * HTInetString ARGS1( - SockA*, soc_in) + SockA*, soc_in) { static char string[16]; sprintf(string, "%d.%d.%d.%d", @@ -307,7 +307,7 @@ PUBLIC CONST char * HTInetString ARGS1( ** soc_in points to the binary internet or decnet address field. ** ** On exit, -** *soc_in is filled in. If no port is specified in str, that +** *soc_in is filled in. If no port is specified in str, that ** field is left unchanged in *soc_in. */ PUBLIC int HTParseInet ARGS2( @@ -320,7 +320,7 @@ PUBLIC int HTParseInet ARGS2( struct hostent *phost; /* Pointer to host - See netdb.h */ if (!str) { - if (TRACE) { + if (TRACE) { fprintf(stderr, "HTParseInet: Can't parse `NULL'.\n"); } return -1; @@ -334,11 +334,11 @@ PUBLIC int HTParseInet ARGS2( StrAllocCopy(host, str); /* Make a copy we can mutilate */ /* - ** Parse port number if present. - */ + ** Parse port number if present. + */ if ((port = strchr(host, ':')) != NULL) { - *port++ = 0; /* Chop off port */ - if (port[0] >= '0' && port[0] <= '9') { + *port++ = 0; /* Chop off port */ + if (port[0] >= '0' && port[0] <= '9') { #ifdef unix soc_in->sin_port = htons(atol(port)); #else /* VMS: */ @@ -348,7 +348,7 @@ PUBLIC int HTParseInet ARGS2( soc_in->sin_port = htons((unsigned short)strtol(port,(char**)0,10)); #endif /* Decnet */ #endif /* Unix vs. VMS */ -#ifdef SUPPRESS /* 1. crashes!?!. 2. Not recommended */ +#ifdef SUPPRESS /* 1. crashes!?!. 2. Not recommended */ } else { struct servent * serv = getservbyname(port, (char*)0); if (serv) { @@ -362,13 +362,13 @@ PUBLIC int HTParseInet ARGS2( #ifdef DECNET /* - ** Read Decnet node name. @@ Should know about DECnet addresses, but - ** it's probably worth waiting until the Phase transition from IV to V. + ** Read Decnet node name. @@ Should know about DECnet addresses, but + ** it's probably worth waiting until the Phase transition from IV to V. */ soc_in->sdn_nam.n_len = min(DN_MAXNAML, strlen(host)); /* <=6 in phase 4 */ strncpy(soc_in->sdn_nam.n_name, host, soc_in->sdn_nam.n_len + 1); if (TRACE) { - fprintf(stderr, + fprintf(stderr, "DECnet: Parsed address as object number %d on host %.6s...\n", soc_in->sdn_objnum, host); } @@ -390,8 +390,8 @@ PUBLIC int HTParseInet ARGS2( } /* - ** Parse host number if present. - */ + ** Parse host number if present. + */ if (dotcount_ip == 3) { /* Numeric node address: */ #ifdef DJGPP @@ -409,7 +409,7 @@ PUBLIC int HTParseInet ARGS2( #endif /* DJGPP */ FREE(host); } else { /* Alphanumeric node name: */ -#ifdef MVS /* Oustanding problem with crash in MVS gethostbyname */ +#ifdef MVS /* Outstanding problem with crash in MVS gethostbyname */ if (TRACE) { fprintf(stderr, "HTParseInet: Calling gethostbyname(%s)\n", host); @@ -421,9 +421,9 @@ PUBLIC int HTParseInet ARGS2( ** Start block for fork-based gethostbyname() with ** checks for interrupts. - Tom Zerucha (tz@execpc.com) & FM */ - { + { /* - ** Pipe, child pid, and status buffers. + ** Pipe, child pid, and status buffers. */ pid_t fpid, waitret = (pid_t)0; int pfd[2], cstat, cst1 = 0; @@ -431,7 +431,7 @@ PUBLIC int HTParseInet ARGS2( pipe(pfd); if ((fpid = fork()) == 0 ) { - /* + /* ** Child - for the long call. */ phost = gethostbyname(host); @@ -450,11 +450,11 @@ PUBLIC int HTParseInet ARGS2( } /* - ** (parent) Wait until lookup finishes, or interrupt. + ** (parent) Wait until lookup finishes, or interrupt. */ cstat = 0; while (cstat <= 0) { - /* + /* ** Exit when data sent. */ IOCTL(pfd[0], FIONREAD, &cstat); @@ -512,41 +512,41 @@ PUBLIC int HTParseInet ARGS2( } } /* - ** Read as much as we can - should be the address. + ** Read as much as we can - should be the address. */ IOCTL(pfd[0], FIONREAD, &cstat); if (cstat < 4) { if (TRACE) { - fprintf(stderr, + fprintf(stderr, "HTParseInet: NSL_FORK child returns only %d bytes.\n", cstat); fprintf(stderr, - " Trying again without forking.\n"); + " Trying again without forking.\n"); } phost = gethostbyname(host); /* See netdb.h */ if (!phost) { if (TRACE) { - fprintf(stderr, + fprintf(stderr, "HTParseInet: Can't find internet node name `%s'.\n", host); } memset((void *)&soc_in->sin_addr, 0, sizeof(soc_in->sin_addr)); } else { memcpy((void *)&soc_in->sin_addr, - phost->h_addr, phost->h_length); + phost->h_addr, phost->h_length); } #ifdef NOTDEFINED - cstat = read(pfd[0], (void *)&soc_in->sin_addr , 4); + cstat = read(pfd[0], (void *)&soc_in->sin_addr , 4); #endif /* NOTDEFINED */ } else { - cstat = read(pfd[0], (void *)&soc_in->sin_addr , cstat); + cstat = read(pfd[0], (void *)&soc_in->sin_addr , cstat); } close(pfd[0]); close(pfd[1]); } if (soc_in->sin_addr.s_addr == 0) { if (TRACE) { - fprintf(stderr, + fprintf(stderr, "HTParseInet: Can't find internet node name `%s'.\n", host); } @@ -563,7 +563,7 @@ PUBLIC int HTParseInet ARGS2( #else /* Not NSL_FORK: */ #ifdef DJGPP - soc_in->sin_addr.s_addr = htonl(resolve(host)); + soc_in->sin_addr.s_addr = htonl(resolve(host)); FREE(host); if (soc_in->sin_addr.s_addr == 0) { if (TRACE) @@ -581,12 +581,12 @@ PUBLIC int HTParseInet ARGS2( #endif /* MVS */ if (!phost) { if (TRACE) { - fprintf(stderr, + fprintf(stderr, "HTParseInet: Can't find internet node name `%s'.\n", host); } FREE(host); - return -1; /* Fail? */ + return -1; /* Fail? */ } FREE(host); #if defined(VMS) && defined(CMU_TCP) @@ -594,9 +594,9 @@ PUBLIC int HTParseInet ARGS2( ** In LIBCMU, phost->h_length contains not the length of one address ** (four bytes) but the number of bytes in *h_addr, i.e. some multiple ** of four. Thus we need to hard code the value here, and remember to - ** change it if/when IP addresses change in size. :-( LIBCMU is no + ** change it if/when IP addresses change in size. :-( LIBCMU is no ** longer supported, and CMU users are encouraged to obtain and use - ** SOCKETSHR/NETLIB instead. - S. Bjorndahl + ** SOCKETSHR/NETLIB instead. - S. Bjorndahl */ memcpy((void *)&soc_in->sin_addr, phost->h_addr, 4); #else @@ -607,7 +607,7 @@ PUBLIC int HTParseInet ARGS2( } if (TRACE) { - fprintf(stderr, + fprintf(stderr, "HTParseInet: Parsed address as port %d, IP address %d.%d.%d.%d\n", (int)ntohs(soc_in->sin_port), (int)*((unsigned char *)(&soc_in->sin_addr)+0), @@ -615,7 +615,7 @@ PUBLIC int HTParseInet ARGS2( (int)*((unsigned char *)(&soc_in->sin_addr)+2), (int)*((unsigned char *)(&soc_in->sin_addr)+3)); } -#endif /* Internet vs. Decnet */ +#endif /* Internet vs. Decnet */ return 0; /* OK */ } @@ -647,32 +647,32 @@ PRIVATE void get_host_details NOARGS struct hostent * phost; /* Pointer to host -- See netdb.h */ #endif /* NEED_HOST_ADDRESS */ int namelength = sizeof(name); - + if (hostname) - return; /* Already done */ + return; /* Already done */ gethostname(name, namelength); /* Without domain */ StrAllocCopy(hostname, name); atexit(free_HTTCP_hostname); #ifdef UCX /* - ** UCX doesn't give the complete domain name. - ** Get rest from UCX$BIND_DOM logical. + ** UCX doesn't give the complete domain name. + ** Get rest from UCX$BIND_DOM logical. */ - if (strchr(hostname,'.') == NULL) { /* Not full address */ - domain_name = getenv("UCX$BIND_DOMAIN"); - if (domain_name != NULL) { - StrAllocCat(hostname, "."); - StrAllocCat(hostname, domain_name); - } + if (strchr(hostname,'.') == NULL) { /* Not full address */ + domain_name = getenv("UCX$BIND_DOMAIN"); + if (domain_name != NULL) { + StrAllocCat(hostname, "."); + StrAllocCat(hostname, domain_name); + } } #endif /* UCX */ CTRACE(tfp, "TCP: Local host name is %s\n", hostname); -#ifndef DECNET /* Decnet ain't got no damn name server 8#OO */ +#ifndef DECNET /* Decnet ain't got no damn name server 8#OO */ #ifdef NEED_HOST_ADDRESS /* no -- needs name server! */ phost = gethostbyname(name); /* See netdb.h */ if (!phost) { - if (TRACE) fprintf(stderr, + if (TRACE) fprintf(stderr, "TCP: Can't find my own internet node address for `%s'!!\n", name); return; /* Fail! */ @@ -696,11 +696,11 @@ PUBLIC CONST char * HTHostName NOARGS ** Interruptable connect as implemented for Mosaic by Marc Andreesen ** and hacked in for Lynx years ago by Lou Montulli, and further ** modified over the years by numerous Lynx lovers. - FM -*/ +*/ PUBLIC int HTDoConnect ARGS4( CONST char *, url, - char *, protocol, - int, default_port, + char *, protocol, + int, default_port, int *, s) { struct sockaddr_in soc_address; @@ -712,13 +712,13 @@ PUBLIC int HTDoConnect ARGS4( char *host = NULL; /* - ** Set up defaults. + ** Set up defaults. */ soc_in->sin_family = AF_INET; soc_in->sin_port = htons(default_port); /* - ** Get node name and optional port number. + ** Get node name and optional port number. */ p1 = HTParse(url, "", PARSE_HOST); if ((at_sign = strchr(p1, '@')) != NULL) { @@ -745,7 +745,7 @@ PUBLIC int HTDoConnect ARGS4( } FREE(host); FREE(line); - return status; + return status; } sprintf (line, "Making %s connection to %s.", protocol, host); @@ -753,7 +753,7 @@ PUBLIC int HTDoConnect ARGS4( FREE(host); /* - ** Now, let's get a socket set up from the server for the data. + ** Now, let's get a socket set up from the server for the data. */ *s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (*s == -1) { @@ -761,155 +761,155 @@ PUBLIC int HTDoConnect ARGS4( FREE(line); return HT_NO_DATA; } - + #ifndef DOSPATH #if !defined(NO_IOCTL) || defined(USE_FCNTL) /* - ** Make the socket non-blocking, so the connect can be canceled. - ** This means that when we issue the connect we should NOT - ** have to wait for the accept on the other end. + ** Make the socket non-blocking, so the connect can be canceled. + ** This means that when we issue the connect we should NOT + ** have to wait for the accept on the other end. */ { #ifdef USE_FCNTL - int ret = fcntl(*s, F_SETFL, O_NONBLOCK); + int ret = fcntl(*s, F_SETFL, O_NONBLOCK); #else - int val = 1; - int ret = IOCTL(*s, FIONBIO, &val); + int val = 1; + int ret = IOCTL(*s, FIONBIO, &val); #endif /* USE_FCNTL */ - if (ret == -1) - _HTProgress("Could not make connection non-blocking."); + if (ret == -1) + _HTProgress("Could not make connection non-blocking."); } #endif /* !NO_IOCTL || USE_FCNTL */ -#endif /* DOSPATH */ +#endif /* !DOSPATH */ /* - ** Issue the connect. Since the server can't do an instantaneous - ** accept and we are non-blocking, this will almost certainly return - ** a negative status. + ** Issue the connect. Since the server can't do an instantaneous + ** accept and we are non-blocking, this will almost certainly return + ** a negative status. */ #ifdef SOCKS if (socks_flag) { - status = Rconnect(*s, (struct sockaddr*)&soc_address, - sizeof(soc_address)); + status = Rconnect(*s, (struct sockaddr*)&soc_address, + sizeof(soc_address)); /* ** For long Rbind. */ - socks_bind_remoteAddr = soc_address.sin_addr.s_addr; + socks_bind_remoteAddr = soc_address.sin_addr.s_addr; } else #endif /* SOCKS */ status = connect(*s, (struct sockaddr*)&soc_address, sizeof(soc_address)); #ifndef DJGPP /* - ** According to the Sun man page for connect: - ** EINPROGRESS The socket is non-blocking and the con- - ** nection cannot be completed immediately. - ** It is possible to select(2) for comple- - ** tion by selecting the socket for writ- - ** ing. - ** According to the Motorola SVR4 man page for connect: - ** EAGAIN The socket is non-blocking and the con- - ** nection cannot be completed immediately. - ** It is possible to select for completion - ** by selecting the socket for writing. - ** However, this is only possible if the - ** socket STREAMS module is the topmost - ** module on the protocol stack with a - ** write service procedure. This will be - ** the normal case. + ** According to the Sun man page for connect: + ** EINPROGRESS The socket is non-blocking and the con- + ** nection cannot be completed immediately. + ** It is possible to select(2) for comple- + ** tion by selecting the socket for writ- + ** ing. + ** According to the Motorola SVR4 man page for connect: + ** EAGAIN The socket is non-blocking and the con- + ** nection cannot be completed immediately. + ** It is possible to select for completion + ** by selecting the socket for writing. + ** However, this is only possible if the + ** socket STREAMS module is the topmost + ** module on the protocol stack with a + ** write service procedure. This will be + ** the normal case. */ if ((status < 0) && - (SOCKET_ERRNO == EINPROGRESS || SOCKET_ERRNO == EAGAIN)) { - struct timeval timeout; - int ret; - int tries=0; + (SOCKET_ERRNO == EINPROGRESS || SOCKET_ERRNO == EAGAIN)) { + struct timeval timeout; + int ret; + int tries=0; - ret = 0; - while (ret <= 0) { - fd_set writefds; + ret = 0; + while (ret <= 0) { + fd_set writefds; /* - ** Protect against an infinite loop. + ** Protect against an infinite loop. */ if (tries++ >= 180000) { - HTAlert("Connection failed for 180,000 tries."); - FREE(line); - return HT_NO_DATA; + HTAlert("Connection failed for 180,000 tries."); + FREE(line); + return HT_NO_DATA; } timeout.tv_sec = 0; timeout.tv_usec = 100000; - FD_ZERO(&writefds); - FD_SET(*s, &writefds); + FD_ZERO(&writefds); + FD_SET(*s, &writefds); #ifdef SOCKS if (socks_flag) - ret = Rselect(FD_SETSIZE, NULL, - (void *)&writefds, NULL, &timeout); + ret = Rselect(FD_SETSIZE, NULL, + (void *)&writefds, NULL, &timeout); else #endif /* SOCKS */ - ret = select(FD_SETSIZE, NULL, (void *)&writefds, NULL, &timeout); + ret = select(FD_SETSIZE, NULL, (void *)&writefds, NULL, &timeout); /* - ** If we suspend, then it is possible that select will be + ** If we suspend, then it is possible that select will be ** interrupted. Allow for this possibility. - JED */ if ((ret == -1) && (errno == EINTR)) continue; - /* - ** Again according to the Sun and Motorola man pagse for connect: - ** EALREADY The socket is non-blocking and a previ- - ** ous connection attempt has not yet been - ** completed. - ** Thus if the SOCKET_ERRNO is NOT EALREADY we have a real error, - ** and should break out here and return that error. - ** Otherwise if it is EALREADY keep on trying to complete the - ** connection. - */ - if ((ret < 0) && (SOCKET_ERRNO != EALREADY)) { - status = ret; - break; - } else if (ret > 0) { - /* - ** Extra check here for connection success, if we try to - ** connect again, and get EISCONN, it means we have a - ** successful connection. But don't check with SOCKS. - */ + /* + ** Again according to the Sun and Motorola man pages for connect: + ** EALREADY The socket is non-blocking and a previ- + ** ous connection attempt has not yet been + ** completed. + ** Thus if the SOCKET_ERRNO is NOT EALREADY we have a real error, + ** and should break out here and return that error. + ** Otherwise if it is EALREADY keep on trying to complete the + ** connection. + */ + if ((ret < 0) && (SOCKET_ERRNO != EALREADY)) { + status = ret; + break; + } else if (ret > 0) { + /* + ** Extra check here for connection success, if we try to + ** connect again, and get EISCONN, it means we have a + ** successful connection. But don't check with SOCKS. + */ #ifdef SOCKS - if (socks_flag) { - status = 0; - } else { + if (socks_flag) { + status = 0; + } else { #endif /* SOCKS */ - status = connect(*s, (struct sockaddr*)&soc_address, - sizeof(soc_address)); + status = connect(*s, (struct sockaddr*)&soc_address, + sizeof(soc_address)); #ifdef UCX - /* - ** A UCX feature: Instead of returning EISCONN - ** UCX returns EADDRINUSE. - ** Test for this status also. - */ - if ((status < 0) && ((SOCKET_ERRNO == EISCONN) || + /* + ** A UCX feature: Instead of returning EISCONN + ** UCX returns EADDRINUSE. + ** Test for this status also. + */ + if ((status < 0) && ((SOCKET_ERRNO == EISCONN) || (SOCKET_ERRNO == EADDRINUSE))) #else - if ((status < 0) && (SOCKET_ERRNO == EISCONN)) + if ((status < 0) && (SOCKET_ERRNO == EISCONN)) #endif /* UCX */ - { - status = 0; - } + { + status = 0; + } - if (status && (SOCKET_ERRNO == EALREADY)) /* new stuff LJM */ + if (status && (SOCKET_ERRNO == EALREADY)) /* new stuff LJM */ ret = 0; /* keep going */ - else - break; + else + break; #ifdef SOCKS - } + } #endif /* SOCKS */ - } + } #ifdef SOCKS else if (!socks_flag) #else - else + else #endif /* SOCKS */ - { + { /* ** The select says we aren't ready yet. Try to connect ** again to make sure. If we don't get EALREADY or EISCONN, @@ -922,51 +922,51 @@ PUBLIC int HTDoConnect ARGS4( ** For some reason, UCX pre 3 apparently returns ** errno = 18242 instead the EALREADY or EISCONN. */ - status = connect(*s, (struct sockaddr*)&soc_address, - sizeof(soc_address)); - if ((status < 0) && - (SOCKET_ERRNO != EALREADY && SOCKET_ERRNO != EAGAIN) && + status = connect(*s, (struct sockaddr*)&soc_address, + sizeof(soc_address)); + if ((status < 0) && + (SOCKET_ERRNO != EALREADY && SOCKET_ERRNO != EAGAIN) && #ifdef UCX (SOCKET_ERRNO != 18242) && #endif /* UCX */ (SOCKET_ERRNO != EISCONN)) { - break; - } - } - if (HTCheckForInterrupt()) { - if (TRACE) - fprintf(stderr, "*** INTERRUPTED in middle of connect.\n"); - status = HT_INTERRUPTED; - SOCKET_ERRNO = EINTR; - break; - } - } + break; + } + } + if (HTCheckForInterrupt()) { + if (TRACE) + fprintf(stderr, "*** INTERRUPTED in middle of connect.\n"); + status = HT_INTERRUPTED; + SOCKET_ERRNO = EINTR; + break; + } + } } -#endif /* DJGPP */ +#endif /* !DJGPP */ if (status < 0) { - /* - ** The connect attempt failed or was interrupted, - ** so close up the socket. - */ - NETCLOSE(*s); + /* + ** The connect attempt failed or was interrupted, + ** so close up the socket. + */ + NETCLOSE(*s); } #ifndef DOSPATH #if !defined(NO_IOCTL) || defined(USE_FCNTL) else { - /* + /* ** Make the socket blocking again on good connect. */ #ifdef USE_FCNTL - int ret = fcntl(*s, F_SETFL, 0); -#else - int val = 0; - int ret = IOCTL(*s, FIONBIO, &val); + int ret = fcntl(*s, F_SETFL, 0); +#else + int val = 0; + int ret = IOCTL(*s, FIONBIO, &val); #endif /* USE_FCNTL */ - if (ret == -1) - _HTProgress("Could not restore socket to blocking."); + if (ret == -1) + _HTProgress("Could not restore socket to blocking."); } #endif /* !NO_IOCTL || USE_FCNTL */ -#endif /* DOSPATH */ +#endif /* !DOSPATH */ FREE(line); return status; @@ -977,7 +977,7 @@ PUBLIC int HTDoConnect ARGS4( */ PUBLIC int HTDoRead ARGS3( int, fildes, - void *, buf, + void *, buf, unsigned, nbyte) { int ready, ret; @@ -989,11 +989,11 @@ PUBLIC int HTDoRead ARGS3( #endif /* UCX, BSN */ if (fildes <= 0) - return -1; + return -1; if (HTCheckForInterrupt()) { - SOCKET_ERRNO = EINTR; - return (HT_INTERRUPTED); + SOCKET_ERRNO = EINTR; + return (HT_INTERRUPTED); } #if !defined(NO_IOCTL) @@ -1012,17 +1012,17 @@ PUBLIC int HTDoRead ARGS3( } /* - ** If we suspend, then it is possible that select will be + ** If we suspend, then it is possible that select will be ** interrupted. Allow for this possibility. - JED */ - do { + do { timeout.tv_sec = 0; timeout.tv_usec = 100000; FD_ZERO(&readfds); FD_SET(fildes, &readfds); #ifdef SOCKS if (socks_flag) - ret = Rselect(FD_SETSIZE, + ret = Rselect(FD_SETSIZE, (void *)&readfds, NULL, NULL, &timeout); else #endif /* SOCKS */ @@ -1030,34 +1030,34 @@ PUBLIC int HTDoRead ARGS3( (void *)&readfds, NULL, NULL, &timeout); } while ((ret == -1) && (errno == EINTR)); - if (ret < 0) { - return -1; - } else if (ret > 0) { - ready = 1; - } else if (HTCheckForInterrupt()) { - SOCKET_ERRNO = EINTR; - return HT_INTERRUPTED; - } + if (ret < 0) { + return -1; + } else if (ret > 0) { + ready = 1; + } else if (HTCheckForInterrupt()) { + SOCKET_ERRNO = EINTR; + return HT_INTERRUPTED; + } } #if !defined(UCX) || !defined(VAXC) return SOCKET_READ (fildes, buf, nbyte); #else /* - ** VAXC and UCX problem only. + ** VAXC and UCX problem only. */ errno = vaxc$errno = 0; nb = SOCKET_READ (fildes, buf, nbyte); CTRACE(tfp, - "Read - nb,errno,vaxc$errno: %d %d %d\n", nb,errno,vaxc$errno); + "Read - nb,errno,vaxc$errno: %d %d %d\n", nb,errno,vaxc$errno); if ((nb <= 0) && TRACE) - perror ("HTTCP.C:HTDoRead:read"); /* RJF */ + perror ("HTTCP.C:HTDoRead:read"); /* RJF */ /* - ** An errno value of EPIPE and nb < 0 indicates end-of-file on VAXC. + ** An errno value of EPIPE and nb < 0 indicates end-of-file on VAXC. */ if ((nb <= 0) && (errno == EPIPE)) { - nb = 0; - errno = 0; + nb = 0; + errno = 0; } return nb; #endif /* UCX, BSN */ diff --git a/WWW/Library/Implementation/HTTelnet.c b/WWW/Library/Implementation/HTTelnet.c index 2459d1b1..140630e1 100644 --- a/WWW/Library/Implementation/HTTelnet.c +++ b/WWW/Library/Implementation/HTTelnet.c @@ -544,8 +544,8 @@ PRIVATE int HTLoadTelnet ARGS4 ( CONST char *, addr, - HTParentAnchor *, anchor, - HTFormat, format_out, + HTParentAnchor *, anchor GCC_UNUSED, + HTFormat, format_out GCC_UNUSED, HTStream *, sink /* Ignored */ ) { diff --git a/WWW/Library/Implementation/HTUtils.h b/WWW/Library/Implementation/HTUtils.h index 0eb9bfba..63025052 100644 --- a/WWW/Library/Implementation/HTUtils.h +++ b/WWW/Library/Implementation/HTUtils.h @@ -19,6 +19,8 @@ #include <sys/types.h> #else +#define DONT_TRACK_INTERNAL_LINKS 1 + /* Explicit system-configure */ #ifdef VMS #define NO_SIZECHANGE @@ -146,6 +148,10 @@ SOLARIS 2 #endif +#ifndef GCC_UNUSED +#define GCC_UNUSED /* nothing */ +#endif + #ifdef _WINDOWS /* SCW */ #include "windef.h" #define BOOLEAN_DEFINED @@ -420,7 +426,7 @@ Upper- and Lowercase macros /* Pyramid and Mips can't uppercase non-alpha */ #define TOLOWER(c) (isupper((unsigned char)c) ? tolower((unsigned char)c) : (c)) #define TOUPPER(c) (islower((unsigned char)c) ? toupper((unsigned char)c) : (c)) -#endif /* ndef TOLOWER */ +#endif /* TOLOWER */ /* diff --git a/WWW/Library/Implementation/HTWSRC.c b/WWW/Library/Implementation/HTWSRC.c index 56608ac3..e7f15dad 100644 --- a/WWW/Library/Implementation/HTWSRC.c +++ b/WWW/Library/Implementation/HTWSRC.c @@ -14,9 +14,6 @@ #include "HTWSRC.h" -/* #include <sys/types.h> already in tcp.h */ -/* #include <sys/stat.h> this too */ -/* #include <stdio.h> included in HTUtils.h -- FM */ #include "HTML.h" #include "HTParse.h" @@ -428,7 +425,7 @@ PRIVATE void WSRCParser_free ARGS1(HTStream *, me) FREE(me); } -PRIVATE void WSRCParser_abort ARGS2(HTStream *, me, HTError, e) +PRIVATE void WSRCParser_abort ARGS2(HTStream *, me, HTError, e GCC_UNUSED) { WSRCParser_free(me); } diff --git a/WWW/Library/Implementation/HTWriter.c b/WWW/Library/Implementation/HTWriter.c index e9a369aa..f803920f 100644 --- a/WWW/Library/Implementation/HTWriter.c +++ b/WWW/Library/Implementation/HTWriter.c @@ -24,7 +24,7 @@ struct _HTStream { int soc; char *write_pointer; - char buffer[BUFFER_SIZE]; + char buffer[BUFFER_SIZE]; #ifdef NOT_ASCII BOOL make_ascii; /* Are we writing to the net? */ #endif @@ -37,19 +37,19 @@ struct _HTStream { PRIVATE void flush ARGS1(HTStream *, me) { - char *read_pointer = me->buffer; + char *read_pointer = me->buffer; char *write_pointer = me->write_pointer; #ifdef NOT_ASCII if (me->make_ascii) { - char * p; + char * p; for(p = me->buffer; p < me->write_pointer; p++) *p = TOASCII(*p); } #endif while (read_pointer < write_pointer) { - int status; - status = NETWRITE(me->soc, me->buffer, /* Put timeout? @@@ */ + int status; + status = NETWRITE(me->soc, me->buffer, /* Put timeout? @@@ */ write_pointer - read_pointer); if (status<0) { if(TRACE) fprintf(stderr, @@ -64,7 +64,7 @@ PRIVATE void flush ARGS1(HTStream *, me) /*_________________________________________________________________________ ** -** A C T I O N R O U T I N E S +** A C T I O N R O U T I N E S */ /* Character handling @@ -98,14 +98,14 @@ PRIVATE void HTWriter_put_string ARGS2(HTStream *, me, CONST char*, s) */ PRIVATE void HTWriter_write ARGS3(HTStream *, me, CONST char*, s, int, l) { - - CONST char *read_pointer = s; + + CONST char *read_pointer = s; CONST char *write_pointer = s+l; flush(me); /* First get rid of our buffer */ while (read_pointer < write_pointer) { - int status = NETWRITE(me->soc, (char *)read_pointer, + int status = NETWRITE(me->soc, (char *)read_pointer, write_pointer - read_pointer); if (status<0) { if(TRACE) fprintf(stderr, @@ -132,7 +132,7 @@ PRIVATE void HTWriter_free ARGS1(HTStream *, me) FREE(me); } -PRIVATE void HTWriter_abort ARGS2(HTStream *, me, HTError, e) +PRIVATE void HTWriter_abort ARGS2(HTStream *, me, HTError, e GCC_UNUSED) { HTWriter_free(me); } @@ -142,13 +142,13 @@ PRIVATE void HTWriter_abort ARGS2(HTStream *, me, HTError, e) ** ----------------------- */ PRIVATE CONST HTStreamClass HTWriter = /* As opposed to print etc */ -{ +{ "SocketWriter", HTWriter_free, HTWriter_abort, HTWriter_put_character, HTWriter_put_string, HTWriter_write -}; +}; /* Subclass-specific Methods @@ -159,11 +159,11 @@ PUBLIC HTStream* HTWriter_new ARGS1(int, soc) { HTStream* me = (HTStream*)malloc(sizeof(*me)); if (me == NULL) outofmem(__FILE__, "HTML_new"); - me->isa = &HTWriter; - + me->isa = &HTWriter; + #ifdef NOT_ASCII me->make_ascii = NO; -#endif +#endif me->soc = soc; me->write_pointer = me->buffer; return me; @@ -177,11 +177,11 @@ PUBLIC HTStream* HTASCIIWriter ARGS1(int, soc) { HTStream* me = (HTStream*)malloc(sizeof(*me)); if (me == NULL) outofmem(__FILE__, "HTML_new"); - me->isa = &HTWriter; + me->isa = &HTWriter; #ifdef NOT_ASCII me->make_ascii = YES; -#endif +#endif me->soc = soc; me->write_pointer = me->buffer; return me; diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c index 982343c4..df5d8e3d 100644 --- a/WWW/Library/Implementation/SGML.c +++ b/WWW/Library/Implementation/SGML.c @@ -418,44 +418,11 @@ PRIVATE void handle_entity ARGS2( CONST char *s = context->string->data; #ifdef NOTUSED_FOTEMODS int high, low, i, diff; - - - /* - ** Use Lynx special characters for nbsp (160), ensp (8194), - ** emsp (8195), thinsp (8201), and shy (173). - FM - */ - if (!strcmp(s, "nbsp")) { - PUTC(HT_NON_BREAK_SPACE); - FoundEntity = TRUE; - return; - } - if (!strcmp(s, "ensp") || !strcmp(s, "emsp") || !strcmp(s, "thinsp")) { - PUTC(HT_EM_SPACE); - FoundEntity = TRUE; - return; - } - if (!strcmp(s, "shy")) { - PUTC(LY_SOFT_HYPHEN); - FoundEntity = TRUE; - return; - } - - /* - ** For ndash or endash (8211), and mdash or emdash (8212), - ** use an ASCII hyphen (32). - FM - */ - if (!strcmp(s, "ndash") || - !strcmp(s, "endash") || - !strcmp(s, "mdash") || - !strcmp(s, "endash")) { - PUTC('-'); - FoundEntity = TRUE; - return; - } #endif + /* - ** Handle all other entities normally. - FM + ** Handle all entities normally. - FM */ FoundEntity = FALSE; if ((code = HTMLGetEntityUCValue(s)) != 0) { @@ -1873,12 +1840,15 @@ top1: HTChunkTerminate(string); if ((context->isHex ? sscanf(string->data, "%lx", &code) : sscanf(string->data, "%ld", &code)) == 1) { -#ifdef NOTUSED_FOTEMODS if ((code == 1) || (code > 129 && code < 156)) { /* ** Assume these are MicroSoft code points, ** inflicted on us by FrontPage. - FM + ** + ** MS FrontPage uses syntax like ™ in 128-159 range + ** and doesn't follow Unicode standards for this area. + ** Windows-1252 codepoints are assumed here. */ switch (code) { case 1: @@ -1999,7 +1969,6 @@ top1: break; } } -#endif /* NOTUSED_FOTEMODS */ /* ** Check for special values. - FM */ diff --git a/WWW/Library/Implementation/SGML.h b/WWW/Library/Implementation/SGML.h index 7b27da6e..09ff6fe9 100644 --- a/WWW/Library/Implementation/SGML.h +++ b/WWW/Library/Implementation/SGML.h @@ -142,13 +142,13 @@ typedef struct { int number_of_tags; CONST char ** entity_names; /* Must be in strcmp order by name */ size_t number_of_entities; - CONST UC_entity_info * extra_entity_info; /* strcmp order by name */ - size_t number_of_extra_entities; + CONST UC_entity_info * unicode_entity_info; /* strcmp order by name */ + size_t number_of_unicode_entities; /* - ** All calls to extra_entities table should be done + ** All calls to unicode_entities table should be done ** through HTMLGetEntityUCValue (LYCharSets.c) only. - ** Unicode-based extra_entities table now hold *all* - ** old-style entities either. + ** unicode_entities table now holds *all* + ** old-style entities too. */ } SGML_dtd; diff --git a/WWW/Library/Implementation/entities.h b/WWW/Library/Implementation/entities.h index 1fcbac53..55ce977b 100644 --- a/WWW/Library/Implementation/entities.h +++ b/WWW/Library/Implementation/entities.h @@ -1,10 +1,8 @@ -/* Extra Entity Names -** ------------------ -** -** This table contains Unicodes in addition to the Names. +/* Entity Names to Unicode table +** ----------------------------- ** * -* Whole entities[] thing above (and much more) now present +* Whole entities[] thing (and much more) now present * in this kind of structure. The structured streams to which * the SGML modules sends its output could then easily have access * to both entity names and unicode values for each (special) @@ -17,11 +15,13 @@ * Why keep two structures for entities? Backward compatibility.. */ -/* UC_entity_info structure is defined in SGML.h. */ -/* This has to be sorted alphabetically (case-sensitive), - bear this in mind when you add some more entities.. +/* UC_entity_info structure is defined in SGML.h. + This has to be sorted alphabetically (case-sensitive), + bear this in mind when you add some more entities.. */ + +/* -This table available from ftp://ftp.unicode.org/MAPPINGS/ +This table available from ftp://ftp.unicode.org/ original comment follows: @@ -50,10 +50,11 @@ original comment follows: # The contents of this table are drawn from various sources, and # are in the public domain. # -*/ +######################## -/* We just sort it and move column 2 away (line too long, sorry). - Also we add a few synonyms (obsolete): + We just sort it and move column 2 away (line too long, sorry; + look at sgml.html in test/ directory for details). + Also we add a few (obsolete) synonyms: "brkbar" for "brvbar" 0x00A6 "emdash" for "mdash" 0x2014 "endash" for "ndash" 0x2013 @@ -62,7 +63,7 @@ original comment follows: BTW, lots of synonyms found in this table, we shouldn't worry about... */ -static CONST UC_entity_info extra_entities[] = { +static CONST UC_entity_info unicode_entities[] = { {"AElig", 0x00C6}, /* LATIN CAPITAL LETTER AE */ {"Aacgr", 0x0386}, /* GREEK CAPITAL LETTER ALPHA WITH TONOS */ {"Aacute", 0x00C1}, /* LATIN CAPITAL LETTER A WITH ACUTE */ diff --git a/WWW/Library/unix/makefile.in b/WWW/Library/unix/makefile.in index 89c1cf2f..94918497 100644 --- a/WWW/Library/unix/makefile.in +++ b/WWW/Library/unix/makefile.in @@ -20,7 +20,7 @@ LYFLAGS = # FIXME: set in parent makefile CC = @CC@ DEFS = @DEFS@ CPPFLAGS = @CPPFLAGS@ -CPPOPTS = $(DEFS) $(CPPFLAGS) $(LYFLAGS) -I../../.. -I../../../src +CPPOPTS = $(DEFS) $(CPPFLAGS) $(LYFLAGS) -I../../.. -I../../../src -I$(top_srcdir) -I$(top_srcdir)/src LY_CFLAGS = @CFLAGS@ CFLAGS = $(CPPOPTS) $(LY_CFLAGS) |